microsoft / microsoft/DirectXShaderCompiler
Enforce mesh shader output requirements
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Currently, mesh shader is not requiring output vertices or indices as should be required.
There should also be a requirement that mesh shader vertex output has SV_Position (not enforced currently either). With that were to be enforced, and added to the struct, the validator will fail unless you write to all components of SV_Position. This should probably only be the case if OutputCounts are set to anything other than 0.
While shaders without these components aren't very useful in practice, a lot of our testing has cut corners like this and will have to be updated as well.
Steps to Reproduce
Just create a mesh shader with no output vertices nor indices.
https://godbolt.org/z/4fc65rGqq
Actual Behavior
The shader compiles, but it shouldn't as such a shader is incorrect and not at all useful.
The validator needs to catch this case.
Environment
- DXC version 1.7.0.4313
- Host Operating System win11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mesh shader validator and the Godbolt reproduction linked in the issue. Trace how output vertices, indices, OutputCounts, and SV_Position are currently checked, then update the affected shader tests, including cases that omit these outputs. Done means invalid mesh shaders are rejected while valid output-count-zero cases continue to compile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100