Since upgrading to 5.2 our Android shaders have started failing to compile on device.
Specifically the HLSL2GLSL compiler (or optimiser) is outputting bad code … see this (redacted).
mediump vec4 phase0_Output0_1;
out mediump float vs_TEXCOORD1;
out mediump vec4 vs_COLOR0;
highp vec4 t0;
void main()
{
t0 = in_POSITION0.yyyy * glstate_matrix_mvp[1];
t0 = glstate_matrix_mvp[0] * in_POSITION0.xxxx + t0;
t0 = glstate_matrix_mvp[2] * in_POSITION0.zzzz + t0;
gl_Position = glstate_matrix_mvp[3] * in_POSITION0.wwww + t0;
t0.xyz = in_POSITION0.yyy * glstate_matrix_modelview0[1].xyz;
t0.xyz = glstate_matrix_modelview0[0].xyz * in_POSITION0.xxx + t0.xyz;
t0.xyz = glstate_matrix_modelview0[2].xyz * in_POSITION0.zzz + t0.xyz;
t0.xyz = glstate_matrix_modelview0[3].xyz * in_POSITION0.www + t0.xyz;
t0.x = dot(t0.xyz, t0.xyz);
t0.z = sqrt(t0.x);
t0.xy = in_TEXCOORD0.xy * _MainTex_ST.xy + _MainTex_ST.zw;
phase0_Output0_1 = t0.xyz;
vs_COLOR0 = in_COLOR0;
vs_TEXCOORD0 = phase0_Output0_1.xy;
vs_TEXCOORD1 = phase0_Output0_1.z;
return;
}
t0 is some temporary vec4 generated by the cross compiler and phase0_Output0_1 is also a vec4 generated by the compiler - not one of ours.
It then attempts to do …
phase0_Output0_1 = t0.xyz;
Which results in the following runtime error on the devices we’ve tested so far …
09-09 18:37:19.976: D/Unity(32761): ERROR: 0:128: ‘assign’ : cannot convert from ‘3-component vector of float’ to ‘4-component vector of float’
09-09 18:37:19.976: D/Unity(32761): ERROR: 1 compilation errors. No code generated.
09-09 18:37:19.976: D/Unity(32761): Note: Creation of internal variant of shader (2-pass)’ failed.
Is anybody else seeing GLSL compile issues at runtime?