Gate @interpolate(linear) behind a downlevel flag - #9972
Open
emilk wants to merge 4 commits into
Open
Conversation
… pipeline creation `@interpolate(linear)` maps to `noperspective` in GLSL, which does not exist in GLSL ES. naga's GLSL backend therefore rejected it, but only at pipeline creation, deep in the backend, with `The selected version doesn't support Features(NOPERSPECTIVE_QUALIFIER)`: no shader label, no source span, no hint that WebGL2 was the constraint. Add `naga::valid::Capabilities::LINEAR_INTERPOLATION` and the corresponding `wgpu_types::DownlevelFlags::LINEAR_INTERPOLATION`, so that `Device::create_shader_module` rejects such shaders up front with a label and a span, like every other backend-unexpressible construct. The GLES backend clears the downlevel flag whenever the shading language version is ES. Also include the GLSL version in the backend's `MissingFeatures` error, so that the remaining paths through it are actionable too. Fixes gfx-rs#9971 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
emilk
commented
Jul 30, 2026
…t capabilities The Vulkan backend builds its downlevel flags from an explicit allowlist rather than from `DownlevelCapabilities::default()`, so the new flag was missing there. That made every Vulkan adapter non-WebGPU-compliant, and thus invisible to `InstanceFlags::STRICT_WEBGPU_COMPLIANCE`, which broke the CTS jobs with `requestAdapter returned null`. The `interpolate` snapshots also need `MULTISAMPLED_SHADING` (they use `@interpolate(*, sample)`), which was previously supplied by `Capabilities::default()` and got dropped when the tests started specifying capabilities explicitly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The naga test already covers the validation gate, and the gpu test could not catch a backend failing to advertise the downlevel flag: it asserted only that shader-module creation agrees with the flag, so an adapter that wrongly omits the flag makes it take the expect-failure branch and pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
emilk
marked this pull request as ready for review
July 30, 2026 12:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connections
Fixes #9971.
Description
@interpolate(linear)becomesnoperspectivein GLSL, which doesn't exist in GLSL ES. naga's GLSL backend rejected it, but only at pipeline creation, withThe selected version doesn't support Features(NOPERSPECTIVE_QUALIFIER)— aDebugprint of an internal bitflag, no shader label, no source span.naga::valid::Capabilities::LINEAR_INTERPOLATION, required forInterpolation::Linear, and report it from every backend'ssupported_capabilities().DownlevelFlags::LINEAR_INTERPOLATIONand map it to that capability, soDevice::create_shader_modulerejects such shaders up front, with a label and a span. The GLES backend clears the flag when the shading language version is ES.MissingFeatureserror now names the version:GLSL 300 es doesn't support the required feature(s): NOPERSPECTIVE_QUALIFIER.Not done here: GLES could actually support this via
NV_shader_noperspective_interpolation(ES 3.0 / WebGL2 extension) rather than refusing it. The report also mentions thecreate_render_pipelineerror never reachingon_uncaptured_error, which looks like a separate bug.Testing
Two naga tests: validation rejects
@interpolate(linear)without the capability and accepts it with, and the GLSL ES backend produces the new message.Note that nothing catches a backend that under-advertises the new downlevel flag. I hit this while writing the PR — Vulkan builds its flags from an allowlist rather than from
DownlevelCapabilities::default(), and the omission only surfaced asrequestAdapter returned nullin the CTS jobs.STRICT_WEBGPU_COMPLIANCE_ADAPTERlooks like the test for this, but a non-compliant adapter is filtered out by the instance flag, so the test is skipped rather than failed. Worth fixing separately.Squash or Rebase?
Ready to rebase.
Checklist
wgpumay be affected behaviorally.CHANGELOG.mdentries for the user-facing effects of this change are present.🤖 Generated with Claude Code