Daniel Koch | 83170e3 | 2019-03-26 13:45:33 -0400 | [diff] [blame] | 1 | #version 450
|
Daniel Koch | 51760c8 | 2019-05-30 00:24:33 -0400 | [diff] [blame] | 2 |
|
| 3 | vec4 undeclared_errors(vec4 f4)
|
| 4 | {
|
| 5 | vec4 result;
|
| 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, only defined in compute
|
| 14 | gl_SubgroupID; // ERROR, only defined in compute
|
| 15 | subgroupMemoryBarrierShared(); // ERROR, only defined in compute
|
| 16 |
|
| 17 | subgroupAll(true); // ERROR extension not enabled (vote)
|
| 18 | subgroupAny(false); // ERROR extension not enabled (vote)
|
| 19 | subgroupAllEqual(f4); // ERROR extension not enabled (vote)
|
| 20 |
|
| 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)
|
| 36 |
|
| 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)
|
| 41 |
|
| 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)
|
| 63 |
|
| 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)
|
| 71 |
|
| 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)
|
| 76 |
|
| 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)
|
| 99 |
|
| 100 | return result;
|
| 101 | }
|
| 102 |
|
Daniel Koch | 83170e3 | 2019-03-26 13:45:33 -0400 | [diff] [blame] | 103 | #extension GL_KHR_shader_subgroup_basic: enable
|
| 104 | layout(set = 0, binding = 0, std430) buffer Output
|
| 105 | {
|
| 106 | uvec4 result[];
|
| 107 | };
|
| 108 |
|
| 109 | void main (void)
|
| 110 | {
|
| 111 | result[gl_VertexID] = uvec4(gl_SubgroupSize, gl_SubgroupInvocationID, 0, 0);
|
Daniel Koch | 51760c8 | 2019-05-30 00:24:33 -0400 | [diff] [blame] | 112 | subgroupBarrier();
|
| 113 | subgroupMemoryBarrier();
|
| 114 | subgroupMemoryBarrierBuffer();
|
| 115 | subgroupMemoryBarrierImage();
|
| 116 | subgroupElect();
|
Daniel Koch | 83170e3 | 2019-03-26 13:45:33 -0400 | [diff] [blame] | 117 | }
|
Daniel Koch | 51760c8 | 2019-05-30 00:24:33 -0400 | [diff] [blame] | 118 |
|
| 119 | #extension GL_KHR_shader_subgroup_ballot: enable
|
| 120 | void ballot_works(vec4 f4) {
|
| 121 | gl_SubgroupEqMask;
|
| 122 | gl_SubgroupGeMask;
|
| 123 | gl_SubgroupGtMask;
|
| 124 | gl_SubgroupLeMask;
|
| 125 | gl_SubgroupLtMask;
|
| 126 | subgroupBroadcast(f4, 0);
|
| 127 | subgroupBroadcastFirst(f4);
|
| 128 | uvec4 ballot = subgroupBallot(false);
|
| 129 | subgroupInverseBallot(uvec4(0x1));
|
| 130 | subgroupBallotBitExtract(ballot, 0);
|
| 131 | subgroupBallotBitCount(ballot);
|
| 132 | subgroupBallotInclusiveBitCount(ballot);
|
| 133 | subgroupBallotExclusiveBitCount(ballot);
|
| 134 | subgroupBallotFindLSB(ballot);
|
| 135 | subgroupBallotFindMSB(ballot);
|
| 136 | }
|
| 137 |
|
| 138 | #extension GL_KHR_shader_subgroup_vote: enable
|
| 139 | void vote_works(vec4 f4)
|
| 140 | {
|
| 141 | subgroupAll(true);
|
| 142 | subgroupAny(false);
|
| 143 | subgroupAllEqual(f4);
|
| 144 | }
|
| 145 |
|
| 146 | #extension GL_KHR_shader_subgroup_shuffle: enable
|
| 147 | #extension GL_KHR_shader_subgroup_shuffle_relative: enable
|
| 148 | void shuffle_works(vec4 f4)
|
| 149 | {
|
| 150 | subgroupShuffle(f4, 0);
|
| 151 | subgroupShuffleXor(f4, 0x1);
|
| 152 | subgroupShuffleUp(f4, 1);
|
| 153 | subgroupShuffleDown(f4, 1);
|
| 154 | }
|
| 155 |
|
| 156 | #extension GL_KHR_shader_subgroup_arithmetic: enable
|
| 157 | void arith_works(vec4 f4)
|
| 158 | {
|
| 159 | uvec4 ballot;
|
| 160 | subgroupAdd(f4);
|
| 161 | subgroupMul(f4);
|
| 162 | subgroupMin(f4);
|
| 163 | subgroupMax(f4);
|
| 164 | subgroupAnd(ballot);
|
| 165 | subgroupOr(ballot);
|
| 166 | subgroupXor(ballot);
|
| 167 | subgroupInclusiveAdd(f4);
|
| 168 | subgroupInclusiveMul(f4);
|
| 169 | subgroupInclusiveMin(f4);
|
| 170 | subgroupInclusiveMax(f4);
|
| 171 | subgroupInclusiveAnd(ballot);
|
| 172 | subgroupInclusiveOr(ballot);
|
| 173 | subgroupInclusiveXor(ballot);
|
| 174 | subgroupExclusiveAdd(f4);
|
| 175 | subgroupExclusiveMul(f4);
|
| 176 | subgroupExclusiveMin(f4);
|
| 177 | subgroupExclusiveMax(f4);
|
| 178 | subgroupExclusiveAnd(ballot);
|
| 179 | subgroupExclusiveOr(ballot);
|
| 180 | subgroupExclusiveXor(ballot);
|
| 181 | }
|
| 182 |
|
| 183 | #extension GL_KHR_shader_subgroup_clustered: enable
|
| 184 | void clustered_works(vec4 f4)
|
| 185 | {
|
| 186 | uvec4 ballot = uvec4(0x55,0,0,0);
|
| 187 | subgroupClusteredAdd(f4, 2);
|
| 188 | subgroupClusteredMul(f4, 2);
|
| 189 | subgroupClusteredMin(f4, 2);
|
| 190 | subgroupClusteredMax(f4, 2);
|
| 191 | subgroupClusteredAnd(ballot, 2);
|
| 192 | subgroupClusteredOr(ballot, 2);
|
| 193 | subgroupClusteredXor(ballot, 2);
|
| 194 | }
|
| 195 |
|
| 196 | #extension GL_KHR_shader_subgroup_quad: enable
|
| 197 | void quad_works(vec4 f4)
|
| 198 | {
|
| 199 | subgroupQuadBroadcast(f4, 0);
|
| 200 | subgroupQuadSwapHorizontal(f4);
|
| 201 | subgroupQuadSwapVertical(f4);
|
| 202 | subgroupQuadSwapDiagonal(f4);
|
| 203 | }
|
| 204 |
|
| 205 | #extension GL_NV_shader_subgroup_partitioned: enable
|
| 206 | void partitioned_works(vec4 f4)
|
| 207 | {
|
| 208 | uvec4 parti = subgroupPartitionNV(f4);
|
| 209 | uvec4 ballot = uvec4(0x55,0,0,0);
|
| 210 | subgroupPartitionedAddNV(f4, parti);
|
| 211 | subgroupPartitionedMulNV(f4, parti);
|
| 212 | subgroupPartitionedMinNV(f4, parti);
|
| 213 | subgroupPartitionedMaxNV(f4, parti);
|
| 214 | subgroupPartitionedAndNV(ballot, parti);
|
| 215 | subgroupPartitionedOrNV(ballot, parti);
|
| 216 | subgroupPartitionedXorNV(ballot, parti);
|
| 217 | subgroupPartitionedInclusiveAddNV(f4, parti);
|
| 218 | subgroupPartitionedInclusiveMulNV(f4, parti);
|
| 219 | subgroupPartitionedInclusiveMinNV(f4, parti);
|
| 220 | subgroupPartitionedInclusiveMaxNV(f4, parti);
|
| 221 | subgroupPartitionedInclusiveAndNV(ballot, parti);
|
| 222 | subgroupPartitionedInclusiveOrNV(ballot, parti);
|
| 223 | subgroupPartitionedInclusiveXorNV(ballot, parti);
|
| 224 | subgroupPartitionedExclusiveAddNV(f4, parti);
|
| 225 | subgroupPartitionedExclusiveMulNV(f4, parti);
|
| 226 | subgroupPartitionedExclusiveMinNV(f4, parti);
|
| 227 | subgroupPartitionedExclusiveMaxNV(f4, parti);
|
| 228 | subgroupPartitionedExclusiveAndNV(ballot, parti);
|
| 229 | subgroupPartitionedExclusiveOrNV(ballot, parti);
|
| 230 | subgroupPartitionedExclusiveXorNV(ballot, parti);
|
| 231 | }
|
| 232 |
|
Daniel Koch | 2cb2f19 | 2019-06-04 08:43:32 -0400 | [diff] [blame] | 233 | // tests for NV_shader_sm_builtins
|
| 234 | void sm_builtins_err()
|
| 235 | {
|
| 236 | gl_WarpsPerSMNV; // ERROR, no extension
|
| 237 | gl_SMCountNV; // ERROR, no extension
|
| 238 | gl_WarpIDNV; // ERROR, no extension
|
| 239 | gl_SMIDNV; // ERROR, no extension
|
| 240 | }
|
| 241 |
|
| 242 | #ifdef GL_NV_shader_sm_builtins
|
| 243 | #extension GL_NV_shader_sm_builtins : enable
|
| 244 | #endif
|
| 245 |
|
| 246 | void sm_builtins()
|
| 247 | {
|
| 248 | gl_WarpsPerSMNV;
|
| 249 | gl_SMCountNV;
|
| 250 | gl_WarpIDNV;
|
| 251 | gl_SMIDNV;
|
| 252 | }
|
| 253 |
|