Skip to content

feat: add WGSL linear_indexing and CAPS_STORAGE_TEXTURE_READ#8648

Merged
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-linear-indexing
Apr 24, 2026
Merged

feat: add WGSL linear_indexing and CAPS_STORAGE_TEXTURE_READ#8648
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-linear-indexing

Conversation

@mvaligursky
Copy link
Copy Markdown
Contributor

@mvaligursky mvaligursky commented Apr 24, 2026

Adds support for the WGSL linear_indexing language extension (Chrome 147+): global_invocation_index and workgroup_index in compute shaders. Also sets CAPS_STORAGE_TEXTURE_READ when storage-texture reads are supported, and clarifies JSDoc for supportsStorageTextureRead.

Changes:

  • WebgpuGraphicsDevice: set supportsLinearIndexing from wgslLanguageFeatures.has("linear_indexing").
  • GraphicsDevice: new supportsLinearIndexing property; initCapsDefines sets CAPS_LINEAR_INDEXING and CAPS_STORAGE_TEXTURE_READ when applicable.
  • ShaderDefinitionUtils.getWGSLEnables: inject requires linear_indexing; for compute shader modules only when supported.
  • JSDoc: supportsStorageTextureRead now notes CAPS_STORAGE_TEXTURE_READ and uses a WGSL code fence for the requires example.

API (public):

  • GraphicsDevice#supportsLinearIndexingboolean, default false (WebGL and unsupported browsers).
  • Preprocessor: 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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant