Skip to content

[wgsl] gate primitive_index built-in behind its extension & [glsl-out] require extensions for gl_PrimitiveID if needed#8879

Merged
teoxoy merged 17 commits intogfx-rs:trunkfrom
inner-daemons:primitive-id
Feb 10, 2026
Merged

[wgsl] gate primitive_index built-in behind its extension & [glsl-out] require extensions for gl_PrimitiveID if needed#8879
teoxoy merged 17 commits intogfx-rs:trunkfrom
inner-daemons:primitive-id

Conversation

@inner-daemons
Copy link
Copy Markdown
Collaborator

@inner-daemons inner-daemons commented Jan 16, 2026

Connections
Closes #8236
Fixes #4413

Description
Adds support for the extension and cleans up some implementation on backends

Testing
Tested using snapshots & other tests

Squash or Rebase?
Squash

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@inner-daemons inner-daemons requested review from cwfitzgerald and removed request for cwfitzgerald January 16, 2026 08:46
@inner-daemons inner-daemons requested a review from teoxoy February 2, 2026 16:36
@inner-daemons inner-daemons requested a review from teoxoy February 3, 2026 19:46
@teoxoy
Copy link
Copy Markdown
Member

teoxoy commented Feb 4, 2026

CI is unhappy, I think because we try to use the builtin in mesh shaders but it's behind its own feature. I think we need to allow usage of the builtin within mesh shaders but also as an input of a fragment shader (that has a mesh shader before it) even if the SHADER_PRIMITIVE_INDEX feature is not available.

@inner-daemons
Copy link
Copy Markdown
Collaborator Author

@teoxoy Yep I jumped the gun on re-requesting a review. Should be good to go now?

@teoxoy
Copy link
Copy Markdown
Member

teoxoy commented Feb 9, 2026

I guess that works but is it intended that mesh shaders require SHADER_PRIMITIVE_INDEX separately? This seems like preexisting behavior so I guess we can land this either way.

@teoxoy
Copy link
Copy Markdown
Member

teoxoy commented Feb 9, 2026

Github was having some issues and the CI workflows got cancelled, could you force push?

@inner-daemons
Copy link
Copy Markdown
Collaborator Author

I guess that works but is it intended that mesh shaders require SHADER_PRIMITIVE_INDEX separately? This seems like preexisting behavior so I guess we can land this either way.

I mean it's not ideal but it's also not the end of the world. Primitive index in mesh shaders is questionably useful anyway, it basically only exists to let you work with existing fragment shaders to my knowledge. You can achieve the exact same thing with a per-primitive u32.

Adding complex logic to decide on which extension to use is probably not worth it.

@teoxoy teoxoy changed the title Added support for primitive id [wgsl] gate primitive_index built-in behind its extension & [glsl-out] require extensions for gl_PrimitiveID if needed Feb 10, 2026
@teoxoy teoxoy merged commit 702c4ef into gfx-rs:trunk Feb 10, 2026
58 checks passed
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.

Support enable primitive-index; in WGSL [glsl-out] Check for gl_PrimitiveID support

2 participants