microsoft / microsoft/DirectXShaderCompiler

Potential invalid DXIL allowed to be generated

Open
#7,391 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug validation
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

I have a shader that needs to be converted to spirv from dxil for Steam Deck but fails and was told by the author of dxil-spirv that the dxil generated is invalid. I have a shader below that demonstrates the issue. This generates an alloca instruction of type %dx.types.Handle (line 17) which causes the issue with the spirv conversion. It can be circumvented by using the indices directly and I also found unrolling the loop made the problematic allocas go away. However, if this is invalid dxil, should it not then be caught by DXC?

Thank you

https://godbolt.org/z/o95nvYr87

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Godbolt shader and inspect the generated DXIL around the %dx.types.Handle alloca, then compare DXC validation with dxil-spirv conversion. Done means determining whether DXC should reject this output or whether the generated DXIL should be valid, with the behavior reproducible from the reported shader.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.