glslang/Test/spv.subgroupRotate.comp
Sven van Haastregt b1f7affe94 Add GL_KHR_shader_subgroup_rotate support
Co-authored-by: Neil Hickey <neil.hickey@arm.com>
Co-authored-by: Stuart Brady <stuart.brady@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
2024-02-06 11:04:16 -08:00

74 lines
3.3 KiB
Plaintext

#version 450
#extension GL_KHR_shader_subgroup_rotate: enable
layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
readonly buffer roblock
{
uint delta;
} ro;
layout(binding = 0) buffer Buffers
{
vec4 f4;
ivec4 i4;
uvec4 u4;
dvec4 d4;
} data[4];
void main()
{
uint delta = ro.delta;
data[delta].f4.x = subgroupRotate(data[0].f4.x, delta);
data[delta].f4.xy = subgroupRotate(data[1].f4.xy, delta);
data[delta].f4.xyz = subgroupRotate(data[2].f4.xyz, delta);
data[delta].f4 = subgroupRotate(data[3].f4, delta);
data[delta].i4.x = subgroupRotate(data[0].i4.x, delta);
data[delta].i4.xy = subgroupRotate(data[1].i4.xy, delta);
data[delta].i4.xyz = subgroupRotate(data[2].i4.xyz, delta);
data[delta].i4 = subgroupRotate(data[3].i4, delta);
data[delta].u4.x = subgroupRotate(data[0].u4.x, delta);
data[delta].u4.xy = subgroupRotate(data[1].u4.xy, delta);
data[delta].u4.xyz = subgroupRotate(data[2].u4.xyz, delta);
data[delta].u4 = subgroupRotate(data[3].u4, delta);
data[delta].d4.x = subgroupRotate(data[0].d4.x, delta);
data[delta].d4.xy = subgroupRotate(data[1].d4.xy, delta);
data[delta].d4.xyz = subgroupRotate(data[2].d4.xyz, delta);
data[delta].d4 = subgroupRotate(data[3].d4, delta);
data[delta].i4.x = int(subgroupRotate(data[0].i4.x < 0, delta));
data[delta].i4.xy = ivec2(subgroupRotate(lessThan(data[1].i4.xy, ivec2(0)), delta));
data[delta].i4.xyz = ivec3(subgroupRotate(lessThan(data[1].i4.xyz, ivec3(0)), delta));
data[delta].i4 = ivec4(subgroupRotate(lessThan(data[1].i4, ivec4(0)), delta));
data[delta].f4.x = subgroupClusteredRotate(data[0].f4.x, delta, 1);
data[delta].f4.xy = subgroupClusteredRotate(data[1].f4.xy, delta, 1);
data[delta].f4.xyz = subgroupClusteredRotate(data[2].f4.xyz, delta, 1);
data[delta].f4 = subgroupClusteredRotate(data[3].f4, delta, 1);
data[delta].i4.x = subgroupClusteredRotate(data[0].i4.x, delta, 1);
data[delta].i4.xy = subgroupClusteredRotate(data[1].i4.xy, delta, 1);
data[delta].i4.xyz = subgroupClusteredRotate(data[2].i4.xyz, delta, 1);
data[delta].i4 = subgroupClusteredRotate(data[3].i4, delta, 1);
data[delta].u4.x = subgroupClusteredRotate(data[0].u4.x, delta, 1);
data[delta].u4.xy = subgroupClusteredRotate(data[1].u4.xy, delta, 1);
data[delta].u4.xyz = subgroupClusteredRotate(data[2].u4.xyz, delta, 1);
data[delta].u4 = subgroupClusteredRotate(data[3].u4, delta, 1);
data[delta].d4.x = subgroupClusteredRotate(data[0].d4.x, delta, 1);
data[delta].d4.xy = subgroupClusteredRotate(data[1].d4.xy, delta, 1);
data[delta].d4.xyz = subgroupClusteredRotate(data[2].d4.xyz, delta, 1);
data[delta].d4 = subgroupClusteredRotate(data[3].d4, delta, 1);
data[delta].i4.x = int(subgroupClusteredRotate(data[0].i4.x < 0, delta, 1));
data[delta].i4.xy = ivec2(subgroupClusteredRotate(lessThan(data[1].i4.xy, ivec2(0)), delta, 1));
data[delta].i4.xyz = ivec3(subgroupClusteredRotate(lessThan(data[1].i4.xyz, ivec3(0)), delta, 1));
data[delta].i4 = ivec4(subgroupClusteredRotate(lessThan(data[1].i4, ivec4(0)), delta, 1));
}