feat(graphics): expose WGSL texture_and_sampler_let as a device cap#8790
Merged
Conversation
Adds detection and automatic wiring for the WGSL `texture_and_sampler_let` language feature, which allows assigning texture and sampler variables to `let` bindings within a WGSL shader. Chrome describes it as preparation for bindless-style support — once textures/samplers can be stored in locals, shaders can do indirection/selection patterns that today require duplicated code paths. Follows the same pattern as the other WGSL feature caps: - `supportsTextureAndSamplerLet` device flag, probed from navigator.gpu.wgslLanguageFeatures. - `CAPS_TEXTURE_AND_SAMPLER_LET` shader define for conditional compilation. - `requires texture_and_sampler_let;` directive automatically injected into WGSL shaders on supporting devices. See https://developer.chrome.com/blog/new-in-webgpu-146
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.
Adds detection and automatic wiring for the WGSL
texture_and_sampler_letlanguage feature, which allows assigning texture and sampler variables toletbindings within a WGSL shader:Chrome describes it as preparation for bindless-style support — once textures/samplers can be stored in locals, shaders can do indirection/selection patterns that today require duplicated code paths.
Follows the same pattern as
unrestricted_pointer_parameters(#8785),pointer_composite_access(#8786), andpacked_4x8_integer_dot_product(#8787).Changes:
GraphicsDevice.supportsTextureAndSamplerLetflag, probed fromnavigator.gpu.wgslLanguageFeaturesinWebgpuGraphicsDevice#initDeviceCaps.CAPS_TEXTURE_AND_SAMPLER_LETshader define for conditional compilation (#ifdef).requires texture_and_sampler_let;directive automatically injected into WGSL shaders on supporting devices viaShaderDefinitionUtils.getWGSLEnables.Notes:
falseand norequiresdirective is emitted, so existing portable shaders continue to compile.See https://developer.chrome.com/blog/new-in-webgpu-146