SPIRV-Cross/reference/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag
Hans-Kristian Arntzen 96492648d4 MSL: Fix struct declaration order with complex type aliases.
MSL generally emits the aliases, which means we cannot always place the
master type first, unlike GLSL and HLSL. The logic fix is just to
reorder after we have tagged types with packing information, rather than
doing it in the parser fixup.
2019-05-23 14:54:04 +02:00

49 lines
833 B
GLSL

#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Foo
{
float3 a;
float b;
};
struct Foo_1
{
packed_float3 a;
float b;
};
struct buf
{
Foo_1 results[16];
float4 bar;
};
struct main0_out
{
float4 _entryPointOutput [[color(0)]];
};
float4 _main(thread const float4& pos, constant buf& v_11)
{
int _46 = int(pos.x) % 16;
Foo foo;
foo.a = float3(v_11.results[_46].a);
foo.b = v_11.results[_46].b;
return float4(dot(foo.a, v_11.bar.xyz), foo.b, 0.0, 0.0);
}
fragment main0_out main0(constant buf& v_11 [[buffer(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
float4 pos = gl_FragCoord;
float4 param = pos;
out._entryPointOutput = _main(param, v_11);
return out;
}