yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
579d34d5
main
1#version 450 core 2#extension GL_KHR_memory_scope_semantics : enable 3#pragma use_vulkan_memory_model 4 5layout ( local_size_x = 16 , local_size_y = 16 ) in ; 6 7layout ( binding = 0 ) buffer Buffer 8{ 9int datai ; 10float dataf ; 11double datad ; 12} buf ; 13 14shared int atomi ; 15shared float atomf ; 16shared double atomd ; 17 18layout ( binding = 0 , r32f ) volatile coherent uniform image1D fimage1D ; 19layout ( binding = 1 , r32f ) volatile coherent uniform image2D fimage2D ; 20 21void undeclared_errors () 22{ 23//atomicAdd 24float resultf = 0 ; 25resultf = atomicAdd ( atomf , 3.0 ) ; 26resultf = atomicAdd ( atomf , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 27resultf = atomicAdd ( buf . dataf , 3.0 ) ; 28resultf = atomicAdd ( buf . dataf , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 29 30double resultd = 0 ; 31resultd = atomicAdd ( atomd , 3.0 ) ; 32resultd = atomicAdd ( atomd , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 33resultd = atomicAdd ( buf . datad , 3.0 ) ; 34resultd = atomicAdd ( buf . datad , 4.5 , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 35 36//atomicExchange 37resultf = atomicExchange ( buf . dataf , resultf ) ; 38resultf = atomicExchange ( buf . dataf , resultf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 39resultf = atomicExchange ( atomf , resultf ) ; 40resultf = atomicExchange ( atomf , resultf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 41buf . dataf += resultf ; 42 43resultd = atomicExchange ( buf . datad , resultd ) ; 44resultd = atomicExchange ( buf . datad , resultd , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 45resultd = atomicExchange ( atomd , resultd ) ; 46resultd = atomicExchange ( atomd , resultd , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 47buf . datad += resultd ; 48 49//atomic load/store 50resultf = atomicLoad ( buf . dataf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquire ) ; 51atomicStore ( buf . dataf , resultf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsRelease ) ; 52resultf = atomicLoad ( atomf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquire ) ; 53atomicStore ( atomf , resultf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsRelease ) ; 54buf . dataf += resultf ; 55 56resultd = atomicLoad ( buf . datad , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquire ) ; 57atomicStore ( buf . datad , resultd , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsRelease ) ; 58resultd = atomicLoad ( atomd , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquire ) ; 59atomicStore ( atomd , resultd , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsRelease ) ; 60buf . datad += resultd ; 61 62// image atomics: 63atomf = imageAtomicAdd ( fimage2D , ivec2 ( 0 , 0 ) , 2.0 ) ; 64atomf = imageAtomicAdd ( fimage2D , ivec2 ( 1 , 1 ) , 3.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 65atomf = imageAtomicExchange ( fimage2D , ivec2 ( 1 , 0 ) , 4.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 66atomf = imageAtomicLoad ( fimage2D , ivec2 ( 1 , 1 ) , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquire ) ; 67imageAtomicStore ( fimage2D , ivec2 ( 2 , 2 ) , atomf , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsRelease ) ; 68buf . dataf += atomf ; 69} 70 71#extension GL_EXT_shader_atomic_float : enable 72 73void main () 74{ 75float resultf = 0 ; 76double resultd = 0 ; 77int resulti = 0 ; 78 79//atomicAdd 80resultf = atomicAdd ( atomi ) ; 81resultf = atomicAdd ( atomi , 3.0 ) ; 82resultf = atomicAdd ( atomi , resultf , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 83resultf = atomicAdd ( atomi , resultf , gl_ScopeDevice , gl_StorageSemanticsBuffer , gl_SemanticsAcquireRelease ) ; 84 85//atomicExchange 86resultf = atomicExchange ( buf . datai ) ; 87resultf = atomicExchange ( buf . datai , resultf ) ; 88resultf = atomicExchange ( buf . datai , resultf , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 89resultf = atomicExchange ( buf . datai , resultf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 90resultf = atomicExchange ( atomi , resultf ) ; 91resultf = atomicExchange ( atomi , resultf , gl_ScopeDevice , gl_StorageSemanticsShared , gl_SemanticsAcquireRelease ) ; 92buf . dataf += resultf ; 93 94//atomic load/store 95resultf = atomicLoad ( buf . datai , gl_StorageSemanticsShared , gl_SemanticsAcquire ) ; 96atomicStore ( buf . datai , resulti , gl_StorageSemanticsShared , gl_SemanticsRelease ) ; 97 98// image atomics: 99atomf = imageAtomicAdd ( fimage1D , ivec2 ( 0 , 0 ) , 2.0 ) ; 100atomf = imageAtomicAdd ( fimage2D , ivec3 ( 0 , 0 , 0 ) , 2.0 ) ; 101atomf = imageAtomicAdd ( fimage2D , 2.0 ) ; 102atomf = imageAtomicExchange ( fimage1D , ivec2 ( 1 , 0 ) , 4.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 103atomf = imageAtomicExchange ( fimage2D , 4.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 104atomf = imageAtomicExchange ( fimage2D , ivec3 ( 1 , 0 , 1 ) , 4.0 , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquireRelease ) ; 105atomf = imageAtomicLoad ( fimage1D , ivec2 ( 1 , 1 ) , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquire ) ; 106atomf = imageAtomicLoad ( fimage2D , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquire ) ; 107atomf = imageAtomicLoad ( fimage2D , ivec3 ( 1 , 1 , 1 ) , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsAcquire ) ; 108imageAtomicStore ( fimage1D , ivec2 ( 2 , 2 ) , atomf , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsRelease ) ; 109imageAtomicStore ( fimage2D , atomf , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsRelease ) ; 110imageAtomicStore ( fimage2D , ivec3 ( 2 , 2 , 1 ) , atomf , gl_ScopeDevice , gl_StorageSemanticsImage , gl_SemanticsRelease ) ; 111buf . dataf += atomf ; 112}