DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

DispatchMesh fails when given an emtpy struct

Open expipiplus1 opened this issue 2 years ago • 1 comments

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

expipiplus1 avatar Sep 07 '23 08:09 expipiplus1

We think that the validator is correctly complaining about bad code that the compiler generated, so removing the validation label.

damyanp avatar Oct 10 '24 17:10 damyanp