Skip to content

Allow lets of textures and samplers#5389

Merged
alan-baker merged 4 commits intogpuweb:mainfrom
alan-baker:texture-sampler-let
Jan 9, 2026
Merged

Allow lets of textures and samplers#5389
alan-baker merged 4 commits intogpuweb:mainfrom
alan-baker:texture-sampler-let

Conversation

@alan-baker
Copy link
Contributor

Refs #5339

  • Add a language feature, texture_and_sampler_let, that allows the effective value type of a let to be a texture or sampler type

@alan-baker alan-baker added this to the Milestone 2 milestone Oct 15, 2025
@alan-baker alan-baker added wgsl WebGPU Shading Language Issues language extension labels Oct 15, 2025
@alan-baker alan-baker added this to WGSL Oct 15, 2025
@alan-baker alan-baker moved this to Future agenda in WGSL Oct 15, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 15, 2025

Previews, as seen when this build job started (c7a5176):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with wording nit.

@alan-baker alan-baker requested a review from dneto0 October 15, 2025 23:31
@jimblandy jimblandy moved this from Future agenda to Current agenda in WGSL Oct 20, 2025
Copy link

@mwyrzykowski mwyrzykowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using language extensions for non-HW features seems undesirable as it creates a shading language which is fragmented by feature support.

Is there any reason this needs to be a language extension?

Copy link

@mwyrzykowski mwyrzykowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing my objection after discussion in the meeting.

It would be good that if we have at some point an official 'v2' WGSL version that all of these features are rolled-up in the v2 version and no longer reported to avoid this list from becoming increasingly long.

That is probably a separate topic however

@jimblandy
Copy link
Contributor

minutes from WGSL committee meeting 2025-10-21
  • AB: Simple one, quality of life/nice to have. Will write CTS. Lower danger. Allows it as a transient value. Think the spec text is ready to go. We can wait for CTS, will just be validation tests really.
  • JB: Comment from MW on issue and raises some good points.
    • MW: “It would be good that if we have at some point an official 'v2' WGSL version that all of these features are rolled-up in the v2 version and no longer reported to avoid this list from becoming increasingly long.”
  • JB: We are accumulating a bunch of language feature and would be nice to have some kind of way to say you don't need to worry about them anymore and they're just spec now.
  • AB: At risk of sounding strange, could have a language feature that implies other language features.
  • JP: Currently PR is scoped/named for textures/samples. Do we want other handle types like for bindless the bindless array or other handle types in the future?
  • AB: Not sure how to phrase that in the spec. I guess if they're coming later they can assume the language feature and add theemselves to the last? Maybe doesn't work, if they're an enable it's fine? Any type?
  • JP: Any handle type? It's the name, should be lets of handles instead of lets of texture/samplers? Then a future handle type could decide if it allows that
  • AB: So, any type instantiated in the handle address space, or anything that is opaque.
  • JP: Remembering where handle is used, was thinking address space
  • AB: That seems Ok, would be easy to change spec text to. Seems pretty restrictive, so seems safe. Going back to bufferView didn't want a let of buffer. If it's just opaque then answer is different.
  • DN: Should remember when we spec the bindless or arrays of textures to allow in lets. Kind of assume that we would allow from the get-go.
  • DS: For resource_binding don't think you'd want it, but maybe for binding_array?
  • JP: Let is just alias, so it all folds away anywhere. No technical reason why we couldn't. More a question of what users would want to do.
  • AB: Agree mostly. Thinking about buffer_view. A let of a buffer doesn't mean anything and you can't load it. You just couldn't use it anywhere. If you can't use it, why? it could be done. Doesn't make a difference to me. So, could write any type there I suppose. Feel like redesigning on the fly. If we want to go in this direction should wait and decide where we want to go.
  • DN: To confirm, did this fall out of bindless use cases?
  • AB: Yes. Also had other WESL requests where people wanted to be able to assign with conditional assignments.
  • JB: WESL wanted to return
  • AB: Yea didn't want to go that far yet. We couldn't do it in a meaningful way in the spec at the moment. But this seems nice for users. When we get to arrays of things will be nice to have.
  • DS: Seems in general this is the right thing, just with name being lets-of-handle. Gives us the flexibility we want.
  • JB: The default of the name should be inclusion.
  • AB: Do you want to phrased as anything in handle in to let or change feature name?
  • DS: I would just change the feature name and as we add things we can include them as it makes sense.
  • JB: Sounds like there is still some open questions to be worked out. Pretty detailed. General idea of introducing this relaxation has consensus. Need way to say what is covered by this generalization. Let folks think about it and come back in a later meeting.

@mighdoll
Copy link

As @alan-baker noted in the 2025.10.21 meeting, we see WESL requests to allow conditional compilation to cover textures and samplers (we showed some bevy examples at the last F2F). Lets on textures and samplers is a nice step toward supporting those cases in WGSL.

Copy link
Contributor

@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo bikeshedding the name (per committee discussion).

@jimblandy
Copy link
Contributor

minutes from WGSL committee meeting 2025-10-28
  • “LGTM, modulo bikeshedding the name (per committee discussion).” - @dneto in the issue
  • JB: What kinds of things are we expecting to go into the handle address space? Heterogenous binding arrays.
  • DS: texel_buffer?
  • AB: Yes, it’d be a texture type, so already covered.
  • DS: So resource_binding and possibly binding_array.
  • JB: Brainstormed: resource_let, unrestricted_let, unrestricted_let_types, but not super hung up on this.
  • DS: resource_let would be interesting
  • AB: Sort of implies it allows more than it does. If you do a let of a storage buffer and attempt to invoke load rule, that’s not possible if it has a runtime array. So not really a resource let at that point, it’s a copy of the data. My other thought was that things that come in the future can make themselves or not. This feature just deals with things that are already in the spec that were not originally allowed.
  • DS: Makes sense to me, so the current name is fine.
  • JB: Yes, sounds OK. Everything else just goes in automatically.
  • Consensus: merge with current name

Refs gpuweb#5339

* Add a language feature, `texture_and_sampler_let`, that allows the
  effective value type of a let to be a texture or sampler type
@alan-baker alan-baker force-pushed the texture-sampler-let branch from 11bf024 to c7a5176 Compare January 9, 2026 21:29
@alan-baker alan-baker enabled auto-merge (squash) January 9, 2026 21:29
@alan-baker alan-baker merged commit 9df11a5 into gpuweb:main Jan 9, 2026
4 checks passed
@github-project-automation github-project-automation bot moved this from Waiting on CTS to Done in WGSL Jan 9, 2026
@alan-baker alan-baker deleted the texture-sampler-let branch January 10, 2026 20:06
Kangz pushed a commit to webgpu-native/webgpu-headers that referenced this pull request Jan 12, 2026
Add support for the `texture_and_sampler_let` language feature.

Spec PR: gpuweb/gpuweb#5389
ajperel pushed a commit to chromium/chromium that referenced this pull request Jan 12, 2026
The feature has landed in Dawn, just waiting for CTS and spec to land.

Spec: gpuweb/gpuweb#5389
CTS: gpuweb/cts#4490

Fixed: 474082348
Change-Id: I4a1912b5878a7dcd5a9ad422544ccb654424fde0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7414637
Reviewed-by: Kai Ninomiya <[email protected]>
Commit-Queue: dan sinclair <[email protected]>
Auto-Submit: dan sinclair <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1567897}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

language extension wgsl WebGPU Shading Language Issues

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants