Daniel Koch | c3e60ad | 2019-05-30 19:40:20 -0400 | [diff] [blame] | 1 | #version 460 |
| 2 | #extension GL_NV_ray_tracing : enable |
| 3 | |
| 4 | vec4 undeclared_errors(vec4 f4) |
| 5 | { |
| 6 | vec4 result; |
| 7 | gl_SubgroupSize; // ERROR, extension not enabled (basic) |
| 8 | gl_SubgroupInvocationID; // ERROR, extension not enabled (basic) |
| 9 | subgroupBarrier(); // ERROR, extension not enabled (basic) |
| 10 | subgroupMemoryBarrier(); // ERROR, extension not enabled (basic) |
| 11 | subgroupMemoryBarrierBuffer(); // ERROR, extension not enabled (basic) |
| 12 | subgroupMemoryBarrierImage(); // ERROR, extension not enabled (basic) |
| 13 | subgroupElect(); // ERROR, extension not enabled (basic) |
| 14 | gl_NumSubgroups; // ERROR, only defined in compute |
| 15 | gl_SubgroupID; // ERROR, only defined in compute |
| 16 | subgroupMemoryBarrierShared(); // ERROR, only defined in compute |
| 17 | |
| 18 | subgroupAll(true); // ERROR extension not enabled (vote) |
| 19 | subgroupAny(false); // ERROR extension not enabled (vote) |
| 20 | subgroupAllEqual(f4); // ERROR extension not enabled (vote) |
| 21 | |
| 22 | gl_SubgroupEqMask; // ERROR extension not enabled (ballot) |
| 23 | gl_SubgroupGeMask; // ERROR extension not enabled (ballot) |
| 24 | gl_SubgroupGtMask; // ERROR extension not enabled (ballot) |
| 25 | gl_SubgroupLeMask; // ERROR extension not enabled (ballot) |
| 26 | gl_SubgroupLtMask; // ERROR extension not enabled (ballot) |
| 27 | subgroupBroadcast(f4, 0); // ERROR extension not enabled (ballot) |
| 28 | subgroupBroadcastFirst(f4); // ERROR extension not enabled (ballot) |
| 29 | uvec4 ballot = subgroupBallot(false); // ERROR extension not enabled (ballot) |
| 30 | subgroupInverseBallot(uvec4(0x1)); // ERROR extension not enabled (ballot) |
| 31 | subgroupBallotBitExtract(ballot, 0); // ERROR extension not enabled (ballot) |
| 32 | subgroupBallotBitCount(ballot); // ERROR extension not enabled (ballot) |
| 33 | subgroupBallotInclusiveBitCount(ballot); // ERROR extension not enabled (ballot) |
| 34 | subgroupBallotExclusiveBitCount(ballot); // ERROR extension not enabled (ballot) |
| 35 | subgroupBallotFindLSB(ballot); // ERROR extension not enabled (ballot) |
| 36 | subgroupBallotFindMSB(ballot); // ERROR extension not enabled (ballot) |
| 37 | |
| 38 | subgroupShuffle(f4, 0); // ERROR extension not enabled (shuffle) |
| 39 | subgroupShuffleXor(f4, 0x1); // ERROR extension not enabled (shuffle) |
| 40 | subgroupShuffleUp(f4, 1); // ERROR extension not enabled (shuffle_relative) |
| 41 | subgroupShuffleDown(f4, 1); // ERROR extension not enabled (shuffle_relative) |
| 42 | |
| 43 | result = subgroupAdd(f4); // ERROR, extension not enabled (arith) |
| 44 | subgroupMul(f4); // ERROR, extension not enabled (arith) |
| 45 | subgroupMin(f4); // ERROR, extension not enabled (arith) |
| 46 | subgroupMax(f4); // ERROR, extension not enabled (arith) |
| 47 | subgroupAnd(ballot); // ERROR, extension not enabled (arith) |
| 48 | subgroupOr(ballot); // ERROR, extension not enabled (arith) |
| 49 | subgroupXor(ballot); // ERROR, extension not enabled (arith) |
| 50 | subgroupInclusiveAdd(f4); // ERROR, extension not enabled (arith) |
| 51 | subgroupInclusiveMul(f4); // ERROR, extension not enabled (arith) |
| 52 | subgroupInclusiveMin(f4); // ERROR, extension not enabled (arith) |
| 53 | subgroupInclusiveMax(f4); // ERROR, extension not enabled (arith) |
| 54 | subgroupInclusiveAnd(ballot); // ERROR, extension not enabled (arith) |
| 55 | subgroupInclusiveOr(ballot); // ERROR, extension not enabled (arith) |
| 56 | subgroupInclusiveXor(ballot); // ERROR, extension not enabled (arith) |
| 57 | subgroupExclusiveAdd(f4); // ERROR, extension not enabled (arith) |
| 58 | subgroupExclusiveMul(f4); // ERROR, extension not enabled (arith) |
| 59 | subgroupExclusiveMin(f4); // ERROR, extension not enabled (arith) |
| 60 | subgroupExclusiveMax(f4); // ERROR, extension not enabled (arith) |
| 61 | subgroupExclusiveAnd(ballot); // ERROR, extension not enabled (arith) |
| 62 | subgroupExclusiveOr(ballot); // ERROR, extension not enabled (arith) |
| 63 | subgroupExclusiveXor(ballot); // ERROR, extension not enabled (arith) |
| 64 | |
| 65 | subgroupClusteredAdd(f4, 2); // ERROR, extension not enabled (clustered) |
| 66 | subgroupClusteredMul(f4, 2); // ERROR, extension not enabled (clustered) |
| 67 | subgroupClusteredMin(f4, 2); // ERROR, extension not enabled (clustered) |
| 68 | subgroupClusteredMax(f4, 2); // ERROR, extension not enabled (clustered) |
| 69 | subgroupClusteredAnd(ballot, 2); // ERROR, extension not enabled (clustered) |
| 70 | subgroupClusteredOr(ballot, 2); // ERROR, extension not enabled (clustered) |
| 71 | subgroupClusteredXor(ballot, 2); // ERROR, extension not enabled (clustered) |
| 72 | |
| 73 | subgroupQuadBroadcast(f4, 0); // ERROR, extension not enabled (quad) |
| 74 | subgroupQuadSwapHorizontal(f4); // ERROR, extension not enabled (quad) |
| 75 | subgroupQuadSwapVertical(f4); // ERROR, extension not enabled (quad) |
| 76 | subgroupQuadSwapDiagonal(f4); // ERROR, extension not enabled (quad) |
| 77 | |
| 78 | uvec4 parti = subgroupPartitionNV(f4); // ERROR, extension not enabled (partitioned) |
| 79 | subgroupPartitionedAddNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 80 | subgroupPartitionedMulNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 81 | subgroupPartitionedMinNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 82 | subgroupPartitionedMaxNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 83 | subgroupPartitionedAndNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 84 | subgroupPartitionedOrNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 85 | subgroupPartitionedXorNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 86 | subgroupPartitionedInclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 87 | subgroupPartitionedInclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 88 | subgroupPartitionedInclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 89 | subgroupPartitionedInclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 90 | subgroupPartitionedInclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 91 | subgroupPartitionedInclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 92 | subgroupPartitionedInclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 93 | subgroupPartitionedExclusiveAddNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 94 | subgroupPartitionedExclusiveMulNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 95 | subgroupPartitionedExclusiveMinNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 96 | subgroupPartitionedExclusiveMaxNV(f4, parti); // ERROR, extension not enabled (partitioned) |
| 97 | subgroupPartitionedExclusiveAndNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 98 | subgroupPartitionedExclusiveOrNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 99 | subgroupPartitionedExclusiveXorNV(ballot, parti); // ERROR, extension not enabled (partitioned) |
| 100 | |
| 101 | return result; |
| 102 | } |
| 103 | |
| 104 | |
| 105 | layout(location = 1) rayPayloadInNV vec4 incomingPayload; |
| 106 | void main() |
| 107 | { |
| 108 | uvec3 v0 = gl_LaunchIDNV; |
| 109 | uvec3 v1 = gl_LaunchSizeNV; |
| 110 | int v2 = gl_PrimitiveID; |
| 111 | int v3 = gl_InstanceID; |
| 112 | int v4 = gl_InstanceCustomIndexNV; |
| 113 | vec3 v5 = gl_WorldRayOriginNV; |
| 114 | vec3 v6 = gl_WorldRayDirectionNV; |
| 115 | vec3 v7 = gl_ObjectRayOriginNV; |
| 116 | vec3 v8 = gl_ObjectRayDirectionNV; |
| 117 | float v9 = gl_RayTminNV; |
| 118 | float v10 = gl_RayTmaxNV; |
| 119 | float v11 = gl_HitTNV; |
| 120 | uint v12 = gl_HitKindNV; |
| 121 | mat4x3 v13 = gl_ObjectToWorldNV; |
| 122 | mat4x3 v14 = gl_WorldToObjectNV; |
| 123 | incomingPayload = vec4(0.5f); |
| 124 | if (v2 == 1) |
| 125 | ignoreIntersectionNV(); |
| 126 | else |
| 127 | terminateRayNV(); |
| 128 | } |
| 129 | |
| 130 | #extension GL_KHR_shader_subgroup_basic: enable |
| 131 | void basic_works (void) |
| 132 | { |
| 133 | gl_SubgroupSize; |
| 134 | gl_SubgroupInvocationID; |
| 135 | subgroupBarrier(); |
| 136 | subgroupMemoryBarrier(); |
| 137 | subgroupMemoryBarrierBuffer(); |
| 138 | subgroupMemoryBarrierImage(); |
| 139 | subgroupElect(); |
| 140 | } |
| 141 | |
| 142 | #extension GL_KHR_shader_subgroup_ballot: enable |
| 143 | void ballot_works(vec4 f4) { |
| 144 | gl_SubgroupEqMask; |
| 145 | gl_SubgroupGeMask; |
| 146 | gl_SubgroupGtMask; |
| 147 | gl_SubgroupLeMask; |
| 148 | gl_SubgroupLtMask; |
| 149 | subgroupBroadcast(f4, 0); |
| 150 | subgroupBroadcastFirst(f4); |
| 151 | uvec4 ballot = subgroupBallot(false); |
| 152 | subgroupInverseBallot(uvec4(0x1)); |
| 153 | subgroupBallotBitExtract(ballot, 0); |
| 154 | subgroupBallotBitCount(ballot); |
| 155 | subgroupBallotInclusiveBitCount(ballot); |
| 156 | subgroupBallotExclusiveBitCount(ballot); |
| 157 | subgroupBallotFindLSB(ballot); |
| 158 | subgroupBallotFindMSB(ballot); |
| 159 | } |
| 160 | |
| 161 | #extension GL_KHR_shader_subgroup_vote: enable |
| 162 | void vote_works(vec4 f4) |
| 163 | { |
| 164 | subgroupAll(true); |
| 165 | subgroupAny(false); |
| 166 | subgroupAllEqual(f4); |
| 167 | } |
| 168 | |
| 169 | #extension GL_KHR_shader_subgroup_shuffle: enable |
| 170 | #extension GL_KHR_shader_subgroup_shuffle_relative: enable |
| 171 | void shuffle_works(vec4 f4) |
| 172 | { |
| 173 | subgroupShuffle(f4, 0); |
| 174 | subgroupShuffleXor(f4, 0x1); |
| 175 | subgroupShuffleUp(f4, 1); |
| 176 | subgroupShuffleDown(f4, 1); |
| 177 | } |
| 178 | |
| 179 | #extension GL_KHR_shader_subgroup_arithmetic: enable |
| 180 | void arith_works(vec4 f4) |
| 181 | { |
| 182 | uvec4 ballot; |
| 183 | subgroupAdd(f4); |
| 184 | subgroupMul(f4); |
| 185 | subgroupMin(f4); |
| 186 | subgroupMax(f4); |
| 187 | subgroupAnd(ballot); |
| 188 | subgroupOr(ballot); |
| 189 | subgroupXor(ballot); |
| 190 | subgroupInclusiveAdd(f4); |
| 191 | subgroupInclusiveMul(f4); |
| 192 | subgroupInclusiveMin(f4); |
| 193 | subgroupInclusiveMax(f4); |
| 194 | subgroupInclusiveAnd(ballot); |
| 195 | subgroupInclusiveOr(ballot); |
| 196 | subgroupInclusiveXor(ballot); |
| 197 | subgroupExclusiveAdd(f4); |
| 198 | subgroupExclusiveMul(f4); |
| 199 | subgroupExclusiveMin(f4); |
| 200 | subgroupExclusiveMax(f4); |
| 201 | subgroupExclusiveAnd(ballot); |
| 202 | subgroupExclusiveOr(ballot); |
| 203 | subgroupExclusiveXor(ballot); |
| 204 | } |
| 205 | |
| 206 | #extension GL_KHR_shader_subgroup_clustered: enable |
| 207 | void clustered_works(vec4 f4) |
| 208 | { |
| 209 | uvec4 ballot = uvec4(0x55,0,0,0); |
| 210 | subgroupClusteredAdd(f4, 2); |
| 211 | subgroupClusteredMul(f4, 2); |
| 212 | subgroupClusteredMin(f4, 2); |
| 213 | subgroupClusteredMax(f4, 2); |
| 214 | subgroupClusteredAnd(ballot, 2); |
| 215 | subgroupClusteredOr(ballot, 2); |
| 216 | subgroupClusteredXor(ballot, 2); |
| 217 | } |
| 218 | |
| 219 | #extension GL_KHR_shader_subgroup_quad: enable |
| 220 | void quad_works(vec4 f4) |
| 221 | { |
| 222 | subgroupQuadBroadcast(f4, 0); |
| 223 | subgroupQuadSwapHorizontal(f4); |
| 224 | subgroupQuadSwapVertical(f4); |
| 225 | subgroupQuadSwapDiagonal(f4); |
| 226 | } |
| 227 | |
| 228 | #extension GL_NV_shader_subgroup_partitioned: enable |
| 229 | void partitioned_works(vec4 f4) |
| 230 | { |
| 231 | uvec4 parti = subgroupPartitionNV(f4); |
| 232 | uvec4 ballot = uvec4(0x55,0,0,0); |
| 233 | subgroupPartitionedAddNV(f4, parti); |
| 234 | subgroupPartitionedMulNV(f4, parti); |
| 235 | subgroupPartitionedMinNV(f4, parti); |
| 236 | subgroupPartitionedMaxNV(f4, parti); |
| 237 | subgroupPartitionedAndNV(ballot, parti); |
| 238 | subgroupPartitionedOrNV(ballot, parti); |
| 239 | subgroupPartitionedXorNV(ballot, parti); |
| 240 | subgroupPartitionedInclusiveAddNV(f4, parti); |
| 241 | subgroupPartitionedInclusiveMulNV(f4, parti); |
| 242 | subgroupPartitionedInclusiveMinNV(f4, parti); |
| 243 | subgroupPartitionedInclusiveMaxNV(f4, parti); |
| 244 | subgroupPartitionedInclusiveAndNV(ballot, parti); |
| 245 | subgroupPartitionedInclusiveOrNV(ballot, parti); |
| 246 | subgroupPartitionedInclusiveXorNV(ballot, parti); |
| 247 | subgroupPartitionedExclusiveAddNV(f4, parti); |
| 248 | subgroupPartitionedExclusiveMulNV(f4, parti); |
| 249 | subgroupPartitionedExclusiveMinNV(f4, parti); |
| 250 | subgroupPartitionedExclusiveMaxNV(f4, parti); |
| 251 | subgroupPartitionedExclusiveAndNV(ballot, parti); |
| 252 | subgroupPartitionedExclusiveOrNV(ballot, parti); |
| 253 | subgroupPartitionedExclusiveXorNV(ballot, parti); |
| 254 | } |
| 255 | |