ios版本闪白shader失效

cocos creator3.7.3发布的ios版本,闪白shader出问题。有哪位大佬遇到过这种情况吗??有啥解决方案?

你这不得把自己的代码放出来? :joy:程序员问问题啥都不给出来

:smile:说的好有道理

//--------------------闪白shader代码

// Copyright © 2017-2020 Xiamen Yaji Software Co., Ltd.

CCEffect %{

techniques:

  • passes:

    • vert: spine-vs:vert

      frag: spine-fs:frag

      depthStencilState:

      depthTest: false

      depthWrite: false

      blendState:

      targets:

      • blend: true

        blendSrc: src_alpha

        blendDst: one_minus_src_alpha

        blendDstAlpha: one_minus_src_alpha

      rasterizerState:

      cullMode: none

      properties:

      mainTexture: { value: white }

      alphaThreshold: { value: 0.5 }

      u_color: { value: [1,1,1,1], editor: {type: color} }

      u_rate: { value: 1 }

}%

CCProgram spine-vs %{

precision highp float;

#include <builtin/uniforms/cc-global>

#if USE_LOCAL

#include <builtin/uniforms/cc-local>

#endif

#if SAMPLE_FROM_RT

#include <common/common-define>

#endif

in vec3 a_position;

in vec2 a_texCoord;

in vec4 a_color;

out vec4 v_light;

out vec4 color;

out vec2 uv0;

#if USE_TINT

in vec4 a_color0;

out vec4 v_dark;

#endif

vec4 vert () {

vec4 pos = vec4(a_position, 1);

#if USE_LOCAL

  pos = cc_matWorld * pos;

#endif

#if USE_PIXEL_ALIGNMENT

  pos = cc_matView * pos;

  pos.xyz = floor(pos.xyz);

  pos = cc_matProj * pos;

#else

  pos = cc_matViewProj * pos;

#endif

v_light = a_color;

#if USE_TINT

  v_dark = a_color0;

#endif

uv0 = a_texCoord;

#if SAMPLE_FROM_RT

  CC_HANDLE_RT_SAMPLE_FLIP(uv0);

#endif

color = a_color;

return pos;

}

}%

CCProgram spine-fs %{

precision highp float;

#include <builtin/internal/embedded-alpha>

#include <builtin/internal/alpha-test>

in vec4 v_light;

#if USE_TINT

in vec4 v_dark;

#endif

#if USE_TEXTURE

in vec2 uv0;

uniform sampler2D mainTexture;

#pragma builtin(local)

layout(set = 2, binding = 11) uniform sampler2D cc_spriteTexture;

#endif

uniform ARGS {

vec4 u_color;

float u_rate;

};

vec4 frag () {

vec4 o = vec4(1, 1, 1, 1);



#if USE_TEXTURE

  o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);

#endif



o *= v_light;

vec4 finalColor;

#if USE_TINT

  finalColor.a = v_light.a * o.a;

  finalColor.rgb = ((o.a - 1.0) * v_dark.a + 1.0 - o.rgb) * v_dark.rgb + o.rgb * v_light.rgb;

#else

  finalColor = o * v_light;

#endif

ALPHA_TEST(finalColor);

vec3 result = mix(u_color.rgb, finalColor.rgb, u_rate);

o = vec4(result.rgb, finalColor.a);

return o;

}

}%

sprite-effect.zip (1.1 KB)

提供一下我的思路,我们这边全平台可以跑

3赞

感谢大佬 :grinning: