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 content for read-write and read-only storageTexture.access #36880

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chrisdavidmills
Copy link
Contributor

Description

Chrome 124 supports the readonly_and_readwrite_storage_textures language extension (see WGSLLanguageFeatures), which allows the "read-write" and "read-only" storageTexture.access types to be set when specifying storageTexture bind group entry types in a bind group layout.

This PR adds content that describes the new access values to the GPUDevice.createBindGroupLayout page, and a new, improved "Available features" section that describes the feature and an example showing how to detect the availability of a specific feature to the WGSLLanguageFeatures page.

See https://developer.chrome.com/blog/new-in-webgpu-124#read-only_and_read-write_storage_textures for the data source

Motivation

Additional details

Project issue: #36346.

Related issues and pull requests

@chrisdavidmills chrisdavidmills requested a review from a team as a code owner November 20, 2024 13:15
@chrisdavidmills chrisdavidmills requested review from sideshowbarker and removed request for a team November 20, 2024 13:15
@github-actions github-actions bot added the Content:WebAPI Web API docs label Nov 20, 2024
@github-actions github-actions bot added the size/s [PR only] 6-50 LoC changed label Nov 20, 2024
Copy link
Contributor

github-actions bot commented Nov 20, 2024

Preview URLs

External URLs (1)

URL: /en-US/docs/Web/API/WGSLLanguageFeatures
Title: WGSLLanguageFeatures

(comment last updated: 2024-11-20 14:39:50)

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 nits

- `"read-only"`: Enables WSGL code to read storage textures.
- `"read-write"`: Enables WSGL code to read and write to storage textures.
- `"write-only"`: The default value; Enables WSGL code to write to storage textures.
- `undefined`: Indicates that the entry is not a `storageTexture` type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may have existed at one point, around when I first documented it, but I am not 100% sure. Deleted in my next commit ;-)

- `"write-only"`: The default value; Enables WSGL code to write to storage textures.
- `undefined`: Indicates that the entry is not a `storageTexture` type.

The `"read-only"` and `"read-write"` values can only be used if the [`"readonly_and_readwrite_storage_textures"`](/en-US/docs/Web/API/WGSLLanguageFeatures#readonly_and_readwrite_storage_textures) WGSL language extension is present in {{domxref("WGSLLanguageFeatures")}}.
Copy link
Contributor

Choose a reason for hiding this comment

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

You can also say it generates a GPU validation error when it's not the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done; I've also added a bullet to the "Validation" section.

- `"read-write"`: Enables WSGL code to read and write to storage textures.
- `"write-only"`: The default value; Enables WSGL code to write to storage textures.

The `"read-only"` and `"read-write"` values can only be used if the [`"readonly_and_readwrite_storage_textures"`](/en-US/docs/Web/API/WGSLLanguageFeatures#readonly_and_readwrite_storage_textures) WGSL language extension is present in {{domxref("WGSLLanguageFeatures")}}. If this is not the case, a {{domxref("GPUValidationError")}} is generated and an invalid {{domxref("GPUBindGroupLayout")}} object is returned.
Copy link
Contributor

Choose a reason for hiding this comment

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

A GPUValidationError is not raised in the content timeline. (https://gpuweb.github.io/gpuweb/#programming-model-timelines). It will be raised later, which means the GPUBindGroupLayout is actually not invalid or valid. It exists.
I would simply remove and an invalid {{domxref("GPUBindGroupLayout")}} object is returned

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, ok, that makes sense. I've made the suggested change, and removed the "Validation" section entry, as it is not relevant there.

Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs merge conflicts 🚧 [PR only] size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants