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)
107 memoryBarrierShared(); \
110 #extension GL_NV_mesh_shader : enable
112 layout(local_size_x = 32) in;
114 layout(max_vertices=MAX_VER) out;
115 layout(max_primitives=MAX_PRIM) out;
116 layout(triangles) out;
118 // test use of builtins in mesh shaders:
122 uint iid = gl_LocalInvocationID.x;
123 uint gid = gl_WorkGroupID.x;
125 gl_MeshVerticesNV[iid].gl_Position = vec4(1.0);
126 gl_MeshVerticesNV[iid].gl_PointSize = 2.0;
127 gl_MeshVerticesNV[iid].gl_ClipDistance[3] = 3.0;
128 gl_MeshVerticesNV[iid].gl_CullDistance[2] = 4.0;
132 gl_MeshVerticesNV[iid+1].gl_Position = gl_MeshVerticesNV[iid].gl_Position;
133 gl_MeshVerticesNV[iid+1].gl_PointSize = gl_MeshVerticesNV[iid].gl_PointSize;
134 gl_MeshVerticesNV[iid+1].gl_ClipDistance[3] = gl_MeshVerticesNV[iid].gl_ClipDistance[3];
135 gl_MeshVerticesNV[iid+1].gl_CullDistance[2] = gl_MeshVerticesNV[iid].gl_CullDistance[2];
139 gl_MeshPrimitivesNV[iid].gl_PrimitiveID = 6;
140 gl_MeshPrimitivesNV[iid].gl_Layer = 7;
141 gl_MeshPrimitivesNV[iid].gl_ViewportIndex = 8;
142 gl_MeshPrimitivesNV[iid].gl_ViewportMask[0] = 9;
146 gl_MeshPrimitivesNV[iid+1].gl_PrimitiveID = gl_MeshPrimitivesNV[iid].gl_PrimitiveID;
147 gl_MeshPrimitivesNV[iid+1].gl_Layer = gl_MeshPrimitivesNV[iid].gl_Layer;
148 gl_MeshPrimitivesNV[iid+1].gl_ViewportIndex = gl_MeshPrimitivesNV[iid].gl_ViewportIndex;
149 gl_MeshPrimitivesNV[iid+1].gl_ViewportMask[0] = gl_MeshPrimitivesNV[iid].gl_ViewportMask[0];
153 // check bound limits
154 gl_PrimitiveIndicesNV[0] = 257; // should truncate 257 -> 1
155 gl_PrimitiveIndicesNV[(MAX_PRIM * 3) - 1] = 2;
156 gl_PrimitiveIndicesNV[gid] = gl_PrimitiveIndicesNV[gid-1];
158 // writes 4 indices at offset gl_DrawID
159 writePackedPrimitiveIndices4x8NV(gl_DrawID, 0x01020304);
161 gl_PrimitiveCountNV = MAX_PRIM * 3;
166 #extension GL_KHR_shader_subgroup_basic: enable
167 void basic_works (void)
170 gl_SubgroupInvocationID;
172 subgroupMemoryBarrier();
173 subgroupMemoryBarrierBuffer();
174 subgroupMemoryBarrierImage();
176 gl_NumSubgroups; // allowed in mesh
177 gl_SubgroupID; // allowed in mesh
178 subgroupMemoryBarrierShared(); // allowed in mesh
181 #extension GL_KHR_shader_subgroup_ballot: enable
182 void ballot_works(vec4 f4) {
188 subgroupBroadcast(f4, 0);
189 subgroupBroadcastFirst(f4);
190 uvec4 ballot = subgroupBallot(false);
191 subgroupInverseBallot(uvec4(0x1));
192 subgroupBallotBitExtract(ballot, 0);
193 subgroupBallotBitCount(ballot);
194 subgroupBallotInclusiveBitCount(ballot);
195 subgroupBallotExclusiveBitCount(ballot);
196 subgroupBallotFindLSB(ballot);
197 subgroupBallotFindMSB(ballot);
200 #extension GL_KHR_shader_subgroup_vote: enable
201 void vote_works(vec4 f4)
205 subgroupAllEqual(f4);
208 #extension GL_KHR_shader_subgroup_shuffle: enable
209 #extension GL_KHR_shader_subgroup_shuffle_relative: enable
210 void shuffle_works(vec4 f4)
212 subgroupShuffle(f4, 0);
213 subgroupShuffleXor(f4, 0x1);
214 subgroupShuffleUp(f4, 1);
215 subgroupShuffleDown(f4, 1);
218 #extension GL_KHR_shader_subgroup_arithmetic: enable
219 void arith_works(vec4 f4)
229 subgroupInclusiveAdd(f4);
230 subgroupInclusiveMul(f4);
231 subgroupInclusiveMin(f4);
232 subgroupInclusiveMax(f4);
233 subgroupInclusiveAnd(ballot);
234 subgroupInclusiveOr(ballot);
235 subgroupInclusiveXor(ballot);
236 subgroupExclusiveAdd(f4);
237 subgroupExclusiveMul(f4);
238 subgroupExclusiveMin(f4);
239 subgroupExclusiveMax(f4);
240 subgroupExclusiveAnd(ballot);
241 subgroupExclusiveOr(ballot);
242 subgroupExclusiveXor(ballot);
245 #extension GL_KHR_shader_subgroup_clustered: enable
246 void clustered_works(vec4 f4)
248 uvec4 ballot = uvec4(0x55,0,0,0);
249 subgroupClusteredAdd(f4, 2);
250 subgroupClusteredMul(f4, 2);
251 subgroupClusteredMin(f4, 2);
252 subgroupClusteredMax(f4, 2);
253 subgroupClusteredAnd(ballot, 2);
254 subgroupClusteredOr(ballot, 2);
255 subgroupClusteredXor(ballot, 2);
258 #extension GL_KHR_shader_subgroup_quad: enable
259 void quad_works(vec4 f4)
261 subgroupQuadBroadcast(f4, 0);
262 subgroupQuadSwapHorizontal(f4);
263 subgroupQuadSwapVertical(f4);
264 subgroupQuadSwapDiagonal(f4);
267 #extension GL_NV_shader_subgroup_partitioned: enable
268 void partitioned_works(vec4 f4)
270 uvec4 parti = subgroupPartitionNV(f4);
271 uvec4 ballot = uvec4(0x55,0,0,0);
272 subgroupPartitionedAddNV(f4, parti);
273 subgroupPartitionedMulNV(f4, parti);
274 subgroupPartitionedMinNV(f4, parti);
275 subgroupPartitionedMaxNV(f4, parti);
276 subgroupPartitionedAndNV(ballot, parti);
277 subgroupPartitionedOrNV(ballot, parti);
278 subgroupPartitionedXorNV(ballot, parti);
279 subgroupPartitionedInclusiveAddNV(f4, parti);
280 subgroupPartitionedInclusiveMulNV(f4, parti);
281 subgroupPartitionedInclusiveMinNV(f4, parti);
282 subgroupPartitionedInclusiveMaxNV(f4, parti);
283 subgroupPartitionedInclusiveAndNV(ballot, parti);
284 subgroupPartitionedInclusiveOrNV(ballot, parti);
285 subgroupPartitionedInclusiveXorNV(ballot, parti);
286 subgroupPartitionedExclusiveAddNV(f4, parti);
287 subgroupPartitionedExclusiveMulNV(f4, parti);
288 subgroupPartitionedExclusiveMinNV(f4, parti);
289 subgroupPartitionedExclusiveMaxNV(f4, parti);
290 subgroupPartitionedExclusiveAndNV(ballot, parti);
291 subgroupPartitionedExclusiveOrNV(ballot, parti);
292 subgroupPartitionedExclusiveXorNV(ballot, parti);
295 // tests for NV_shader_sm_builtins
296 void sm_builtins_err()
298 gl_WarpsPerSMNV; // ERROR, no extension
299 gl_SMCountNV; // ERROR, no extension
300 gl_WarpIDNV; // ERROR, no extension
301 gl_SMIDNV; // ERROR, no extension
304 #ifdef GL_NV_shader_sm_builtins
305 #extension GL_NV_shader_sm_builtins : enable