3 vec4 undeclared_errors(vec4 f4)
6 gl_SubgroupSize; // ERROR, extension not enabled (basic)
7 gl_SubgroupInvocationID; // ERROR, extension not enabled (basic)
8 subgroupBarrier(); // ERROR, extension not enabled (basic)
9 subgroupMemoryBarrier(); // ERROR, extension not enabled (basic)
10 subgroupMemoryBarrierBuffer(); // ERROR, extension not enabled (basic)
11 subgroupMemoryBarrierImage(); // ERROR, extension not enabled (basic)
12 subgroupElect(); // ERROR, extension not enabled (basic)
13 gl_NumSubgroups; // ERROR, extension not enabled (basic)
14 gl_SubgroupID; // ERROR, extension not enabled (basic)
15 subgroupMemoryBarrierShared(); // ERROR, extension not enabled (basic)
17 subgroupAll(true); // ERROR extension not enabled (vote)
18 subgroupAny(false); // ERROR extension not enabled (vote)
19 subgroupAllEqual(f4); // ERROR extension not enabled (vote)
21 gl_SubgroupEqMask; // ERROR extension not enabled (ballot)
22 gl_SubgroupGeMask; // ERROR extension not enabled (ballot)
23 gl_SubgroupGtMask; // ERROR extension not enabled (ballot)
24 gl_SubgroupLeMask; // ERROR extension not enabled (ballot)
25 gl_SubgroupLtMask; // ERROR extension not enabled (ballot)
26 subgroupBroadcast(f4, 0); // ERROR extension not enabled (ballot)
27 subgroupBroadcastFirst(f4); // ERROR extension not enabled (ballot)
28 uvec4 ballot = subgroupBallot(false); // ERROR extension not enabled (ballot)
29 subgroupInverseBallot(uvec4(0x1)); // ERROR extension not enabled (ballot)
30 subgroupBallotBitExtract(ballot, 0); // ERROR extension not enabled (ballot)
31 subgroupBallotBitCount(ballot); // ERROR extension not enabled (ballot)
32 subgroupBallotInclusiveBitCount(ballot); // ERROR extension not enabled (ballot)
33 subgroupBallotExclusiveBitCount(ballot); // ERROR extension not enabled (ballot)
34 subgroupBallotFindLSB(ballot); // ERROR extension not enabled (ballot)
35 subgroupBallotFindMSB(ballot); // ERROR extension not enabled (ballot)
37 subgroupShuffle(f4, 0); // ERROR extension not enabled (shuffle)
38 subgroupShuffleXor(f4, 0x1); // ERROR extension not enabled (shuffle)
39 subgroupShuffleUp(f4, 1); // ERROR extension not enabled (shuffle_relative)
40 subgroupShuffleDown(f4, 1); // ERROR extension not enabled (shuffle_relative)
42 result = subgroupAdd(f4); // ERROR, extension not enabled (arith)
43 subgroupMul(f4); // ERROR, extension not enabled (arith)
44 subgroupMin(f4); // ERROR, extension not enabled (arith)
45 subgroupMax(f4); // ERROR, extension not enabled (arith)
46 subgroupAnd(ballot); // ERROR, extension not enabled (arith)
47 subgroupOr(ballot); // ERROR, extension not enabled (arith)
48 subgroupXor(ballot); // ERROR, extension not enabled (arith)
49 subgroupInclusiveAdd(f4); // ERROR, extension not enabled (arith)
50 subgroupInclusiveMul(f4); // ERROR, extension not enabled (arith)
51 subgroupInclusiveMin(f4); // ERROR, extension not enabled (arith)
52 subgroupInclusiveMax(f4); // ERROR, extension not enabled (arith)
53 subgroupInclusiveAnd(ballot); // ERROR, extension not enabled (arith)
54 subgroupInclusiveOr(ballot); // ERROR, extension not enabled (arith)
55 subgroupInclusiveXor(ballot); // ERROR, extension not enabled (arith)
56 subgroupExclusiveAdd(f4); // ERROR, extension not enabled (arith)
57 subgroupExclusiveMul(f4); // ERROR, extension not enabled (arith)
58 subgroupExclusiveMin(f4); // ERROR, extension not enabled (arith)
59 subgroupExclusiveMax(f4); // ERROR, extension not enabled (arith)
60 subgroupExclusiveAnd(ballot); // ERROR, extension not enabled (arith)
61 subgroupExclusiveOr(ballot); // ERROR, extension not enabled (arith)
62 subgroupExclusiveXor(ballot); // ERROR, extension not enabled (arith)
64 subgroupClusteredAdd(f4, 2); // ERROR, extension not enabled (clustered)
65 subgroupClusteredMul(f4, 2); // ERROR, extension not enabled (clustered)
66 subgroupClusteredMin(f4, 2); // ERROR, extension not enabled (clustered)
67 subgroupClusteredMax(f4, 2); // ERROR, extension not enabled (clustered)
68 subgroupClusteredAnd(ballot, 2); // ERROR, extension not enabled (clustered)
69 subgroupClusteredOr(ballot, 2); // ERROR, extension not enabled (clustered)
70 subgroupClusteredXor(ballot, 2); // ERROR, extension not enabled (clustered)
72 subgroupQuadBroadcast(f4, 0); // ERROR, extension not enabled (quad)
73 subgroupQuadSwapHorizontal(f4); // ERROR, extension not enabled (quad)
74 subgroupQuadSwapVertical(f4); // ERROR, extension not enabled (quad)
75 subgroupQuadSwapDiagonal(f4); // ERROR, extension not enabled (quad)
77 uvec4 parti = subgroupPartitionNV(f4); // ERROR, extension not enabled (partitioned)
78 subgroupPartitionedAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
79 subgroupPartitionedMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
80 subgroupPartitionedMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
81 subgroupPartitionedMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
82 subgroupPartitionedAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
83 subgroupPartitionedOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
84 subgroupPartitionedXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
85 subgroupPartitionedInclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
86 subgroupPartitionedInclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
87 subgroupPartitionedInclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
88 subgroupPartitionedInclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
89 subgroupPartitionedInclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
90 subgroupPartitionedInclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
91 subgroupPartitionedInclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
92 subgroupPartitionedExclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
93 subgroupPartitionedExclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
94 subgroupPartitionedExclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
95 subgroupPartitionedExclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
96 subgroupPartitionedExclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
97 subgroupPartitionedExclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
98 subgroupPartitionedExclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
103 #define MAX_VIEWS gl_MaxMeshViewCountNV
106 memoryBarrierShared(); \
109 #extension GL_NV_mesh_shader : enable
111 layout(local_size_x = 32) in;
113 // test use of shared memory in task shaders:
114 layout(binding=0) writeonly uniform image2D uni_image;
120 // test use of task memory in task shaders:
129 uint iid = gl_LocalInvocationID.x;
130 uint gid = gl_WorkGroupID.x;
131 uint viewID = gl_MeshViewIndicesNV[gl_MeshViewCountNV%MAX_VIEWS];
133 // 1. shared memory load and stores
134 for (uint i = 0; i < 10; ++i) {
135 mem[i] = vec4(i + uni_value);
137 imageStore(uni_image, ivec2(iid), mem[gid]);
138 imageStore(uni_image, ivec2(iid), mem[gid+1]);
142 // 2. task memory stores
144 mytask.dummy = vec2(30.0, 31.0);
145 mytask.submesh[0] = vec2(32.0, 33.0);
146 mytask.submesh[1] = vec2(34.0, 35.0);
147 mytask.submesh[2] = mytask.submesh[gid%2];
148 mytask.viewID = viewID;
156 #extension GL_KHR_shader_subgroup_basic: enable
157 void basic_works (void)
160 gl_SubgroupInvocationID;
162 subgroupMemoryBarrier();
163 subgroupMemoryBarrierBuffer();
164 subgroupMemoryBarrierImage();
166 gl_NumSubgroups; // allowed in task
167 gl_SubgroupID; // allowed in task
168 subgroupMemoryBarrierShared(); // allowed in task
171 #extension GL_KHR_shader_subgroup_ballot: enable
172 void ballot_works(vec4 f4) {
178 subgroupBroadcast(f4, 0);
179 subgroupBroadcastFirst(f4);
180 uvec4 ballot = subgroupBallot(false);
181 subgroupInverseBallot(uvec4(0x1));
182 subgroupBallotBitExtract(ballot, 0);
183 subgroupBallotBitCount(ballot);
184 subgroupBallotInclusiveBitCount(ballot);
185 subgroupBallotExclusiveBitCount(ballot);
186 subgroupBallotFindLSB(ballot);
187 subgroupBallotFindMSB(ballot);
190 #extension GL_KHR_shader_subgroup_vote: enable
191 void vote_works(vec4 f4)
195 subgroupAllEqual(f4);
198 #extension GL_KHR_shader_subgroup_shuffle: enable
199 #extension GL_KHR_shader_subgroup_shuffle_relative: enable
200 void shuffle_works(vec4 f4)
202 subgroupShuffle(f4, 0);
203 subgroupShuffleXor(f4, 0x1);
204 subgroupShuffleUp(f4, 1);
205 subgroupShuffleDown(f4, 1);
208 #extension GL_KHR_shader_subgroup_arithmetic: enable
209 void arith_works(vec4 f4)
219 subgroupInclusiveAdd(f4);
220 subgroupInclusiveMul(f4);
221 subgroupInclusiveMin(f4);
222 subgroupInclusiveMax(f4);
223 subgroupInclusiveAnd(ballot);
224 subgroupInclusiveOr(ballot);
225 subgroupInclusiveXor(ballot);
226 subgroupExclusiveAdd(f4);
227 subgroupExclusiveMul(f4);
228 subgroupExclusiveMin(f4);
229 subgroupExclusiveMax(f4);
230 subgroupExclusiveAnd(ballot);
231 subgroupExclusiveOr(ballot);
232 subgroupExclusiveXor(ballot);
235 #extension GL_KHR_shader_subgroup_clustered: enable
236 void clustered_works(vec4 f4)
238 uvec4 ballot = uvec4(0x55,0,0,0);
239 subgroupClusteredAdd(f4, 2);
240 subgroupClusteredMul(f4, 2);
241 subgroupClusteredMin(f4, 2);
242 subgroupClusteredMax(f4, 2);
243 subgroupClusteredAnd(ballot, 2);
244 subgroupClusteredOr(ballot, 2);
245 subgroupClusteredXor(ballot, 2);
248 #extension GL_KHR_shader_subgroup_quad: enable
249 void quad_works(vec4 f4)
251 subgroupQuadBroadcast(f4, 0);
252 subgroupQuadSwapHorizontal(f4);
253 subgroupQuadSwapVertical(f4);
254 subgroupQuadSwapDiagonal(f4);
257 #extension GL_NV_shader_subgroup_partitioned: enable
258 void partitioned_works(vec4 f4)
260 uvec4 parti = subgroupPartitionNV(f4);
261 uvec4 ballot = uvec4(0x55,0,0,0);
262 subgroupPartitionedAddNV(f4, parti);
263 subgroupPartitionedMulNV(f4, parti);
264 subgroupPartitionedMinNV(f4, parti);
265 subgroupPartitionedMaxNV(f4, parti);
266 subgroupPartitionedAndNV(ballot, parti);
267 subgroupPartitionedOrNV(ballot, parti);
268 subgroupPartitionedXorNV(ballot, parti);
269 subgroupPartitionedInclusiveAddNV(f4, parti);
270 subgroupPartitionedInclusiveMulNV(f4, parti);
271 subgroupPartitionedInclusiveMinNV(f4, parti);
272 subgroupPartitionedInclusiveMaxNV(f4, parti);
273 subgroupPartitionedInclusiveAndNV(ballot, parti);
274 subgroupPartitionedInclusiveOrNV(ballot, parti);
275 subgroupPartitionedInclusiveXorNV(ballot, parti);
276 subgroupPartitionedExclusiveAddNV(f4, parti);
277 subgroupPartitionedExclusiveMulNV(f4, parti);
278 subgroupPartitionedExclusiveMinNV(f4, parti);
279 subgroupPartitionedExclusiveMaxNV(f4, parti);
280 subgroupPartitionedExclusiveAndNV(ballot, parti);
281 subgroupPartitionedExclusiveOrNV(ballot, parti);
282 subgroupPartitionedExclusiveXorNV(ballot, parti);
285 // tests for NV_shader_sm_builtins
286 void sm_builtins_err()
288 gl_WarpsPerSMNV; // ERROR, no extension
289 gl_SMCountNV; // ERROR, no extension
290 gl_WarpIDNV; // ERROR, no extension
291 gl_SMIDNV; // ERROR, no extension
294 #ifdef GL_NV_shader_sm_builtins
295 #extension GL_NV_shader_sm_builtins : enable