feat: add WGSL linear_indexing and CAPS_STORAGE_TEXTURE_READ#8648
Merged
Conversation
Detect linear_indexing via wgslLanguageFeatures, expose supportsLinearIndexing, inject requires linear_indexing for compute only, and add CAPS defines for linear indexing and storage-texture read. JSDoc updated for storage texture read.
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.
Adds support for the WGSL
linear_indexinglanguage extension (Chrome 147+):global_invocation_indexandworkgroup_indexin compute shaders. Also setsCAPS_STORAGE_TEXTURE_READwhen storage-texture reads are supported, and clarifies JSDoc forsupportsStorageTextureRead.Changes:
WebgpuGraphicsDevice: setsupportsLinearIndexingfromwgslLanguageFeatures.has("linear_indexing").GraphicsDevice: newsupportsLinearIndexingproperty;initCapsDefinessetsCAPS_LINEAR_INDEXINGandCAPS_STORAGE_TEXTURE_READwhen applicable.ShaderDefinitionUtils.getWGSLEnables: injectrequires linear_indexing;for compute shader modules only when supported.supportsStorageTextureReadnow notesCAPS_STORAGE_TEXTURE_READand uses a WGSL code fence for therequiresexample.API (public):
GraphicsDevice#supportsLinearIndexing—boolean, defaultfalse(WebGL and unsupported browsers).CAPS_LINEAR_INDEXING,CAPS_STORAGE_TEXTURE_READ(when the device reports the matching capability).https://developer.chrome.com/blog/new-in-webgpu-147-148#wgsl_linear_indexing_extension