1#version 450 2 3#extension GL_KHR_shader_subgroup_vote: enable 4 5layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; 6 7layout(binding = 0) buffer Buffers 8{ 9 vec4 f4; 10 ivec4 i4; 11 uvec4 u4; 12 dvec4 d4; 13 int r; 14} data[4]; 15 16void main() 17{ 18 uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; 19 20 if (subgroupAll(data[invocation].r < 0)) 21 { 22 data[invocation].r = int(subgroupAllEqual(data[0].f4.x)); 23 data[invocation].r = int(subgroupAllEqual(data[1].f4.xy)); 24 data[invocation].r = int(subgroupAllEqual(data[2].f4.xyz)); 25 data[invocation].r = int(subgroupAllEqual(data[3].f4)); 26 27 data[invocation].r = int(subgroupAllEqual(data[0].i4.x)); 28 data[invocation].r = int(subgroupAllEqual(data[1].i4.xy)); 29 data[invocation].r = int(subgroupAllEqual(data[2].i4.xyz)); 30 data[invocation].r = int(subgroupAllEqual(data[3].i4)); 31 32 data[invocation].r = int(subgroupAllEqual(data[0].u4.x)); 33 data[invocation].r = int(subgroupAllEqual(data[1].u4.xy)); 34 data[invocation].r = int(subgroupAllEqual(data[2].u4.xyz)); 35 data[invocation].r = int(subgroupAllEqual(data[3].u4)); 36 } 37 else if (subgroupAny(data[invocation].r < 0)) 38 { 39 data[invocation].r = int(subgroupAllEqual(data[0].d4.x)); 40 data[invocation].r = int(subgroupAllEqual(data[1].d4.xy)); 41 data[invocation].r = int(subgroupAllEqual(data[2].d4.xyz)); 42 data[invocation].r = int(subgroupAllEqual(data[3].d4)); 43 44 data[invocation].r = int(int(subgroupAllEqual(data[0].i4.x < 0))); 45 data[invocation].r = int(ivec2(subgroupAllEqual(lessThan(data[1].i4.xy, ivec2(0))))); 46 data[invocation].r = int(ivec3(subgroupAllEqual(lessThan(data[1].i4.xyz, ivec3(0))))); 47 data[invocation].r = int(ivec4(subgroupAllEqual(lessThan(data[1].i4, ivec4(0))))); 48 } 49} 50