SPIRV-Cross/reference/shaders-hlsl/comp/access-chain-load-composite.comp

165 lines
5.4 KiB
Plaintext
Raw Normal View History

struct Baz
{
float c;
};
struct Bar
{
float d[2][4];
Baz baz[2];
};
struct Foo
{
column_major float2x2 a;
float2 b;
Bar c[5];
};
static const uint3 gl_WorkGroupSize = uint3(1u, 1u, 1u);
RWByteAddressBuffer _31 : register(u0);
void comp_main()
{
Foo _36;
_36.a = asfloat(uint2x2(_31.Load(0), _31.Load(8), _31.Load(4), _31.Load(12)));
_36.b = asfloat(_31.Load2(16));
[unroll]
for (int _4ident = 0; _4ident < 5; _4ident++)
{
[unroll]
for (int _5ident = 0; _5ident < 2; _5ident++)
{
[unroll]
for (int _6ident = 0; _6ident < 4; _6ident++)
{
_36.c[_4ident].d[_5ident][_6ident] = asfloat(_31.Load(_6ident * 4 + _5ident * 16 + _4ident * 40 + 24));
}
}
[unroll]
for (int _7ident = 0; _7ident < 2; _7ident++)
{
_36.c[_4ident].baz[_7ident].c = asfloat(_31.Load(_7ident * 4 + _4ident * 40 + 56));
}
}
Foo f;
f.a = _36.a;
f.b = _36.b;
f.c[0].d[0][0] = _36.c[0].d[0][0];
f.c[0].d[0][1] = _36.c[0].d[0][1];
f.c[0].d[0][2] = _36.c[0].d[0][2];
f.c[0].d[0][3] = _36.c[0].d[0][3];
f.c[0].d[1][0] = _36.c[0].d[1][0];
f.c[0].d[1][1] = _36.c[0].d[1][1];
f.c[0].d[1][2] = _36.c[0].d[1][2];
f.c[0].d[1][3] = _36.c[0].d[1][3];
f.c[0].baz[0].c = _36.c[0].baz[0].c;
f.c[0].baz[1].c = _36.c[0].baz[1].c;
f.c[1].d[0][0] = _36.c[1].d[0][0];
f.c[1].d[0][1] = _36.c[1].d[0][1];
f.c[1].d[0][2] = _36.c[1].d[0][2];
f.c[1].d[0][3] = _36.c[1].d[0][3];
f.c[1].d[1][0] = _36.c[1].d[1][0];
f.c[1].d[1][1] = _36.c[1].d[1][1];
f.c[1].d[1][2] = _36.c[1].d[1][2];
f.c[1].d[1][3] = _36.c[1].d[1][3];
f.c[1].baz[0].c = _36.c[1].baz[0].c;
f.c[1].baz[1].c = _36.c[1].baz[1].c;
f.c[2].d[0][0] = _36.c[2].d[0][0];
f.c[2].d[0][1] = _36.c[2].d[0][1];
f.c[2].d[0][2] = _36.c[2].d[0][2];
f.c[2].d[0][3] = _36.c[2].d[0][3];
f.c[2].d[1][0] = _36.c[2].d[1][0];
f.c[2].d[1][1] = _36.c[2].d[1][1];
f.c[2].d[1][2] = _36.c[2].d[1][2];
f.c[2].d[1][3] = _36.c[2].d[1][3];
f.c[2].baz[0].c = _36.c[2].baz[0].c;
f.c[2].baz[1].c = _36.c[2].baz[1].c;
f.c[3].d[0][0] = _36.c[3].d[0][0];
f.c[3].d[0][1] = _36.c[3].d[0][1];
f.c[3].d[0][2] = _36.c[3].d[0][2];
f.c[3].d[0][3] = _36.c[3].d[0][3];
f.c[3].d[1][0] = _36.c[3].d[1][0];
f.c[3].d[1][1] = _36.c[3].d[1][1];
f.c[3].d[1][2] = _36.c[3].d[1][2];
f.c[3].d[1][3] = _36.c[3].d[1][3];
f.c[3].baz[0].c = _36.c[3].baz[0].c;
f.c[3].baz[1].c = _36.c[3].baz[1].c;
f.c[4].d[0][0] = _36.c[4].d[0][0];
f.c[4].d[0][1] = _36.c[4].d[0][1];
f.c[4].d[0][2] = _36.c[4].d[0][2];
f.c[4].d[0][3] = _36.c[4].d[0][3];
f.c[4].d[1][0] = _36.c[4].d[1][0];
f.c[4].d[1][1] = _36.c[4].d[1][1];
f.c[4].d[1][2] = _36.c[4].d[1][2];
f.c[4].d[1][3] = _36.c[4].d[1][3];
f.c[4].baz[0].c = _36.c[4].baz[0].c;
f.c[4].baz[1].c = _36.c[4].baz[1].c;
float2 _229 = 1.0f.xx;
f.a = float2x2(f.a[0] + _229, f.a[1] + _229);
f.b += 2.0f.xx;
f.c[3].d[1][1] += 5.0f;
_31.Store(224, asuint(f.a[0].x));
_31.Store(228, asuint(f.a[1].x));
_31.Store(232, asuint(f.a[0].y));
_31.Store(236, asuint(f.a[1].y));
_31.Store2(240, asuint(f.b));
_31.Store(248, asuint(f.c[0].d[0][0]));
_31.Store(252, asuint(f.c[0].d[0][1]));
_31.Store(256, asuint(f.c[0].d[0][2]));
_31.Store(260, asuint(f.c[0].d[0][3]));
_31.Store(264, asuint(f.c[0].d[1][0]));
_31.Store(268, asuint(f.c[0].d[1][1]));
_31.Store(272, asuint(f.c[0].d[1][2]));
_31.Store(276, asuint(f.c[0].d[1][3]));
_31.Store(280, asuint(f.c[0].baz[0].c));
_31.Store(284, asuint(f.c[0].baz[1].c));
_31.Store(288, asuint(f.c[1].d[0][0]));
_31.Store(292, asuint(f.c[1].d[0][1]));
_31.Store(296, asuint(f.c[1].d[0][2]));
_31.Store(300, asuint(f.c[1].d[0][3]));
_31.Store(304, asuint(f.c[1].d[1][0]));
_31.Store(308, asuint(f.c[1].d[1][1]));
_31.Store(312, asuint(f.c[1].d[1][2]));
_31.Store(316, asuint(f.c[1].d[1][3]));
_31.Store(320, asuint(f.c[1].baz[0].c));
_31.Store(324, asuint(f.c[1].baz[1].c));
_31.Store(328, asuint(f.c[2].d[0][0]));
_31.Store(332, asuint(f.c[2].d[0][1]));
_31.Store(336, asuint(f.c[2].d[0][2]));
_31.Store(340, asuint(f.c[2].d[0][3]));
_31.Store(344, asuint(f.c[2].d[1][0]));
_31.Store(348, asuint(f.c[2].d[1][1]));
_31.Store(352, asuint(f.c[2].d[1][2]));
_31.Store(356, asuint(f.c[2].d[1][3]));
_31.Store(360, asuint(f.c[2].baz[0].c));
_31.Store(364, asuint(f.c[2].baz[1].c));
_31.Store(368, asuint(f.c[3].d[0][0]));
_31.Store(372, asuint(f.c[3].d[0][1]));
_31.Store(376, asuint(f.c[3].d[0][2]));
_31.Store(380, asuint(f.c[3].d[0][3]));
_31.Store(384, asuint(f.c[3].d[1][0]));
_31.Store(388, asuint(f.c[3].d[1][1]));
_31.Store(392, asuint(f.c[3].d[1][2]));
_31.Store(396, asuint(f.c[3].d[1][3]));
_31.Store(400, asuint(f.c[3].baz[0].c));
_31.Store(404, asuint(f.c[3].baz[1].c));
_31.Store(408, asuint(f.c[4].d[0][0]));
_31.Store(412, asuint(f.c[4].d[0][1]));
_31.Store(416, asuint(f.c[4].d[0][2]));
_31.Store(420, asuint(f.c[4].d[0][3]));
_31.Store(424, asuint(f.c[4].d[1][0]));
_31.Store(428, asuint(f.c[4].d[1][1]));
_31.Store(432, asuint(f.c[4].d[1][2]));
_31.Store(436, asuint(f.c[4].d[1][3]));
_31.Store(440, asuint(f.c[4].baz[0].c));
_31.Store(444, asuint(f.c[4].baz[1].c));
}
[numthreads(1, 1, 1)]
void main()
{
comp_main();
}