microsoft / microsoft/DirectXShaderCompiler
DispatchMesh fails when given an emtpy struct
Open
Nobody has claimed this yet.
bug
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Call DispatchMesh in an amplification shader with an empty struct, and observe that there's disagreement in the compiler as to the size of the struct (0 vs 4).
Steps to Reproduce
dxc a.hlsl -T as_6_6 -E taskMain
struct S{};
[shader("amplification")]
[numthreads(1,1,1)]
void taskMain(uint tig_0 : SV_GROUPINDEX)
{
S s;
DispatchMesh(1U, 1U, 1U, s);
return;
}
Actual Behavior
error: validation errors
a.hlsl:14:5: error: For amplification shader with entry 'taskMain', payload size 4 is greater than declared size of 0 bytes.
note: at 'call void @dx.op.dispatchMesh.struct.S(i32 173, i32 1, i32 1, i32 1, %struct.S* nonnull %1)' in block '#0' of function 'taskMain'.
Validation failed.
Environment
- DXC version
$ dxc --version libdxcompiler.so: 1.7(dev;0-00000000) - Host Operating System: NixOS
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 by running the shown dxc command with the minimal a.hlsl amplification shader and trace handling of DispatchMesh with the empty struct S. Identify where the compiler and validator derive the payload size; done means they agree and the reproduced validation error no longer occurs.
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
- Clearly specified
- Newbie friendliness
- 45/100