SPIRV-Cross/reference/opt/shaders-msl/asm/frag/extract-packed-from-composite.asm.frag
Hans-Kristian Arntzen d1479f871a MSL: Do not generate UnsafeArray<> for any array inside buffer objects.
This avoids a lot of huge code changes.
Arrays generally cannot be copied in and out of buffers, at least no
compiler frontend seems to do it.

Also avoids a lot of issues surrounding packed vectors and matrices.
2019-10-24 12:22:30 +02:00

31 lines
532 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Foo
{
packed_float3 a;
float b;
};
struct buf
{
Foo results[16];
float4 bar;
};
struct main0_out
{
float4 _entryPointOutput [[color(0)]];
};
fragment main0_out main0(constant buf& _11 [[buffer(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
int _67 = int(gl_FragCoord.x) % 16;
out._entryPointOutput = float4(dot(float3(_11.results[_67].a), _11.bar.xyz), _11.results[_67].b, 0.0, 0.0);
return out;
}