Skip to content
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

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

chrisdavidmills
Copy link
Contributor

@chrisdavidmills chrisdavidmills commented Nov 4, 2024

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

@chrisdavidmills chrisdavidmills requested a review from a team as a code owner November 4, 2024 12:40
@chrisdavidmills chrisdavidmills requested review from wbamberg and removed request for a team November 4, 2024 12:40
@github-actions github-actions bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Nov 4, 2024
Copy link
Contributor

github-actions bot commented Nov 4, 2024

Copy link
Contributor

@beaufortfrancois beaufortfrancois 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 nit


```js
// Set bind group in slot 0
passEncoder.setBindGroup(0, bindGroup);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

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

👍

@chrisdavidmills chrisdavidmills merged commit 7797f84 into mdn:main Nov 5, 2024
8 checks passed
@chrisdavidmills chrisdavidmills deleted the null-unset-bind-groups branch November 5, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants