{{ message }}
bindless.md: Replace pinning with automatic visibility#6308
Open
Kangz wants to merge 1 commit into
Open
Conversation
Fixes gpuweb#5378 - Removes texture.pin/unpin and all associated logic. - Adds pinning in the "Alternatives considered" section. - Move setResourceTable to GPUComputePassEncoder/GPURenderPassDescriptor so there are at most one resource table per usage scope. - Detail isShaderVisible, the validation performed by the shader when accessing a resource table slot, along with implementation notes. - Add setResourceUsage and a detailed explanation of the use for it.
Contributor
alan-baker
reviewed
Jun 23, 2026
| When a resource is unpinned it can be used with any usages specified at creation, but when pinned only the single pinned usage is allowed. | ||
| This proposal contains WGSL-side validation for the accesses which is augmented to also check that resources are pinned in addition to being present and of the correct type. | ||
| This way unpinned resources are not accessible via resource tables, ensuring that correct validation and barriers are done when resources are pinned. | ||
| WebGPU's guarantees that there are no data races must be uphelp when resource tables are used, without resource tables, this is done via usage scope validation. |
Contributor
There was a problem hiding this comment.
Suggested change
| WebGPU's guarantees that there are no data races must be uphelp when resource tables are used, without resource tables, this is done via usage scope validation. | |
| WebGPU's guarantees that there are no data races must be upheld when resource tables are used, without resource tables, this is done via usage scope validation. |
| Other helper methods not exposed to the IDL are also defined (`isReadable`, `isWritable`). | ||
| However in practice shaders cannot call CPU functions and instead implementations will maintain per-slot metadata updated before each usage scope (that shaders will query for validation). | ||
|
|
||
| The validation prevents using a slot of the associated full resource has any subresource with a conflicting usage in the usage scope. |
Contributor
There was a problem hiding this comment.
Suggested change
| The validation prevents using a slot of the associated full resource has any subresource with a conflicting usage in the usage scope. | |
| The validation prevents using a slot if the associated full resource has any subresource with a conflicting usage in the usage scope. |
| So we need to prevent data races, so authors need to explicitly choose which usage is accessible through the resource table. | ||
|
|
||
| Even if only readonly resources are in the resource table, they are useful to let the implementation know which resources are intended as accessible during an operation. | ||
| Otherwise implementation have to assume that any resource in the resource table can be accessed, causing pessimizing synchronization and memory barriers during execution. |
Contributor
There was a problem hiding this comment.
Suggested change
| Otherwise implementation have to assume that any resource in the resource table can be accessed, causing pessimizing synchronization and memory barriers during execution. | |
| Otherwise implementations have to assume that any resource in the resource table can be accessed, causing pessimizing synchronization and memory barriers during execution. |
| A new `GPUResourceTable` concept is added to WebGPU that represents a variable-size, sparse and (totally or partially) heterogenous set of bindings. | ||
| The resource table can be set in the `GPUCommandEncoder` state and used in shaders to retrieve the resource of a given type at a given index in the currently set `GPUResourceTable`. | ||
| Bindings in the `GPUResourceTable` can be updated over time as new resources become needed, or previous resources get no longer in use. | ||
| To efficiently implement the validation, memory barrier and other similar kind of tracking needed for `GPUResourceTable`, the mutable resources contained in them must be "pinned" to a certain usage which prevents other kinds of accesses to them. |
There was a problem hiding this comment.
This sentence mentions pinned still.
|
Where is |
Contributor
Author
It's not part of the proposal, it's pseudo code of what the implementation would do internally. I'll make that more clear. |
|
Contributor
Author
|
TBD exactly what the |
Contributor
Author
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.

Fixes #5378