https://bugs.freedesktop.org/show_bug.cgi?id=104143
--- Comment #8 from Gert Wollny gw.fossdev@gmail.com --- I found the problem:
if KC0[0].x == index (=0):
1 x: ADD_INT T0.x, KC0[0].x, [0xfffffffe -nan].x 2 x: MOVA_INT __.x, T0.x
Address register is now -2 and hence, in the next step R1 is unconditionally written, and this is actually the gl_Vertex value ...
3 z: MOV R[3+AR].z, 0 w: MOV R[3+AR].w, [0x3dcccccd 0.1].x
that is here used to evaluate the gl_Posuition.
5 x: MUL_IEEE T0.x, KC0[1].w, R1.x y: MUL_IEEE T0.y, KC0[1].z, R1.x 6 t: MULADD_IEEE T0.y, KC0[2].z, R1.y, T0.y SCL_212 ...
In the un-optimized shader R[3+AR].w is only written to if (KC0[0].x >= 2), and hence AR >= 0;
I.e. the sb optimizer is to aggressive in optimizing away the conditional blocks.