diff options
author | Bill Hollings <bill.hollings@brenwill.com> | 2021-10-29 02:36:32 +0300 |
---|---|---|
committer | Bill Hollings <bill.hollings@brenwill.com> | 2021-10-29 02:36:32 +0300 |
commit | be812c45e52b2ac6cf8b6cf2ec6e32c5f30c6ce6 (patch) | |
tree | ee9dac2e8ed86b974909d494d48b9aee13ff035f /reference/opt/shaders-msl | |
parent | 66adba17a87518a60c3eaab23eaabef847380e0b (diff) |
MSL: Remove over-zealous check for struct packing compatibility.
Previous test for SPIRVCrossDecorationPhysicalTypePacked on parent struct
when unpacking member struct was too restrictive, and not needed as long
as padding compensates.
Diffstat (limited to 'reference/opt/shaders-msl')
-rw-r--r-- | reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert b/reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert new file mode 100644 index 00000000..c3056232 --- /dev/null +++ b/reference/opt/shaders-msl/vert/uniform-struct-packing-nested.vert @@ -0,0 +1,52 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +typedef packed_float4 packed_rm_float4x4[4]; + +struct s0 +{ + float3x4 m0; + packed_int4 m1; + packed_rm_float4x4 m2; + packed_uint2 m3; +}; + +struct s1 +{ + float4x4 m0; + int m1; + char _m2_pad[12]; + packed_uint3 m2; + s0 m3; +}; + +struct data_u_t +{ + float4 m1[5]; + float2x4 m3; + int4 m4; + s1 m2; + float3x4 m0; +}; + +struct main0_out +{ + float foo [[user(locn0)]]; + float4 gl_Position [[position]]; +}; + +struct main0_in +{ + float4 vtx_posn [[attribute(0)]]; +}; + +vertex main0_out main0(main0_in in [[stage_in]], constant data_u_t& data_u [[buffer(0)]]) +{ + main0_out out = {}; + out.gl_Position = in.vtx_posn; + out.foo = (((data_u.m1[3].y + float(data_u.m4.z)) * data_u.m0[2][1]) * data_u.m2.m0[3][2]) * data_u.m2.m3.m2[3][3]; + return out; +} + |