Skip to content

feat(graphics): expose WGSL texture_and_sampler_let as a device cap#8790

Merged
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-texture-and-sampler-let
May 27, 2026
Merged

feat(graphics): expose WGSL texture_and_sampler_let as a device cap#8790
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-texture-and-sampler-let

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

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:

let tex = myTexture;
let s = mySampler;
let c = textureSample(tex, s, uv);

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), and packed_4x8_integer_dot_product (#8787).

Changes:

  • GraphicsDevice.supportsTextureAndSamplerLet flag, probed from navigator.gpu.wgslLanguageFeatures in WebgpuGraphicsDevice#initDeviceCaps.
  • CAPS_TEXTURE_AND_SAMPLER_LET shader define for conditional compilation (#ifdef).
  • requires texture_and_sampler_let; directive automatically injected into WGSL shaders on supporting devices via ShaderDefinitionUtils.getWGSLEnables.

Notes:

  • Infrastructure-only — no shader callers yet. The cap unlocks future bindless-style helpers / indirection patterns.
  • On devices that don't expose the feature, the cap is false and no requires directive is emitted, so existing portable shaders continue to compile.

See https://developer.chrome.com/blog/new-in-webgpu-146

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
@mvaligursky mvaligursky self-assigned this May 27, 2026
@mvaligursky mvaligursky merged commit ad07772 into main May 27, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-wgsl-texture-and-sampler-let branch May 27, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant