diff --git a/reference/shaders-msl-no-opt/packing/std140-array-of-vectors.comp b/reference/shaders-msl-no-opt/packing/std140-array-of-vectors.comp new file mode 100644 index 00000000..77da52fe --- /dev/null +++ b/reference/shaders-msl-no-opt/packing/std140-array-of-vectors.comp @@ -0,0 +1,40 @@ +#include +#include + +using namespace metal; + +struct SSBO +{ + float4 v1[4]; + float4 v2[4]; + float3 v3[4]; + float4 v4[4]; + float4 v1_array_of_array[4][4]; + float4 v2_array_of_array[4][4]; + float3 v3_array_of_array[4][4]; + float4 v4_array_of_array[4][4]; + float4 v_unsized[1]; +}; + +kernel void main0(device SSBO& _29 [[buffer(0)]]) +{ + float loaded1 = _29.v1[1].x; + _29.v1[2].x = loaded1; + float2 loaded2 = _29.v2[1].xy; + _29.v2[2].xy = loaded2; + float3 loaded3 = _29.v3[1]; + _29.v3[2] = loaded3; + float4 loaded4 = _29.v4[1]; + _29.v4[2] = loaded4; + loaded1 = _29.v1_array_of_array[1][2].x; + _29.v1_array_of_array[2][3].x = loaded1; + loaded2 = _29.v2_array_of_array[1][2].xy; + _29.v2_array_of_array[2][3].xy = loaded2; + loaded3 = _29.v3_array_of_array[1][2]; + _29.v3_array_of_array[2][3] = loaded3; + loaded4 = _29.v4_array_of_array[1][2]; + _29.v4_array_of_array[2][3] = loaded4; + loaded1 = _29.v_unsized[1].x; + _29.v_unsized[2].x = loaded1; +} + diff --git a/shaders-msl-no-opt/packing/std140-array-of-vectors.comp b/shaders-msl-no-opt/packing/std140-array-of-vectors.comp new file mode 100644 index 00000000..260a4981 --- /dev/null +++ b/shaders-msl-no-opt/packing/std140-array-of-vectors.comp @@ -0,0 +1,47 @@ +#version 450 +layout(local_size_x = 1) in; + +layout(std140, set = 0, binding = 0) buffer SSBO +{ + float v1[4]; + vec2 v2[4]; + vec3 v3[4]; + vec4 v4[4]; + + float v1_array_of_array[4][4]; + vec2 v2_array_of_array[4][4]; + vec3 v3_array_of_array[4][4]; + vec4 v4_array_of_array[4][4]; + + float v_unsized[]; +}; + +void main() +{ + float loaded1 = v1[1]; + v1[2] = loaded1; + + vec2 loaded2 = v2[1]; + v2[2] = loaded2; + + vec3 loaded3 = v3[1]; + v3[2] = loaded3; + + vec4 loaded4 = v4[1]; + v4[2] = loaded4; + + loaded1 = v1_array_of_array[1][2]; + v1_array_of_array[2][3] = loaded1; + + loaded2 = v2_array_of_array[1][2]; + v2_array_of_array[2][3] = loaded2; + + loaded3 = v3_array_of_array[1][2]; + v3_array_of_array[2][3] = loaded3; + + loaded4 = v4_array_of_array[1][2]; + v4_array_of_array[2][3] = loaded4; + + loaded1 = v_unsized[1]; + v_unsized[2] = loaded1; +}