30 lines
556 B
Plaintext
30 lines
556 B
Plaintext
#version 310 es
|
|
#extension GL_EXT_shader_non_constant_global_initializers : require
|
|
layout(local_size_x = 2) in;
|
|
|
|
struct Data
|
|
{
|
|
float a;
|
|
float b;
|
|
};
|
|
|
|
layout(std430, binding = 0) buffer SSBO
|
|
{
|
|
Data outdata[];
|
|
};
|
|
|
|
layout(constant_id = 0) const float X = 4.0;
|
|
|
|
Data data[2] = Data[](Data(1.0, 2.0), Data(3.0, 4.0));
|
|
Data data2[2] = Data[](Data(X, 2.0), Data(3.0, 5.0));
|
|
|
|
Data combine(Data a, Data b)
|
|
{
|
|
return Data(a.a + b.a, a.b + b.b);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
outdata[gl_WorkGroupID.x] = combine(data[gl_LocalInvocationID.x], data2[gl_LocalInvocationID.x]);
|
|
}
|