Test array of std140 vectors.
This commit is contained in:
parent
6224199c76
commit
d584d833fa
@ -0,0 +1,40 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
47
shaders-msl-no-opt/packing/std140-array-of-vectors.comp
Normal file
47
shaders-msl-no-opt/packing/std140-array-of-vectors.comp
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user