glslang/Test/hlsl.self_cast.frag
LoopDawg c59916710e HLSL: allow self-type cast (as no-op passthrough)
Previously, casting an object of a struct type to an identical type
would produce an error.  This PR allows this case.

As a side-effect of the change, several self-type casts in existing
tests go away.  For example:

    0:10          Construct float ( temp float)
    0:10            'f' ( in float)

becomes this (without the unneeded constructor op):

    0:10          'f' ( in float)

For vector or array types this can result in somewhat less overall code.

Fixes: #1218
2018-05-17 13:03:12 -06:00

26 lines
310 B
GLSL

struct Test0 {};
struct Test1 { float f; };
void main()
{
{
Test0 a;
Test0 b = (Test0)a;
}
{
Test1 a;
Test1 b = (Test1)a;
}
{
Test0 a[2];
Test0 b[2] = (Test0[2])a;
}
{
Test1 a[2];
Test1 b[2] = (Test1[2])a;
}
}