SPIRV-Cross/reference/shaders-msl-no-opt/asm/packing/scalar-array-float3.asm.frag
Hans-Kristian Arntzen 17ad62eea4 MSL: Support edge case with DX layout in scalar block layout.
DX may emit ArrayStride and MatrixStride of 16, but the size of the
object does not align with that and expect to pack other members inside
its last member.

The workaround is to emit array size/col/row one less than we expect and
rely on padding to carve out a "dead zone" for the last member.
2020-04-20 15:29:24 +02:00

25 lines
395 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct type_Foo
{
float4 a[1];
char _m1_pad[12];
float b;
};
struct main0_out
{
float3 out_var_SV_Target [[color(0)]];
};
fragment main0_out main0(constant type_Foo& Foo [[buffer(0)]])
{
main0_out out = {};
out.out_var_SV_Target = (Foo.a[0].xyz + Foo.a[1].xyz) + float3(Foo.b);
return out;
}