KhronosGroup / KhronosGroup/Vulkan-Docs
New SPIR-V capability for PrimitiveId in fragment shader?
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 2
Description
A glslang issue (https://github.com/KhronosGroup/glslang/issues/4147) raised a question about which capability to emit when using the `PrimitiveId` builtin in a fragment shader. In particular, the problem glslang has is that while compiling a fragment shader there is no way to know what the correct capability to apply is, and applying the wrong one leads to problems with implementations that support tessellation but not geometry or vice versa. In theory glslang could add a way to specify the appropriate capability here somehow but even then, the shader author might not know what stage gets put before the fragment shader and so there's a possibility you end up having multiple identical fragment shaders that only differ in whether they have the `Geometry`, `Tessellation`, or `MeshShadingEXT` capability declared, which seems suboptimal.
In the short term, the only real option is for glslang to add some way to specify the capability to add. However, I feel like it would be more efficient and correct to add an extension that adds support for a new capability for the use of `PrimitiveId` in a fragment shader that is independent of the other shader stages.
Contributor guide
Research direction
Start with the linked glslang issue #4147 and the Vulkan-Docs issue text to understand the PrimitiveId capability ambiguity across fragment-shader stages. Define the proposed extension and its capability rules, then document the resulting specification changes once the design is agreed.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100