-
Notifications
You must be signed in to change notification settings - Fork 22.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add information about passing null to unset a bind group #36648
Add information about passing null to unset a bind group #36648
Conversation
Preview URLs
(comment last updated: 2024-11-04 13:17:22) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nit
|
||
```js | ||
// Set bind group in slot 0 | ||
passEncoder.setBindGroup(0, bindGroup); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: bindGroup
comes ouf of no where. Maybe call it myBindGroup
or reuse uniformBindGroup
from above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I've fixed this up, on both this page and the GPURenderBundleEncoder.setBindGroup()
page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Description
In Chrome 117 onwards, you can pass
null
as the second argument when calling https://developer.mozilla.org/en-US/docs/Web/API/GPUComputePassEncoder/setBindGroup#bindgroup, https://developer.mozilla.org/en-US/docs/Web/API/GPURenderPassEncoder/setBindGroup#bindgroup, and https://developer.mozilla.org/en-US/docs/Web/API/GPURenderBundleEncoder/setBindGroup#bindgroup to unset a previously-set bind group in the specified slot.This PR adds some text to the
bindGroup
argument description to specify this and also adds a small example snippet to each page to show what the unsettling code might look like.See https://developer.chrome.com/blog/new-in-webgpu-117#unset_bind_group for evidence of this change.
Note that the above link does not mention GPUComputePassEncoder/setBindGroup, but I tested it and it works there as well.
Motivation
Additional details
Related issues and pull requests
Project issue: #36375