Add primitive-index feature and associated builtin#5273
Conversation
dj2
left a comment
There was a problem hiding this comment.
LGTM. Will leave it to Alan for approval.
|
Previews, as seen when this build job started (0b580c7): |
|
Thanks all! Just need WG approval at this point (I don't think we finalized that previously.) |
|
Let's try to get approval offline: @teoxoy @jimblandy this is basically the same as WGPU's SHADER_PRIMITIVE_INDEX feature, would you be ok merging this in? |
|
LGTM but should it be |
Oh good observation, reading the relevant WGSL specification I am confused regarding when |
|
That's a really good point. I went with I'm in favor of renaming to |
Adds the "primitive-id" feature, which enables the `primitive_id` builtin, to the WebGPU and WGSL specs. Fixes gpuweb#1786
Co-authored-by: dan sinclair <dj2@everburning.com>
|
I'm not a WGSL designer but in my mind, that canonical thing is called |
|
I'm not sure I understand the difference, in that case, between Ultimately I'll ensure the spec change follows whatever the WGSL group decides, but it does seem like "index" would be the more consistent verbiage. |
|
I agree with @toji 's analysis. The outlier then becomes subgroup_invocation_id - I'm not sure how much adoption of subgroups exists so far which would allow us to make a breaking change there for consistency |
|
Ah fair point, I missed that about vertex/instance. I'm still a little unsure if this should be called an "index" since it's not an index into any actual array, but I don't feel strongly about that. |
|
Assuming index suffix means 'index into an array', then yes I think we should leave this as-is ( |
GPU Web WG 2025-08-20 Atlantic-time
|
Following up on gpuweb/gpuweb#5273, this PR adds the `"primitive-index"` GPUFeatureName.
Following up on gpuweb/gpuweb#5273, this PR adds the `"primitive-index"` GPUFeatureName.
Adds the "primitive-id" feature, which enables the
primitive_idWGSL builtin, to both the WebGPU and WGSL specs.Fixes #1786