#version 450 | |
#extension GL_KHR_shader_subgroup_shuffle_relative: enable | |
#extension GL_EXT_shader_explicit_arithmetic_types_int8: enable | |
#extension GL_EXT_shader_explicit_arithmetic_types_int16: enable | |
#extension GL_EXT_shader_explicit_arithmetic_types_int64: enable | |
#extension GL_EXT_shader_explicit_arithmetic_types_float16: enable | |
layout (local_size_x = 8) in; | |
layout(binding = 0) buffer Buffers | |
{ | |
i8vec4 i8; | |
u8vec4 u8; | |
i16vec4 i16; | |
u16vec4 u16; | |
i64vec4 i64; | |
u64vec4 u64; | |
f16vec4 f16; | |
} data[4]; | |
void main() | |
{ | |
uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4; | |
data[invocation].i8.x = subgroupShuffleUp(data[0].i8.x, invocation); | |
data[invocation].i8.xy = subgroupShuffleUp(data[1].i8.xy, invocation); | |
data[invocation].i8.xyz = subgroupShuffleUp(data[2].i8.xyz, invocation); | |
data[invocation].i8 = subgroupShuffleUp(data[3].i8, invocation); | |
data[invocation].i8.x = subgroupShuffleDown(data[0].i8.x, invocation); | |
data[invocation].i8.xy = subgroupShuffleDown(data[1].i8.xy, invocation); | |
data[invocation].i8.xyz = subgroupShuffleDown(data[2].i8.xyz, invocation); | |
data[invocation].i8 = subgroupShuffleDown(data[3].i8, invocation); | |
data[invocation].u8.x = subgroupShuffleUp(data[0].u8.x, invocation); | |
data[invocation].u8.xy = subgroupShuffleUp(data[1].u8.xy, invocation); | |
data[invocation].u8.xyz = subgroupShuffleUp(data[2].u8.xyz, invocation); | |
data[invocation].u8 = subgroupShuffleUp(data[3].u8, invocation); | |
data[invocation].u8.x = subgroupShuffleDown(data[0].u8.x, invocation); | |
data[invocation].u8.xy = subgroupShuffleDown(data[1].u8.xy, invocation); | |
data[invocation].u8.xyz = subgroupShuffleDown(data[2].u8.xyz, invocation); | |
data[invocation].u8 = subgroupShuffleDown(data[3].u8, invocation); | |
data[invocation].i16.x = subgroupShuffleUp(data[0].i16.x, invocation); | |
data[invocation].i16.xy = subgroupShuffleUp(data[1].i16.xy, invocation); | |
data[invocation].i16.xyz = subgroupShuffleUp(data[2].i16.xyz, invocation); | |
data[invocation].i16 = subgroupShuffleUp(data[3].i16, invocation); | |
data[invocation].i16.x = subgroupShuffleDown(data[0].i16.x, invocation); | |
data[invocation].i16.xy = subgroupShuffleDown(data[1].i16.xy, invocation); | |
data[invocation].i16.xyz = subgroupShuffleDown(data[2].i16.xyz, invocation); | |
data[invocation].i16 = subgroupShuffleDown(data[3].i16, invocation); | |
data[invocation].u16.x = subgroupShuffleUp(data[0].u16.x, invocation); | |
data[invocation].u16.xy = subgroupShuffleUp(data[1].u16.xy, invocation); | |
data[invocation].u16.xyz = subgroupShuffleUp(data[2].u16.xyz, invocation); | |
data[invocation].u16 = subgroupShuffleUp(data[3].u16, invocation); | |
data[invocation].u16.x = subgroupShuffleDown(data[0].u16.x, invocation); | |
data[invocation].u16.xy = subgroupShuffleDown(data[1].u16.xy, invocation); | |
data[invocation].u16.xyz = subgroupShuffleDown(data[2].u16.xyz, invocation); | |
data[invocation].u16 = subgroupShuffleDown(data[3].u16, invocation); | |
data[invocation].i64.x = subgroupShuffleUp(data[0].i64.x, invocation); | |
data[invocation].i64.xy = subgroupShuffleUp(data[1].i64.xy, invocation); | |
data[invocation].i64.xyz = subgroupShuffleUp(data[2].i64.xyz, invocation); | |
data[invocation].i64 = subgroupShuffleUp(data[3].i64, invocation); | |
data[invocation].i64.x = subgroupShuffleDown(data[0].i64.x, invocation); | |
data[invocation].i64.xy = subgroupShuffleDown(data[1].i64.xy, invocation); | |
data[invocation].i64.xyz = subgroupShuffleDown(data[2].i64.xyz, invocation); | |
data[invocation].i64 = subgroupShuffleDown(data[3].i64, invocation); | |
data[invocation].u64.x = subgroupShuffleUp(data[0].u64.x, invocation); | |
data[invocation].u64.xy = subgroupShuffleUp(data[1].u64.xy, invocation); | |
data[invocation].u64.xyz = subgroupShuffleUp(data[2].u64.xyz, invocation); | |
data[invocation].u64 = subgroupShuffleUp(data[3].u64, invocation); | |
data[invocation].u64.x = subgroupShuffleDown(data[0].u64.x, invocation); | |
data[invocation].u64.xy = subgroupShuffleDown(data[1].u64.xy, invocation); | |
data[invocation].u64.xyz = subgroupShuffleDown(data[2].u64.xyz, invocation); | |
data[invocation].u64 = subgroupShuffleDown(data[3].u64, invocation); | |
data[invocation].f16.x = subgroupShuffleUp(data[0].f16.x, invocation); | |
data[invocation].f16.xy = subgroupShuffleUp(data[1].f16.xy, invocation); | |
data[invocation].f16.xyz = subgroupShuffleUp(data[2].f16.xyz, invocation); | |
data[invocation].f16 = subgroupShuffleUp(data[3].f16, invocation); | |
data[invocation].f16.x = subgroupShuffleDown(data[0].f16.x, invocation); | |
data[invocation].f16.xy = subgroupShuffleDown(data[1].f16.xy, invocation); | |
data[invocation].f16.xyz = subgroupShuffleDown(data[2].f16.xyz, invocation); | |
data[invocation].f16 = subgroupShuffleDown(data[3].f16, invocation); | |
} |