Merge pull request #2891 from dneto0/hlsl-namespace
[platform/upstream/glslang.git] / Test / spv.subgroupShuffle.comp
1 #version 450\r
2 \r
3 #extension GL_KHR_shader_subgroup_shuffle: enable\r
4 \r
5 layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;\r
6 \r
7 layout(binding = 0) buffer Buffers\r
8 {\r
9     vec4  f4;\r
10     ivec4 i4;\r
11     uvec4 u4;\r
12     dvec4 d4;\r
13 } data[4];\r
14 \r
15 void main()\r
16 {\r
17     uint invocation = (gl_SubgroupInvocationID + gl_SubgroupSize) % 4;\r
18 \r
19     data[invocation].f4.x   = subgroupShuffle(data[0].f4.x,    invocation);\r
20     data[invocation].f4.xy  = subgroupShuffle(data[1].f4.xy,   invocation);\r
21     data[invocation].f4.xyz = subgroupShuffle(data[2].f4.xyz,  invocation);\r
22     data[invocation].f4     = subgroupShuffle(data[3].f4,      invocation);\r
23 \r
24     data[invocation].i4.x   = subgroupShuffle(data[0].i4.x,    invocation);\r
25     data[invocation].i4.xy  = subgroupShuffle(data[1].i4.xy,   invocation);\r
26     data[invocation].i4.xyz = subgroupShuffle(data[2].i4.xyz,  invocation);\r
27     data[invocation].i4     = subgroupShuffle(data[3].i4,      invocation);\r
28 \r
29     data[invocation].u4.x   = subgroupShuffle(data[0].u4.x,    invocation);\r
30     data[invocation].u4.xy  = subgroupShuffle(data[1].u4.xy,   invocation);\r
31     data[invocation].u4.xyz = subgroupShuffle(data[2].u4.xyz,  invocation);\r
32     data[invocation].u4     = subgroupShuffle(data[3].u4,      invocation);\r
33 \r
34     data[invocation].d4.x   = subgroupShuffle(data[0].d4.x,    invocation);\r
35     data[invocation].d4.xy  = subgroupShuffle(data[1].d4.xy,   invocation);\r
36     data[invocation].d4.xyz = subgroupShuffle(data[2].d4.xyz,  invocation);\r
37     data[invocation].d4     = subgroupShuffle(data[3].d4,      invocation);\r
38 \r
39     data[invocation].i4.x   =   int(subgroupShuffle(data[0].i4.x < 0,                   invocation));\r
40     data[invocation].i4.xy  = ivec2(subgroupShuffle(lessThan(data[1].i4.xy, ivec2(0)),  invocation));\r
41     data[invocation].i4.xyz = ivec3(subgroupShuffle(lessThan(data[1].i4.xyz, ivec3(0)), invocation));\r
42     data[invocation].i4     = ivec4(subgroupShuffle(lessThan(data[1].i4, ivec4(0)),     invocation));\r
43 \r
44     data[invocation].f4.x   = subgroupShuffleXor(data[0].f4.x,    invocation);\r
45     data[invocation].f4.xy  = subgroupShuffleXor(data[1].f4.xy,   invocation);\r
46     data[invocation].f4.xyz = subgroupShuffleXor(data[2].f4.xyz,  invocation);\r
47     data[invocation].f4     = subgroupShuffleXor(data[3].f4,      invocation);\r
48 \r
49     data[invocation].i4.x   = subgroupShuffleXor(data[0].i4.x,    invocation);\r
50     data[invocation].i4.xy  = subgroupShuffleXor(data[1].i4.xy,   invocation);\r
51     data[invocation].i4.xyz = subgroupShuffleXor(data[2].i4.xyz,  invocation);\r
52     data[invocation].i4     = subgroupShuffleXor(data[3].i4,      invocation);\r
53 \r
54     data[invocation].u4.x   = subgroupShuffleXor(data[0].u4.x,    invocation);\r
55     data[invocation].u4.xy  = subgroupShuffleXor(data[1].u4.xy,   invocation);\r
56     data[invocation].u4.xyz = subgroupShuffleXor(data[2].u4.xyz,  invocation);\r
57     data[invocation].u4     = subgroupShuffleXor(data[3].u4,      invocation);\r
58 \r
59     data[invocation].d4.x   = subgroupShuffleXor(data[0].d4.x,    invocation);\r
60     data[invocation].d4.xy  = subgroupShuffleXor(data[1].d4.xy,   invocation);\r
61     data[invocation].d4.xyz = subgroupShuffleXor(data[2].d4.xyz,  invocation);\r
62     data[invocation].d4     = subgroupShuffleXor(data[3].d4,      invocation);\r
63 \r
64     data[invocation].i4.x   =   int(subgroupShuffleXor(data[0].i4.x < 0,                   invocation));\r
65     data[invocation].i4.xy  = ivec2(subgroupShuffleXor(lessThan(data[1].i4.xy, ivec2(0)),  invocation));\r
66     data[invocation].i4.xyz = ivec3(subgroupShuffleXor(lessThan(data[1].i4.xyz, ivec3(0)), invocation));\r
67     data[invocation].i4     = ivec4(subgroupShuffleXor(lessThan(data[1].i4, ivec4(0)),     invocation));\r
68 }\r