Hello ANGLE team,
While running WebGL conformance tests with ANGLE passthrough enabled, I observed consistent failures in the following test group:
Conformance2/extension/OES_sample_variables
Test link:
https://registry.khronos.org/webgl/sdk/tests/conformance2/extensions/oes-sample-variables.html?webglVersion=2&quiet=0&quick=1
These failures appear to be related to driver behavior when using single-sample framebuffers.
1. runSampleMaskInTest() – gl_SampleMaskIn[]FAIL Expected: 4, Actual: 8, Samples: 1, Sample Coverage: false, Coverage: 0
FAIL Expected: 4, Actual: 8, Samples: 1, Sample Coverage: false, Coverage: 1
FAIL Expected: 4, Actual: 8, Samples: 1, Sample Coverage: true, Coverage: 1
FAIL Samples: 1, gl_SampleMask[0]: 0x55555555, Actual: 128, Expected: 255
FAIL Samples: 1, gl_SampleMask[0]: 0xAAAAAAAA, Actual: 128, Expected: 0
I implemented a workaround in ANGLE to rewrite gl_SampleMaskIn and gl_SampleMask when the sample count is 1. The initial CL is here: https://chromium-review.googlesource.com/c/angle/angle/+/7221852
I noticed that ANGLE already applies special handling for these built-ins in other backends, and my approach follows a similar pattern for the GL backend:
D3D: DynamicHLSL::GenerateShaderLinkHLSL() explicitly rewrites gl_SampleMaskIn[0]
Metal: TranslatorMSL::translateImpl() → AddSampleMaskInDeclaration()
Vulkan: TranslatorSPIRV::translateImpl() → RewriteSampleMaskIn / RewriteSampleMask
Could you please share your thoughts on this and GL-side rewrite approach?
Thank you very much for your time and feedback.
Best regards,
Sarath Singapati