feat(graphics): expose WGSL pointer_composite_access as a device cap#8786
Merged
Conversation
Adds detection and automatic wiring for the WGSL `pointer_composite_access` language feature, which provides syntactic sugar for dereferencing pointers to composite types — `p.field` and `p[i]` instead of `(*p).field` and `(*p)[i]`. Follows the same pattern as `unrestricted_pointer_parameters` and `linear_indexing`: - `supportsPointerCompositeAccess` device flag, probed from navigator.gpu.wgslLanguageFeatures. - `CAPS_POINTER_COMPOSITE_ACCESS` shader define for conditional compilation. - `requires pointer_composite_access;` directive automatically injected into WGSL shaders on supporting devices. See https://developer.chrome.com/blog/new-in-webgpu-123#syntax_sugar_for_dereferencing_composites_in_wgsl
This was referenced May 27, 2026
Open
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 detection and automatic wiring for the WGSL
pointer_composite_accesslanguage feature, which provides syntactic sugar for dereferencing pointers to composite types —p.fieldandp[i]instead of(*p).fieldand(*p)[i].Follows the same pattern as
unrestricted_pointer_parameters(#8785) andlinear_indexing.Changes:
GraphicsDevice.supportsPointerCompositeAccessflag, probed fromnavigator.gpu.wgslLanguageFeaturesinWebgpuGraphicsDevice#initDeviceCaps.CAPS_POINTER_COMPOSITE_ACCESSshader define for conditional compilation (#ifdef).requires pointer_composite_access;directive automatically injected into WGSL shaders on supporting devices viaShaderDefinitionUtils.getWGSLEnables.Notes:
falsethere and norequiresdirective is emitted, so existing portable shaders continue to compile.