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