1#version 450 2 3#extension GL_KHR_shader_subgroup_shuffle: enable 4#extension GL_EXT_shader_explicit_arithmetic_types_int8: enable 5#extension GL_EXT_shader_explicit_arithmetic_types_int16: enable 6#extension GL_EXT_shader_explicit_arithmetic_types_int64: enable 7#extension GL_EXT_shader_explicit_arithmetic_types_float16: enable 8 9layout (local_size_x = 8) in; 10 11layout(binding = 0) buffer Buffers 12{ 13 i8vec4 i8; 14 u8vec4 u8; 15 i16vec4 i16; 16 u16vec4 u16; 17 i64vec4 i64; 18 u64vec4 u64; 19 f16vec4 f16; 20} data[4]; 21 22void main() 23{ 24 uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; 25 26 data[invocation].i8.x = subgroupShuffle(data[0].i8.x, invocation); 27 data[invocation].i8.xy = subgroupShuffle(data[1].i8.xy, invocation); 28 data[invocation].i8.xyz = subgroupShuffle(data[2].i8.xyz, invocation); 29 data[invocation].i8 = subgroupShuffle(data[3].i8, invocation); 30 31 data[invocation].i8.x = subgroupShuffleXor(data[0].i8.x, invocation); 32 data[invocation].i8.xy = subgroupShuffleXor(data[1].i8.xy, invocation); 33 data[invocation].i8.xyz = subgroupShuffleXor(data[2].i8.xyz, invocation); 34 data[invocation].i8 = subgroupShuffleXor(data[3].i8, invocation); 35 36 data[invocation].u8.x = subgroupShuffle(data[0].u8.x, invocation); 37 data[invocation].u8.xy = subgroupShuffle(data[1].u8.xy, invocation); 38 data[invocation].u8.xyz = subgroupShuffle(data[2].u8.xyz, invocation); 39 data[invocation].u8 = subgroupShuffle(data[3].u8, invocation); 40 41 data[invocation].u8.x = subgroupShuffleXor(data[0].u8.x, invocation); 42 data[invocation].u8.xy = subgroupShuffleXor(data[1].u8.xy, invocation); 43 data[invocation].u8.xyz = subgroupShuffleXor(data[2].u8.xyz, invocation); 44 data[invocation].u8 = subgroupShuffleXor(data[3].u8, invocation); 45 46 data[invocation].i16.x = subgroupShuffle(data[0].i16.x, invocation); 47 data[invocation].i16.xy = subgroupShuffle(data[1].i16.xy, invocation); 48 data[invocation].i16.xyz = subgroupShuffle(data[2].i16.xyz, invocation); 49 data[invocation].i16 = subgroupShuffle(data[3].i16, invocation); 50 51 data[invocation].i16.x = subgroupShuffleXor(data[0].i16.x, invocation); 52 data[invocation].i16.xy = subgroupShuffleXor(data[1].i16.xy, invocation); 53 data[invocation].i16.xyz = subgroupShuffleXor(data[2].i16.xyz, invocation); 54 data[invocation].i16 = subgroupShuffleXor(data[3].i16, invocation); 55 56 data[invocation].u16.x = subgroupShuffle(data[0].u16.x, invocation); 57 data[invocation].u16.xy = subgroupShuffle(data[1].u16.xy, invocation); 58 data[invocation].u16.xyz = subgroupShuffle(data[2].u16.xyz, invocation); 59 data[invocation].u16 = subgroupShuffle(data[3].u16, invocation); 60 61 data[invocation].u16.x = subgroupShuffleXor(data[0].u16.x, invocation); 62 data[invocation].u16.xy = subgroupShuffleXor(data[1].u16.xy, invocation); 63 data[invocation].u16.xyz = subgroupShuffleXor(data[2].u16.xyz, invocation); 64 data[invocation].u16 = subgroupShuffleXor(data[3].u16, invocation); 65 66 data[invocation].i64.x = subgroupShuffle(data[0].i64.x, invocation); 67 data[invocation].i64.xy = subgroupShuffle(data[1].i64.xy, invocation); 68 data[invocation].i64.xyz = subgroupShuffle(data[2].i64.xyz, invocation); 69 data[invocation].i64 = subgroupShuffle(data[3].i64, invocation); 70 71 data[invocation].i64.x = subgroupShuffleXor(data[0].i64.x, invocation); 72 data[invocation].i64.xy = subgroupShuffleXor(data[1].i64.xy, invocation); 73 data[invocation].i64.xyz = subgroupShuffleXor(data[2].i64.xyz, invocation); 74 data[invocation].i64 = subgroupShuffleXor(data[3].i64, invocation); 75 76 data[invocation].u64.x = subgroupShuffle(data[0].u64.x, invocation); 77 data[invocation].u64.xy = subgroupShuffle(data[1].u64.xy, invocation); 78 data[invocation].u64.xyz = subgroupShuffle(data[2].u64.xyz, invocation); 79 data[invocation].u64 = subgroupShuffle(data[3].u64, invocation); 80 81 data[invocation].u64.x = subgroupShuffleXor(data[0].u64.x, invocation); 82 data[invocation].u64.xy = subgroupShuffleXor(data[1].u64.xy, invocation); 83 data[invocation].u64.xyz = subgroupShuffleXor(data[2].u64.xyz, invocation); 84 data[invocation].u64 = subgroupShuffleXor(data[3].u64, invocation); 85 86 data[invocation].f16.x = subgroupShuffle(data[0].f16.x, invocation); 87 data[invocation].f16.xy = subgroupShuffle(data[1].f16.xy, invocation); 88 data[invocation].f16.xyz = subgroupShuffle(data[2].f16.xyz, invocation); 89 data[invocation].f16 = subgroupShuffle(data[3].f16, invocation); 90 91 data[invocation].f16.x = subgroupShuffleXor(data[0].f16.x, invocation); 92 data[invocation].f16.xy = subgroupShuffleXor(data[1].f16.xy, invocation); 93 data[invocation].f16.xyz = subgroupShuffleXor(data[2].f16.xyz, invocation); 94 data[invocation].f16 = subgroupShuffleXor(data[3].f16, invocation); 95} 96