2 #extension GL_NV_ray_tracing : enable
5 vec4 undeclared_errors(vec4 f4)
8 gl_SubgroupSize; // ERROR, extension not enabled (basic)
9 gl_SubgroupInvocationID; // ERROR, extension not enabled (basic)
10 subgroupBarrier(); // ERROR, extension not enabled (basic)
11 subgroupMemoryBarrier(); // ERROR, extension not enabled (basic)
12 subgroupMemoryBarrierBuffer(); // ERROR, extension not enabled (basic)
13 subgroupMemoryBarrierImage(); // ERROR, extension not enabled (basic)
14 subgroupElect(); // ERROR, extension not enabled (basic)
15 gl_NumSubgroups; // ERROR, only defined in compute
16 gl_SubgroupID; // ERROR, only defined in compute
17 subgroupMemoryBarrierShared(); // ERROR, only defined in compute
19 subgroupAll(true); // ERROR extension not enabled (vote)
20 subgroupAny(false); // ERROR extension not enabled (vote)
21 subgroupAllEqual(f4); // ERROR extension not enabled (vote)
23 gl_SubgroupEqMask; // ERROR extension not enabled (ballot)
24 gl_SubgroupGeMask; // ERROR extension not enabled (ballot)
25 gl_SubgroupGtMask; // ERROR extension not enabled (ballot)
26 gl_SubgroupLeMask; // ERROR extension not enabled (ballot)
27 gl_SubgroupLtMask; // ERROR extension not enabled (ballot)
28 subgroupBroadcast(f4, 0); // ERROR extension not enabled (ballot)
29 subgroupBroadcastFirst(f4); // ERROR extension not enabled (ballot)
30 uvec4 ballot = subgroupBallot(false); // ERROR extension not enabled (ballot)
31 subgroupInverseBallot(uvec4(0x1)); // ERROR extension not enabled (ballot)
32 subgroupBallotBitExtract(ballot, 0); // ERROR extension not enabled (ballot)
33 subgroupBallotBitCount(ballot); // ERROR extension not enabled (ballot)
34 subgroupBallotInclusiveBitCount(ballot); // ERROR extension not enabled (ballot)
35 subgroupBallotExclusiveBitCount(ballot); // ERROR extension not enabled (ballot)
36 subgroupBallotFindLSB(ballot); // ERROR extension not enabled (ballot)
37 subgroupBallotFindMSB(ballot); // ERROR extension not enabled (ballot)
39 subgroupShuffle(f4, 0); // ERROR extension not enabled (shuffle)
40 subgroupShuffleXor(f4, 0x1); // ERROR extension not enabled (shuffle)
41 subgroupShuffleUp(f4, 1); // ERROR extension not enabled (shuffle_relative)
42 subgroupShuffleDown(f4, 1); // ERROR extension not enabled (shuffle_relative)
44 result = subgroupAdd(f4); // ERROR, extension not enabled (arith)
45 subgroupMul(f4); // ERROR, extension not enabled (arith)
46 subgroupMin(f4); // ERROR, extension not enabled (arith)
47 subgroupMax(f4); // ERROR, extension not enabled (arith)
48 subgroupAnd(ballot); // ERROR, extension not enabled (arith)
49 subgroupOr(ballot); // ERROR, extension not enabled (arith)
50 subgroupXor(ballot); // ERROR, extension not enabled (arith)
51 subgroupInclusiveAdd(f4); // ERROR, extension not enabled (arith)
52 subgroupInclusiveMul(f4); // ERROR, extension not enabled (arith)
53 subgroupInclusiveMin(f4); // ERROR, extension not enabled (arith)
54 subgroupInclusiveMax(f4); // ERROR, extension not enabled (arith)
55 subgroupInclusiveAnd(ballot); // ERROR, extension not enabled (arith)
56 subgroupInclusiveOr(ballot); // ERROR, extension not enabled (arith)
57 subgroupInclusiveXor(ballot); // ERROR, extension not enabled (arith)
58 subgroupExclusiveAdd(f4); // ERROR, extension not enabled (arith)
59 subgroupExclusiveMul(f4); // ERROR, extension not enabled (arith)
60 subgroupExclusiveMin(f4); // ERROR, extension not enabled (arith)
61 subgroupExclusiveMax(f4); // ERROR, extension not enabled (arith)
62 subgroupExclusiveAnd(ballot); // ERROR, extension not enabled (arith)
63 subgroupExclusiveOr(ballot); // ERROR, extension not enabled (arith)
64 subgroupExclusiveXor(ballot); // ERROR, extension not enabled (arith)
66 subgroupClusteredAdd(f4, 2); // ERROR, extension not enabled (clustered)
67 subgroupClusteredMul(f4, 2); // ERROR, extension not enabled (clustered)
68 subgroupClusteredMin(f4, 2); // ERROR, extension not enabled (clustered)
69 subgroupClusteredMax(f4, 2); // ERROR, extension not enabled (clustered)
70 subgroupClusteredAnd(ballot, 2); // ERROR, extension not enabled (clustered)
71 subgroupClusteredOr(ballot, 2); // ERROR, extension not enabled (clustered)
72 subgroupClusteredXor(ballot, 2); // ERROR, extension not enabled (clustered)
74 subgroupQuadBroadcast(f4, 0); // ERROR, extension not enabled (quad)
75 subgroupQuadSwapHorizontal(f4); // ERROR, extension not enabled (quad)
76 subgroupQuadSwapVertical(f4); // ERROR, extension not enabled (quad)
77 subgroupQuadSwapDiagonal(f4); // ERROR, extension not enabled (quad)
79 uvec4 parti = subgroupPartitionNV(f4); // ERROR, extension not enabled (partitioned)
80 subgroupPartitionedAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
81 subgroupPartitionedMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
82 subgroupPartitionedMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
83 subgroupPartitionedMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
84 subgroupPartitionedAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
85 subgroupPartitionedOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
86 subgroupPartitionedXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
87 subgroupPartitionedInclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
88 subgroupPartitionedInclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
89 subgroupPartitionedInclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
90 subgroupPartitionedInclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
91 subgroupPartitionedInclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
92 subgroupPartitionedInclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
93 subgroupPartitionedInclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
94 subgroupPartitionedExclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned)
95 subgroupPartitionedExclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned)
96 subgroupPartitionedExclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned)
97 subgroupPartitionedExclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned)
98 subgroupPartitionedExclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned)
99 subgroupPartitionedExclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned)
100 subgroupPartitionedExclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned)
106 layout(binding = 0, set = 0) uniform accelerationStructureNV accNV;
107 layout(location = 0) rayPayloadNV vec4 localPayload;
108 layout(location = 1) rayPayloadInNV vec4 incomingPayload;
111 uvec3 v0 = gl_LaunchIDNV;
112 uvec3 v1 = gl_LaunchSizeNV;
113 vec3 v2 = gl_WorldRayOriginNV;
114 vec3 v3 = gl_WorldRayDirectionNV;
115 vec3 v4 = gl_ObjectRayOriginNV;
116 vec3 v5 = gl_ObjectRayDirectionNV;
117 float v6 = gl_RayTminNV;
118 float v7 = gl_RayTmaxNV;
119 traceNV(accNV, 0u, 1u, 2u, 3u, 0u, vec3(0.5f), 0.5f, vec3(1.0f), 0.75f, 1);
122 #extension GL_KHR_shader_subgroup_basic: enable
123 void basic_works (void)
126 gl_SubgroupInvocationID;
128 subgroupMemoryBarrier();
129 subgroupMemoryBarrierBuffer();
130 subgroupMemoryBarrierImage();
134 #extension GL_KHR_shader_subgroup_ballot: enable
135 void ballot_works(vec4 f4) {
141 subgroupBroadcast(f4, 0);
142 subgroupBroadcastFirst(f4);
143 uvec4 ballot = subgroupBallot(false);
144 subgroupInverseBallot(uvec4(0x1));
145 subgroupBallotBitExtract(ballot, 0);
146 subgroupBallotBitCount(ballot);
147 subgroupBallotInclusiveBitCount(ballot);
148 subgroupBallotExclusiveBitCount(ballot);
149 subgroupBallotFindLSB(ballot);
150 subgroupBallotFindMSB(ballot);
153 #extension GL_KHR_shader_subgroup_vote: enable
154 void vote_works(vec4 f4)
158 subgroupAllEqual(f4);
161 #extension GL_KHR_shader_subgroup_shuffle: enable
162 #extension GL_KHR_shader_subgroup_shuffle_relative: enable
163 void shuffle_works(vec4 f4)
165 subgroupShuffle(f4, 0);
166 subgroupShuffleXor(f4, 0x1);
167 subgroupShuffleUp(f4, 1);
168 subgroupShuffleDown(f4, 1);
171 #extension GL_KHR_shader_subgroup_arithmetic: enable
172 void arith_works(vec4 f4)
182 subgroupInclusiveAdd(f4);
183 subgroupInclusiveMul(f4);
184 subgroupInclusiveMin(f4);
185 subgroupInclusiveMax(f4);
186 subgroupInclusiveAnd(ballot);
187 subgroupInclusiveOr(ballot);
188 subgroupInclusiveXor(ballot);
189 subgroupExclusiveAdd(f4);
190 subgroupExclusiveMul(f4);
191 subgroupExclusiveMin(f4);
192 subgroupExclusiveMax(f4);
193 subgroupExclusiveAnd(ballot);
194 subgroupExclusiveOr(ballot);
195 subgroupExclusiveXor(ballot);
198 #extension GL_KHR_shader_subgroup_clustered: enable
199 void clustered_works(vec4 f4)
201 uvec4 ballot = uvec4(0x55,0,0,0);
202 subgroupClusteredAdd(f4, 2);
203 subgroupClusteredMul(f4, 2);
204 subgroupClusteredMin(f4, 2);
205 subgroupClusteredMax(f4, 2);
206 subgroupClusteredAnd(ballot, 2);
207 subgroupClusteredOr(ballot, 2);
208 subgroupClusteredXor(ballot, 2);
211 #extension GL_KHR_shader_subgroup_quad: enable
212 void quad_works(vec4 f4)
214 subgroupQuadBroadcast(f4, 0);
215 subgroupQuadSwapHorizontal(f4);
216 subgroupQuadSwapVertical(f4);
217 subgroupQuadSwapDiagonal(f4);
220 #extension GL_NV_shader_subgroup_partitioned: enable
221 void partitioned_works(vec4 f4)
223 uvec4 parti = subgroupPartitionNV(f4);
224 uvec4 ballot = uvec4(0x55,0,0,0);
225 subgroupPartitionedAddNV(f4, parti);
226 subgroupPartitionedMulNV(f4, parti);
227 subgroupPartitionedMinNV(f4, parti);
228 subgroupPartitionedMaxNV(f4, parti);
229 subgroupPartitionedAndNV(ballot, parti);
230 subgroupPartitionedOrNV(ballot, parti);
231 subgroupPartitionedXorNV(ballot, parti);
232 subgroupPartitionedInclusiveAddNV(f4, parti);
233 subgroupPartitionedInclusiveMulNV(f4, parti);
234 subgroupPartitionedInclusiveMinNV(f4, parti);
235 subgroupPartitionedInclusiveMaxNV(f4, parti);
236 subgroupPartitionedInclusiveAndNV(ballot, parti);
237 subgroupPartitionedInclusiveOrNV(ballot, parti);
238 subgroupPartitionedInclusiveXorNV(ballot, parti);
239 subgroupPartitionedExclusiveAddNV(f4, parti);
240 subgroupPartitionedExclusiveMulNV(f4, parti);
241 subgroupPartitionedExclusiveMinNV(f4, parti);
242 subgroupPartitionedExclusiveMaxNV(f4, parti);
243 subgroupPartitionedExclusiveAndNV(ballot, parti);
244 subgroupPartitionedExclusiveOrNV(ballot, parti);
245 subgroupPartitionedExclusiveXorNV(ballot, parti);
248 // tests for NV_shader_sm_builtins
249 void sm_builtins_err()
251 gl_WarpsPerSMNV; // ERROR, no extension
252 gl_SMCountNV; // ERROR, no extension
253 gl_WarpIDNV; // ERROR, no extension
254 gl_SMIDNV; // ERROR, no extension
257 #ifdef GL_NV_shader_sm_builtins
258 #extension GL_NV_shader_sm_builtins : enable