[naga wgsl-in wgsl-out] WGSL support for texture_external texture type #7822
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
Part of #4386
Description
Make wgsl-in correctly parse
texture_external
texture declarations, and allow such textures to be used intextureDimensions()
,textureSampleBaseClampToEdge()
, andtextureLoad()
function calls. In IR these are represented by theImageClass::External
image class, which is a 2D, non-multisampled, non-mipmapped, float-sampled image.Adds a new Capability
TEXTURE_EXTERNAL
and ensure validation rejects shaders containing external textures if this capability flag is not set. This capability is enabled for validation by wgpu devices which support theTEXTURE_EXTERNAL
feature (currently only when using the noop backend), and by the Naga CLI when validating-only or when outputting WGSL.The WGSL backend can of course emit
ImageClass::External
images directly astexture_external
textures. Other backends are, for now, unimplemented.Lastly, we add a snapshot test covering all the valid uses of a texture_external texture. These are:
textureDimensions()
,textureSampleBaseClampToEdge()
, andtextureLoad()
We keep these in their own test so that we can control which targets to run them against (currently WGSL and IR). When external textures are supported by all Naga backends we can, if so inclined, integrate these with existing texture tests.
Testing
Snapshot test
Squash or Rebase?
Either. But if squashing make sure the commit message is tidy
Checklist
cargo fmt
.taplo format
.cargo clippy --tests
. If applicable, add:--target wasm32-unknown-unknown
cargo xtask test
to run tests.CHANGELOG.md
entry.I don't think this by itself deserves a changelog entry - when we add at least one non-wgsl backend that would be more noteworthy