writemasks on stores to clipdistance fail to compile
This TGSI passes when run through virgl from the KHR-GL30.clip_distance.functional
test:
TGSI after translation from NIR:
VERT
PROPERTY NUM_CLIPDIST_ENABLED 1
PROPERTY NEXT_SHADER FRAG
DCL IN[0]
DCL OUT[0], POSITION
DCL OUT[1], CLIPDIST
IMM[0] UINT32 {0, 0, 0, 0}
0: MOV OUT[0], IN[0]
1: MOV OUT[1], IMM[0].xxxx
2: END
But this TGSI fails (.x
on the store, and optionally also .x on the out[1] decl):
VERT
PROPERTY NUM_CLIPDIST_ENABLED 1
PROPERTY NEXT_SHADER FRAG
DCL IN[0]
DCL OUT[0], POSITION
DCL OUT[1], CLIPDIST
IMM[0] UINT32 {0, 0, 0, 0}
0: MOV OUT[0], IN[0]
1: MOV OUT[1].x, IMM[0].xxxx
2: END
Fail (Fail)
with this compiler output:
GLSL shader 2 failed to compile.
GLSL shader 2 info log:
0:10(1): error: value of type float cannot be assigned to variable of type vec4
vrend_compile_shader: context error reported 1 "glcts" Illegal shader 0
shader failed to compile
0:10(1): error: value of type float cannot be assigned to variable of type vec4
vs: 2 GLSL:
1: #version 140
2: #extension GL_ARB_shader_bit_encoding : require
3: in vec4 in_0;
4: uniform float winsys_adjust_y;
5: out float gl_ClipDistance[1];
6: vec4 clip_dist_temp[2];
7: void main(void)
8: {
9: gl_Position = vec4(((in_0)));
10: clip_dist_temp[0 ] = float((uintBitsToFloat(uvec4(0U,0U,0U,0U)).x));
11: gl_ClipDistance[0] = clip_dist_temp[0].x;
12: gl_Position.y = gl_Position.y * winsys_adjust_y;
13: }
I could make nir-to-tgsi always store clip distances to a temp and then emit a vec4 store at the end, but this feels like a workaround for a driver bug that I could just go fix. What is our backwards compatibility standard for newer virgl guest on older virglrenderer?
Note also that with what I'm doing so far, you get two separate clipdist0 and clipdist1 decls, rather than an array of 1 or 2 elements like you used to. That seems to be enough for the KHR clipdist tests, at least, but I may need to revisit that behavior.