Merge pull request #2913 from greg-lunarg/i2905
[platform/upstream/glslang.git] / Test / spv.subgroupClustered.comp
1 #version 450\r
2 \r
3 #extension GL_KHR_shader_subgroup_clustered: enable\r
4 \r
5 layout (local_size_x = 8) 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   = subgroupClusteredAdd(data[0].f4.x, 1);\r
20     data[invocation].f4.xy  = subgroupClusteredAdd(data[1].f4.xy, 1);\r
21     data[invocation].f4.xyz = subgroupClusteredAdd(data[2].f4.xyz, 1);\r
22     data[invocation].f4     = subgroupClusteredAdd(data[3].f4, 1);\r
23 \r
24     data[invocation].i4.x   = subgroupClusteredAdd(data[0].i4.x, 1);\r
25     data[invocation].i4.xy  = subgroupClusteredAdd(data[1].i4.xy, 1);\r
26     data[invocation].i4.xyz = subgroupClusteredAdd(data[2].i4.xyz, 1);\r
27     data[invocation].i4     = subgroupClusteredAdd(data[3].i4, 1);\r
28 \r
29     data[invocation].u4.x   = subgroupClusteredAdd(data[0].u4.x, 1);\r
30     data[invocation].u4.xy  = subgroupClusteredAdd(data[1].u4.xy, 1);\r
31     data[invocation].u4.xyz = subgroupClusteredAdd(data[2].u4.xyz, 1);\r
32     data[invocation].u4     = subgroupClusteredAdd(data[3].u4, 1);\r
33 \r
34     data[invocation].d4.x   = subgroupClusteredAdd(data[0].d4.x, 1);\r
35     data[invocation].d4.xy  = subgroupClusteredAdd(data[1].d4.xy, 1);\r
36     data[invocation].d4.xyz = subgroupClusteredAdd(data[2].d4.xyz, 1);\r
37     data[invocation].d4     = subgroupClusteredAdd(data[3].d4, 1);\r
38 \r
39     data[invocation].f4.x   = subgroupClusteredMul(data[0].f4.x, 1);\r
40     data[invocation].f4.xy  = subgroupClusteredMul(data[1].f4.xy, 1);\r
41     data[invocation].f4.xyz = subgroupClusteredMul(data[2].f4.xyz, 1);\r
42     data[invocation].f4     = subgroupClusteredMul(data[3].f4, 1);\r
43 \r
44     data[invocation].i4.x   = subgroupClusteredMul(data[0].i4.x, 1);\r
45     data[invocation].i4.xy  = subgroupClusteredMul(data[1].i4.xy, 1);\r
46     data[invocation].i4.xyz = subgroupClusteredMul(data[2].i4.xyz, 1);\r
47     data[invocation].i4     = subgroupClusteredMul(data[3].i4, 1);\r
48 \r
49     data[invocation].u4.x   = subgroupClusteredMul(data[0].u4.x, 1);\r
50     data[invocation].u4.xy  = subgroupClusteredMul(data[1].u4.xy, 1);\r
51     data[invocation].u4.xyz = subgroupClusteredMul(data[2].u4.xyz, 1);\r
52     data[invocation].u4     = subgroupClusteredMul(data[3].u4, 1);\r
53 \r
54     data[invocation].d4.x   = subgroupClusteredMul(data[0].d4.x, 1);\r
55     data[invocation].d4.xy  = subgroupClusteredMul(data[1].d4.xy, 1);\r
56     data[invocation].d4.xyz = subgroupClusteredMul(data[2].d4.xyz, 1);\r
57     data[invocation].d4     = subgroupClusteredMul(data[3].d4, 1);\r
58 \r
59     data[invocation].f4.x   = subgroupClusteredMin(data[0].f4.x, 1);\r
60     data[invocation].f4.xy  = subgroupClusteredMin(data[1].f4.xy, 1);\r
61     data[invocation].f4.xyz = subgroupClusteredMin(data[2].f4.xyz, 1);\r
62     data[invocation].f4     = subgroupClusteredMin(data[3].f4, 1);\r
63 \r
64     data[invocation].i4.x   = subgroupClusteredMin(data[0].i4.x, 1);\r
65     data[invocation].i4.xy  = subgroupClusteredMin(data[1].i4.xy, 1);\r
66     data[invocation].i4.xyz = subgroupClusteredMin(data[2].i4.xyz, 1);\r
67     data[invocation].i4     = subgroupClusteredMin(data[3].i4, 1);\r
68 \r
69     data[invocation].u4.x   = subgroupClusteredMin(data[0].u4.x, 1);\r
70     data[invocation].u4.xy  = subgroupClusteredMin(data[1].u4.xy, 1);\r
71     data[invocation].u4.xyz = subgroupClusteredMin(data[2].u4.xyz, 1);\r
72     data[invocation].u4     = subgroupClusteredMin(data[3].u4, 1);\r
73 \r
74     data[invocation].d4.x   = subgroupClusteredMin(data[0].d4.x, 1);\r
75     data[invocation].d4.xy  = subgroupClusteredMin(data[1].d4.xy, 1);\r
76     data[invocation].d4.xyz = subgroupClusteredMin(data[2].d4.xyz, 1);\r
77     data[invocation].d4     = subgroupClusteredMin(data[3].d4, 1);\r
78 \r
79     data[invocation].f4.x   = subgroupClusteredMax(data[0].f4.x, 1);\r
80     data[invocation].f4.xy  = subgroupClusteredMax(data[1].f4.xy, 1);\r
81     data[invocation].f4.xyz = subgroupClusteredMax(data[2].f4.xyz, 1);\r
82     data[invocation].f4     = subgroupClusteredMax(data[3].f4, 1);\r
83 \r
84     data[invocation].i4.x   = subgroupClusteredMax(data[0].i4.x, 1);\r
85     data[invocation].i4.xy  = subgroupClusteredMax(data[1].i4.xy, 1);\r
86     data[invocation].i4.xyz = subgroupClusteredMax(data[2].i4.xyz, 1);\r
87     data[invocation].i4     = subgroupClusteredMax(data[3].i4, 1);\r
88 \r
89     data[invocation].u4.x   = subgroupClusteredMax(data[0].u4.x, 1);\r
90     data[invocation].u4.xy  = subgroupClusteredMax(data[1].u4.xy, 1);\r
91     data[invocation].u4.xyz = subgroupClusteredMax(data[2].u4.xyz, 1);\r
92     data[invocation].u4     = subgroupClusteredMax(data[3].u4, 1);\r
93 \r
94     data[invocation].d4.x   = subgroupClusteredMax(data[0].d4.x, 1);\r
95     data[invocation].d4.xy  = subgroupClusteredMax(data[1].d4.xy, 1);\r
96     data[invocation].d4.xyz = subgroupClusteredMax(data[2].d4.xyz, 1);\r
97     data[invocation].d4     = subgroupClusteredMax(data[3].d4, 1);\r
98 \r
99     data[invocation].i4.x   = subgroupClusteredAnd(data[0].i4.x, 1);\r
100     data[invocation].i4.xy  = subgroupClusteredAnd(data[1].i4.xy, 1);\r
101     data[invocation].i4.xyz = subgroupClusteredAnd(data[2].i4.xyz, 1);\r
102     data[invocation].i4     = subgroupClusteredAnd(data[3].i4, 1);\r
103 \r
104     data[invocation].u4.x   = subgroupClusteredAnd(data[0].u4.x, 1);\r
105     data[invocation].u4.xy  = subgroupClusteredAnd(data[1].u4.xy, 1);\r
106     data[invocation].u4.xyz = subgroupClusteredAnd(data[2].u4.xyz, 1);\r
107     data[invocation].u4     = subgroupClusteredAnd(data[3].u4, 1);\r
108 \r
109     data[invocation].i4.x   =   int(subgroupClusteredAnd(data[0].i4.x < 0, 1));\r
110     data[invocation].i4.xy  = ivec2(subgroupClusteredAnd(lessThan(data[1].i4.xy, ivec2(0)), 1));\r
111     data[invocation].i4.xyz = ivec3(subgroupClusteredAnd(lessThan(data[1].i4.xyz, ivec3(0)), 1));\r
112     data[invocation].i4     = ivec4(subgroupClusteredAnd(lessThan(data[1].i4, ivec4(0)), 1));\r
113 \r
114     data[invocation].i4.x   = subgroupClusteredOr(data[0].i4.x, 1);\r
115     data[invocation].i4.xy  = subgroupClusteredOr(data[1].i4.xy, 1);\r
116     data[invocation].i4.xyz = subgroupClusteredOr(data[2].i4.xyz, 1);\r
117     data[invocation].i4     = subgroupClusteredOr(data[3].i4, 1);\r
118 \r
119     data[invocation].u4.x   = subgroupClusteredOr(data[0].u4.x, 1);\r
120     data[invocation].u4.xy  = subgroupClusteredOr(data[1].u4.xy, 1);\r
121     data[invocation].u4.xyz = subgroupClusteredOr(data[2].u4.xyz, 1);\r
122     data[invocation].u4     = subgroupClusteredOr(data[3].u4, 1);\r
123 \r
124     data[invocation].i4.x   =   int(subgroupClusteredOr(data[0].i4.x < 0, 1));\r
125     data[invocation].i4.xy  = ivec2(subgroupClusteredOr(lessThan(data[1].i4.xy, ivec2(0)), 1));\r
126     data[invocation].i4.xyz = ivec3(subgroupClusteredOr(lessThan(data[1].i4.xyz, ivec3(0)), 1));\r
127     data[invocation].i4     = ivec4(subgroupClusteredOr(lessThan(data[1].i4, ivec4(0)), 1));\r
128 \r
129     data[invocation].i4.x   = subgroupClusteredXor(data[0].i4.x, 1);\r
130     data[invocation].i4.xy  = subgroupClusteredXor(data[1].i4.xy, 1);\r
131     data[invocation].i4.xyz = subgroupClusteredXor(data[2].i4.xyz, 1);\r
132     data[invocation].i4     = subgroupClusteredXor(data[3].i4, 1);\r
133 \r
134     data[invocation].u4.x   = subgroupClusteredXor(data[0].u4.x, 1);\r
135     data[invocation].u4.xy  = subgroupClusteredXor(data[1].u4.xy, 1);\r
136     data[invocation].u4.xyz = subgroupClusteredXor(data[2].u4.xyz, 1);\r
137     data[invocation].u4     = subgroupClusteredXor(data[3].u4, 1);\r
138 \r
139     data[invocation].i4.x   =   int(subgroupClusteredXor(data[0].i4.x < 0, 1));\r
140     data[invocation].i4.xy  = ivec2(subgroupClusteredXor(lessThan(data[1].i4.xy, ivec2(0)), 1));\r
141     data[invocation].i4.xyz = ivec3(subgroupClusteredXor(lessThan(data[1].i4.xyz, ivec3(0)), 1));\r
142     data[invocation].i4     = ivec4(subgroupClusteredXor(lessThan(data[1].i4, ivec4(0)), 1));\r
143 }\r