1#version 310 es 2#extension GL_EXT_shader_non_constant_global_initializers : require 3layout(local_size_x = 2) in; 4 5struct Data 6{ 7 float a; 8 float b; 9}; 10 11layout(std430, binding = 0) buffer SSBO 12{ 13 Data outdata[]; 14}; 15 16layout(constant_id = 0) const float X = 4.0; 17 18Data data[2] = Data[](Data(1.0, 2.0), Data(3.0, 4.0)); 19Data data2[2] = Data[](Data(X, 2.0), Data(3.0, 5.0)); 20 21Data combine(Data a, Data b) 22{ 23 return Data(a.a + b.a, a.b + b.b); 24} 25 26void main() 27{ 28 outdata[gl_WorkGroupID.x] = combine(data[gl_LocalInvocationID.x], data2[gl_LocalInvocationID.x]); 29} 30