Unity Bug:Incompatible min precision type for operand #1 of opcode #39 (counts are 1-based).

打包时提示报错

Shader error in ‘Sprites/Diffuse-HueShift’: Program ‘frag_surf’, error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Incompatible min precision type for operand #1 of opcode #39 (counts are 1-based). Expected int or uint. (on gles3)

在编辑器下运行和打包windows平台正常,但安卓平台就报错。
Shader中有下面这几句。

half min = 0.5 - halfWidth;
half max = 0.5 + halfWidth;
color.a *= step(min, IN.texcoord.y) * step(IN.texcoord.y, max);

Unity官方说是HLSL编译器的bug,将half改为float就可以了。

更改后,安卓打包一切正常。

float min = 0.5 - halfWidth;
float max = 0.5 + halfWidth;
color.a *= step(min, IN.texcoord.y) * step(IN.texcoord.y, max);

原问题链接见这里

猜你喜欢

转载自blog.csdn.net/sinat_25415095/article/details/121416839