KhronosGroup / glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
Other
2.95k stars 819 forks source link

gl_SampleMask.length() report array must have size before use length #3180

Open HeXiaoZhi opened 1 year ago

HeXiaoZhi commented 1 year ago

dEQP-GLES31.functional.shaders.sample_variables.sample_mask.discard_half_per_pixel.default_framebuffer

#version 320 es

layout(location = 0) out mediump vec4 fragColor;
void main (void)
{
       for (int i = 0; i < gl_SampleMask.length(); ++i)
              gl_SampleMask[i] = int(0xAAAAAAAA);

       fragColor = vec4(0.0, 1.0, 0.0, 1.0);
}

gl_SampleMask.length() report “array must have size before use length” gl_SampleMask[i]= report “variable indexing fragment shader output array”

arcady-lunarg commented 1 year ago

This is an interesting spec edge case: glslang treats gl_SampleMask as an unsized array, which is actually just fine for purposes of generating SPIR-V (Vulkan explicitly allows it to be unsized) but the GLSL ES spec has it as an explicitly sized array with the correct number of elements for the sample mask based on gl_MaxSamples (which is probably just 1).

HeXiaoZhi commented 1 year ago

Has this issue been fixed

arcady-lunarg commented 1 year ago

Not yet. We would be happy to take patches for these sorts of issues though.