Skip to content

Crash when using structurally equivalent structs #1560

Description

The following program crashes on dxc but works on fxc.

// dxc /Tgs_6_0 t.hlsl
struct VSOutGSIn
{
    float4  clr : COLOR0;
    float4  pos : SV_Position;
};

struct GSOutPSIn
{
    float4  clr : COLOR0;
    float4  pos : SV_Position;
};

[maxvertexcount(3)]
void main(triangle VSOutGSIn tri[3], inout TriangleStream<GSOutPSIn> stream)
{
//#define WORKAROUND
#if !defined(WORKAROUND)
    stream.Append(tri[0]);
    stream.Append(tri[1]);
    stream.Append(tri[2]);
#else
    GSOutPSIn t0;
        t0.clr = tri[0].clr;
        t0.pos = tri[0].pos;
    GSOutPSIn t1;
        t1.clr = tri[1].clr;
        t1.pos = tri[1].pos;
    GSOutPSIn t2;
        t2.clr = tri[2].clr;
        t2.pos = tri[2].pos;

    stream.Append(t0);
    stream.Append(t1);
    stream.Append(t2);
#endif
}

If I copy the fields manually it works correctly on dxc. Seems to be some issue with casting between structurally equivalent types.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugBug, regression, crash

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions