yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
765cee84
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 (location = 0 )out uvec4 data ; 105void main (void ) 106{ 107data = uvec4 (gl_SubgroupSize ,gl_SubgroupInvocationID ,0 ,0 ); 108subgroupBarrier (); 109subgroupMemoryBarrier (); 110subgroupMemoryBarrierBuffer (); 111subgroupMemoryBarrierImage (); 112subgroupElect (); 113} 114 115#extension GL_KHR_shader_subgroup_ballot : enable 116void ballot_works (vec4 f4 ) { 117int i ; 118gl_SubgroupEqMask ; 119gl_SubgroupGeMask ; 120gl_SubgroupGtMask ; 121gl_SubgroupLeMask ; 122gl_SubgroupLtMask ; 123subgroupBroadcast (f4 ,0 ); 124subgroupBroadcast (f4 ,i ); 125subgroupBroadcastFirst (f4 ); 126uvec4 ballot = subgroupBallot (false); 127subgroupInverseBallot (uvec4 (0x1 )); 128subgroupBallotBitExtract (ballot ,0 ); 129subgroupBallotBitCount (ballot ); 130subgroupBallotInclusiveBitCount (ballot ); 131subgroupBallotExclusiveBitCount (ballot ); 132subgroupBallotFindLSB (ballot ); 133subgroupBallotFindMSB (ballot ); 134} 135 136#extension GL_KHR_shader_subgroup_vote : enable 137void vote_works (vec4 f4 ) 138{ 139subgroupAll (true); 140subgroupAny (false); 141subgroupAllEqual (f4 ); 142} 143 144#extension GL_KHR_shader_subgroup_shuffle : enable 145#extension GL_KHR_shader_subgroup_shuffle_relative : enable 146void shuffle_works (vec4 f4 ) 147{ 148subgroupShuffle (f4 ,0 ); 149subgroupShuffleXor (f4 ,0x1 ); 150subgroupShuffleUp (f4 ,1 ); 151subgroupShuffleDown (f4 ,1 ); 152} 153 154#extension GL_KHR_shader_subgroup_arithmetic : enable 155void arith_works (vec4 f4 ) 156{ 157uvec4 ballot ; 158subgroupAdd (f4 ); 159subgroupMul (f4 ); 160subgroupMin (f4 ); 161subgroupMax (f4 ); 162subgroupAnd (ballot ); 163subgroupOr (ballot ); 164subgroupXor (ballot ); 165subgroupInclusiveAdd (f4 ); 166subgroupInclusiveMul (f4 ); 167subgroupInclusiveMin (f4 ); 168subgroupInclusiveMax (f4 ); 169subgroupInclusiveAnd (ballot ); 170subgroupInclusiveOr (ballot ); 171subgroupInclusiveXor (ballot ); 172subgroupExclusiveAdd (f4 ); 173subgroupExclusiveMul (f4 ); 174subgroupExclusiveMin (f4 ); 175subgroupExclusiveMax (f4 ); 176subgroupExclusiveAnd (ballot ); 177subgroupExclusiveOr (ballot ); 178subgroupExclusiveXor (ballot ); 179} 180 181#extension GL_KHR_shader_subgroup_clustered : enable 182void clustered_works (vec4 f4 ) 183{ 184uvec4 ballot = uvec4 (0x55 ,0 ,0 ,0 ); 185subgroupClusteredAdd (f4 ,2 ); 186subgroupClusteredMul (f4 ,2 ); 187subgroupClusteredMin (f4 ,2 ); 188subgroupClusteredMax (f4 ,2 ); 189subgroupClusteredAnd (ballot ,2 ); 190subgroupClusteredOr (ballot ,2 ); 191subgroupClusteredXor (ballot ,2 ); 192} 193 194#extension GL_KHR_shader_subgroup_quad : enable 195void quad_works (vec4 f4 ) 196{ 197int i ; 198subgroupQuadBroadcast (f4 ,0 ); 199subgroupQuadBroadcast (f4 ,i ); 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}