Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hollings <bill.hollings@brenwill.com>2021-10-28 17:16:34 +0300
committerBill Hollings <bill.hollings@brenwill.com>2021-10-28 17:16:34 +0300
commit76cb807c19c6de70b916943a8b6362a3ad3f971b (patch)
treedb3827e55a5c43cb55d5ca72fc7838e8e18d14cf /reference/opt/shaders-msl
parent29632959d21a0b3e128c174a49de159dd2b107d1 (diff)
MSL: Fix type redirection when struct members are reordered to align with offsets.
Populate member_type_index_redirection as reverse lookup, not forward lookup. Move use of member_type_index_redirection from CompilerMSL::to_member_reference() to CompilerGLSL::access_chain_internal() to access all redirected type info, not just name.
Diffstat (limited to 'reference/opt/shaders-msl')
-rw-r--r--reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert32
1 files changed, 32 insertions, 0 deletions
diff --git a/reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert b/reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert
new file mode 100644
index 00000000..c69775e3
--- /dev/null
+++ b/reference/opt/shaders-msl/vert/uniform-struct-out-of-order-offests.vert
@@ -0,0 +1,32 @@
+#include <metal_stdlib>
+#include <simd/simd.h>
+
+using namespace metal;
+
+struct data_u_t
+{
+ int4 m1[3];
+ uint m3;
+ uint3 m2;
+ int4 m0[8];
+};
+
+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 = float((uint3(data_u.m1[1].xyz) + data_u.m2).y * uint(data_u.m0[4].x));
+ return out;
+}
+