Skip to content

feat(graphics): expose WGSL unrestricted_pointer_parameters as a device cap#8785

Merged
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-unrestricted-pointer-params
May 27, 2026
Merged

feat(graphics): expose WGSL unrestricted_pointer_parameters as a device cap#8785
mvaligursky merged 1 commit into
mainfrom
mv-wgsl-unrestricted-pointer-params

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Adds detection and automatic wiring for the WGSL unrestricted_pointer_parameters language feature, following the same pattern as linear_indexing, subgroup_id, and the other WGSL feature caps.

Companion to #8784 — that PR worked around the missing feature by inlining the helper; this PR exposes the cap so future shaders can opt into pointer-of-storage parameters on devices that support it, with a portable fallback path on browsers that don't.

Changes:

  • GraphicsDevice.supportsUnrestrictedPointerParameters flag, probed from navigator.gpu.wgslLanguageFeatures in WebgpuGraphicsDevice#initDeviceCaps.

  • CAPS_UNRESTRICTED_POINTER_PARAMETERS shader define for conditional compilation (#ifdef).

  • requires unrestricted_pointer_parameters; directive automatically injected into WGSL shaders on supporting devices via ShaderDefinitionUtils.getWGSLEnables.

  • WebGPU init log extended to list the browser's advertised WGSL language features alongside the GPU feature list. Example:

    WEBGPU (apple / metal-3) features [full]: float32-filterable, ..., subgroups, wgslFeatures(readonly_and_readwrite_storage_textures, packed_4x8_integer_dot_product, unrestricted_pointer_parameters, ...)
    

Notes:

  • Infrastructure-only — no shader callers yet. The cap is available for future WGSL helpers that benefit from passing storage/uniform/workgroup pointers across function boundaries.
  • Firefox/naga doesn't currently expose this feature; the cap will be false there and no requires directive is emitted, so existing portable shaders continue to compile.

…ce cap

Adds detection and automatic wiring for the WGSL `unrestricted_pointer_parameters`
language feature, matching the pattern used for `linear_indexing`, `subgroup_id`,
and other WGSL features:

- `supportsUnrestrictedPointerParameters` device flag, probed from
  navigator.gpu.wgslLanguageFeatures.
- `CAPS_UNRESTRICTED_POINTER_PARAMETERS` shader define for conditional
  compilation.
- `requires unrestricted_pointer_parameters;` directive automatically injected
  into WGSL shaders on supporting devices.

Also extends the WebGPU init log to include the WGSL language features
advertised by the browser, alongside the existing GPU feature list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant