glslang/Test/hlsl.matpack-1.frag
LoopDawg 898f5fbef7 HLSL: fix qualifier propagation from user struct types to block definitions.
The HLSL FE tracks four versions of a declared type to avoid losing information, since it
is not (at type-decl time) known how the type will be used downstream.  If such a type
was used in a cbuffer declaration, the cbuffer type's members should have been using
the uniform form of the original user structure type, but were not.

This would manifest as matrix qualifiers (and other things, such as pack offsets) on user struct
members going missing in the SPIR-V module if the struct type was a member of a cbuffer, like so:

    struct MyBuffer
    {
        row_major float4x4 mat1;
        column_major float4x4 mat2;
    };

    cbuffer Example
    {
        MyBuffer g_MyBuffer;
    };

Fixes: #789
2017-08-04 15:50:10 -06:00

28 lines
435 B
GLSL

struct MyBuffer1
{
column_major float4x4 mat1;
row_major float4x4 mat2;
float4 vec1;
float foo;
};
struct MyBuffer2
{
row_major float4x4 mat1;
float4 vec1;
};
cbuffer Example
{
MyBuffer1 g_MyBuffer1;
MyBuffer2 g_MyBuffer2;
column_major float4x4 mat1a;
};
float4 main() : SV_Target0
{
return mul(g_MyBuffer1.mat1, g_MyBuffer1.vec1) +
mul(g_MyBuffer2.mat1, g_MyBuffer2.vec1);
}