WebGL Conformance2/ OES_sample_variables - gl_SampleMaskIn/gl_SampleMask

27 views
Skip to first unread message

Sarath Singapati

unread,
Dec 4, 2025, 10:19:03 AM (13 days ago) Dec 4
to angleproject

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

2. runSampleMaskTest() – gl_SampleMask[]
  • FAIL Samples: 1, gl_SampleMask[0]: 0x55555555, Actual: 128, Expected: 255

  • FAIL Samples: 1, gl_SampleMask[0]: 0xAAAAAAAA, Actual: 128, Expected: 0


Proposed workaround

I implemented a workaround in ANGLE to rewrite gl_SampleMaskIn and gl_SampleMask when the sample count is 1The 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

Shahbaz Youssefi

unread,
Dec 4, 2025, 10:47:03 AM (13 days ago) Dec 4
to angleproject
Hi,

Thank you for the report and the fix! Could you please open an issue at anglebug.com/new to track this? It would be helpful to include the contents of chrome://gpu (so we know what gpu, driver version etc is affected).

FYI, it's nearing the end of the year and folks are taking time off. You might not get much response until next year.

Cheers,

Sarath Singapati

unread,
Dec 9, 2025, 7:54:13 AM (8 days ago) Dec 9
to angleproject
Hi,


Thank you

Reply all
Reply to author
Forward
0 new messages