SPIRV-Cross/shaders-msl/comp/shared-array-of-arrays.comp
2018-01-29 10:57:52 +01:00

30 lines
529 B
Plaintext

#version 310 es
layout(local_size_x = 4, local_size_y = 4) in;
shared float foo[4][4];
layout(binding = 0, std430) buffer SSBO
{
float out_data[];
};
void work()
{
foo[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = float(gl_LocalInvocationIndex);
memoryBarrierShared();
barrier();
float x = 0.0;
x += foo[gl_LocalInvocationID.x][0];
x += foo[gl_LocalInvocationID.x][1];
x += foo[gl_LocalInvocationID.x][2];
x += foo[gl_LocalInvocationID.x][3];
out_data[gl_GlobalInvocationID.x] = x;
}
void main()
{
work();
}