microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
Other
3.09k stars 690 forks source link

Arrays of structs in GS OutputStreams are not supported #1768

Open tristanlabelle opened 5 years ago

tristanlabelle commented 5 years ago

Repro:

struct GSInOutNested { float value : TEXCOORD0; };
struct GSInOut { GSInOutNested nested[1]; };

[maxvertexcount(1)]
void main(point GSInOut input[1], inout PointStream<GSInOut> output)
{
    output.Append(input[0]);
}

It looks like this was never implemented. It will currently hit this assert:

DXASSERT(0, "Not support array of struct when split pointers."); (from ::SplitPtr, in file D:\DirectXShaderCompiler\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp)

tristanlabelle commented 5 years ago

The issue probably has to do with the fact that DXIL supports arrays but not structures, so struct { int; float; } [42] kind of has to be lowered to int[42]; float[42], but that changes the in-memory layout and potentially the ordering of the semantics.