yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
579d34d5
16.3.0
1#version 450 core 2 3#extension GL_KHR_memory_scope_semantics : enable 4#extension GL_EXT_shader_explicit_arithmetic_types_float16 : enable 5#extension GL_EXT_shader_atomic_float2 : enable 6#pragma use_vulkan_memory_model 7 8layout ( local_size_x = 16 , local_size_y = 16 ) in ; 9 10layout ( binding = 0 ) buffer Buffer 11{ 12float16_t datah ; 13float dataf ; 14double datad ; 15} buf ; 16 17shared float16_t atomh ; 18shared float atomf ; 19shared double atomd ; 20 21layout ( binding = 0 , r32f ) volatile coherent uniform image1D fimage1D ; 22layout ( binding = 1 , r32f ) volatile coherent uniform image1DArray fimage1DArray ; 23layout ( binding = 2 , r32f ) volatile coherent uniform image2D fimage2D ; 24layout ( binding = 3 , r32f ) volatile coherent uniform image2DArray fimage2DArray ; 25layout ( binding = 4 , r32f ) volatile coherent uniform image2DRect fimage2DRect ; 26layout ( binding = 5 , r32f ) volatile coherent uniform imageCube fimageCube ; 27layout ( binding = 6 , r32f ) volatile coherent uniform imageCubeArray fimageCubeArray ; 28layout ( binding = 9 , r32f ) volatile coherent uniform image3D fimage3D ; 29 30void main () 31{ 32//atomicAdd 33float16_t resulth = float16_t ( 0.0 ) ; 34resulth = atomicAdd ( atomh , float16_t ( 3.0 )) ; 35resulth = atomicAdd ( atomh , float16_t ( 4.5 ) , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 36resulth = atomicAdd ( buf . datah , float16_t ( 3.0 )) ; 37resulth = atomicAdd ( buf . datah , float16_t ( 4.5 ) , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 38 39//atomicMin 40resulth = atomicMin ( atomh , float16_t ( 3.0 )) ; 41resulth = atomicMin ( atomh , float16_t ( 4.5 ) , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 42resulth = atomicMin ( buf . datah , float16_t ( 3.0 )) ; 43resulth = atomicMin ( buf . datah , float16_t ( 4.5 ) , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 44 45float resultf = 0.0 ; 46resultf = atomicMin ( atomf , 3.0 ) ; 47resultf = atomicMin ( atomf , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 48resultf = atomicMin ( buf . dataf , 3.0 ) ; 49resultf = atomicMin ( buf . dataf , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 50 51double resultd = 0.0 ; 52resultd = atomicMin ( atomd , 3.0 ) ; 53resultd = atomicMin ( atomd , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 54resultd = atomicMin ( buf . datad , 3.0 ) ; 55resultd = atomicMin ( buf . datad , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 56 57//atomicMax 58resulth = atomicMax ( atomh , float16_t ( 3.0 )) ; 59resulth = atomicMax ( atomh , float16_t ( 4.5 ) , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 60resulth = atomicMax ( buf . datah , float16_t ( 3.0 )) ; 61resulth = atomicMax ( buf . datah , float16_t ( 4.5 ) , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 62 63resultf = atomicMax ( atomf , 3.0 ) ; 64resultf = atomicMax ( atomf , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 65resultf = atomicMax ( buf . dataf , 3.0 ) ; 66resultf = atomicMax ( buf . dataf , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 67 68resultd = atomicMax ( atomd , 3.0 ) ; 69resultd = atomicMax ( atomd , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 70resultd = atomicMax ( buf . datad , 3.0 ) ; 71resultd = atomicMax ( buf . datad , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 72 73//atomicExchange 74resulth = atomicExchange ( buf . datah , resulth ) ; 75buf . datah += resulth ; 76resulth = atomicExchange ( buf . datah , resulth , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 77buf . datah += resulth ; 78resulth = atomicExchange ( atomh , resulth ) ; 79buf . datah += resulth ; 80resulth = atomicExchange ( atomh , resulth , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 81buf . datah += resulth ; 82 83//atomic load/store 84resulth = atomicLoad ( buf . datah , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquire ) ; 85atomicStore ( buf . datah , resulth , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsRelease ) ; 86buf . datah += resulth ; 87 88resulth = atomicLoad ( atomh , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquire ) ; 89atomicStore ( atomh , resulth , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsRelease ) ; 90buf . datah += resulth ; 91 92// image atomics on 1D: 93atomf = imageAtomicMin ( fimage1D , int ( 0 ) , 2.0 ) ; 94buf . dataf += atomf ; 95atomf = imageAtomicMin ( fimage1D , int ( 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 96buf . dataf += atomf ; 97 98atomf = imageAtomicMax ( fimage1D , int ( 0 ) , 2.0 ) ; 99buf . dataf += atomf ; 100atomf = imageAtomicMax ( fimage1D , int ( 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 101buf . dataf += atomf ; 102 103// image atomics on 1D Array: 104atomf = imageAtomicMin ( fimage1DArray , ivec2 ( 0 , 0 ) , 2.0 ) ; 105buf . dataf += atomf ; 106atomf = imageAtomicMin ( fimage1DArray , ivec2 ( 1 , 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 107buf . dataf += atomf ; 108 109atomf = imageAtomicMax ( fimage1DArray , ivec2 ( 0 , 0 ) , 2.0 ) ; 110buf . dataf += atomf ; 111atomf = imageAtomicMax ( fimage1DArray , ivec2 ( 1 , 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 112buf . dataf += atomf ; 113 114// image atomics on 2D: 115atomf = imageAtomicMin ( fimage2D , ivec2 ( 0 , 0 ) , 2.0 ) ; 116buf . dataf += atomf ; 117atomf = imageAtomicMin ( fimage2D , ivec2 ( 1 , 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 118buf . dataf += atomf ; 119 120atomf = imageAtomicMax ( fimage2D , ivec2 ( 0 , 0 ) , 2.0 ) ; 121buf . dataf += atomf ; 122atomf = imageAtomicMax ( fimage2D , ivec2 ( 1 , 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 123buf . dataf += atomf ; 124 125// image atomics on 2D Rect: 126atomf = imageAtomicMin ( fimage2DRect , ivec2 ( 0 , 0 ) , 2.0 ) ; 127buf . dataf += atomf ; 128atomf = imageAtomicMin ( fimage2DRect , ivec2 ( 1 , 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 129buf . dataf += atomf ; 130 131atomf = imageAtomicMax ( fimage2DRect , ivec2 ( 0 , 0 ) , 2.0 ) ; 132buf . dataf += atomf ; 133atomf = imageAtomicMax ( fimage2DRect , ivec2 ( 1 , 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 134buf . dataf += atomf ; 135 136// image atomics on 2D Array: 137atomf = imageAtomicMin ( fimage2DArray , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 138buf . dataf += atomf ; 139atomf = imageAtomicMin ( fimage2DArray , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 140buf . dataf += atomf ; 141 142atomf = imageAtomicMax ( fimage2DArray , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 143buf . dataf += atomf ; 144atomf = imageAtomicMax ( fimage2DArray , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 145buf . dataf += atomf ; 146 147// image atomics on Cube: 148atomf = imageAtomicMin ( fimageCube , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 149buf . dataf += atomf ; 150atomf = imageAtomicMin ( fimageCube , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 151buf . dataf += atomf ; 152 153atomf = imageAtomicMax ( fimageCube , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 154buf . dataf += atomf ; 155atomf = imageAtomicMax ( fimageCube , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 156buf . dataf += atomf ; 157 158// image atomics on Cube Array: 159atomf = imageAtomicMin ( fimageCubeArray , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 160buf . dataf += atomf ; 161atomf = imageAtomicMin ( fimageCubeArray , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 162buf . dataf += atomf ; 163 164atomf = imageAtomicMax ( fimageCubeArray , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 165buf . dataf += atomf ; 166atomf = imageAtomicMax ( fimageCubeArray , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 167buf . dataf += atomf ; 168 169// image atomics on 3D: 170atomf = imageAtomicMin ( fimage3D , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 171buf . dataf += atomf ; 172atomf = imageAtomicMin ( fimage3D , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 173buf . dataf += atomf ; 174 175atomf = imageAtomicMax ( fimage3D , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 176buf . dataf += atomf ; 177atomf = imageAtomicMax ( fimage3D , ivec3 ( 1 , 1 , 0 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 178buf . dataf += atomf ; 179}