yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
c59b876c
main
1#version 460 2 3out vec4 o ; 4 5// default uniforms will be gathered into a uniform block 6uniform vec4 a ; 7uniform vec2 b = vec2 (0 ,0 );// initializer will be ignored 8layout (location = 0 )uniform vec2 c ;// location qualifier will be ignored 9uniform vec4 d [10 ]; 10 11struct SamplerArray { 12sampler2D tn [4 ]; 13}; 14 15uniform struct e { 16vec2 x ; 17float y ; 18uint z ; 19sampler2D t0 ; 20SamplerArray samplers ; 21}structUniform ; 22 23// opaque types will not be grouped into uniform block 24uniform sampler2D t1 ; 25 26// shared and packed layout qualifier are silently ignored 27layout (shared )uniform UniformBlock { 28float j ; 29vec4 k ; 30}; 31 32layout (packed )buffer BufferBlock { 33float j ; 34vec4 k ; 35}bufferInstance ; 36 37// atomic_uint will be converted to uint and gathered in a buffer block 38layout (binding = 0 )uniform atomic_uint counter1 ;// offset not used 39layout (binding = 0 )uniform atomic_uint counter2 ;// offset not used 40layout (binding = 1 )uniform atomic_uint counter3 ;// offset not used 41 42// atomic counter functions will be converted to equivalent integer atomic operations 43uint bar () { 44uint j = 0 ; 45j = atomicCounterIncrement (counter1 ); 46j = atomicCounterDecrement (counter1 ); 47j = atomicCounter (counter1 ); 48 49j = atomicCounterAdd (counter1 ,1 ); 50j = atomicCounterAdd (counter1 ,-1 ); 51j = atomicCounterSubtract (counter1 ,1 ); 52 53j = atomicCounterMin (counter1 ,j ); 54j = atomicCounterMax (counter1 ,j ); 55j = atomicCounterAnd (counter1 ,j ); 56 57j = atomicCounterOr (counter1 ,j ); 58j = atomicCounterXor (counter1 ,j ); 59 60j = atomicCounterExchange (counter1 ,j ); 61j = atomicCounterCompSwap (counter1 ,0 ,j ); 62 63atomicCounterIncrement (counter2 ); 64atomicCounterIncrement (counter3 ); 65 66memoryBarrierAtomicCounter (); 67 68return j ; 69} 70 71vec4 foo () { 72float f = j + bufferInstance .j + structUniform .y + structUniform .z ; 73vec2 v2 = b + c + structUniform .x ; 74vec4 v4 = a + d [0 ]+ d [1 ]+ d [2 ]+ k + bufferInstance .k + texture (t1 ,vec2 (0 ,0 ))+ texture (structUniform .t0 ,vec2 (0 ,0 )); 75return vec4 (f )* vec4 (v2 ,1 ,1 )* v4 ; 76} 77 78vec4 baz (SamplerArray samplers ) { 79return texture (samplers .tn [0 ],vec2 (0 ,0 ))+ texture (samplers .tn [1 ],vec2 (0 ,0 ))+ texture (samplers .tn [2 ],vec2 (0 ,0 ))+ texture (samplers .tn [3 ],vec2 (0 ,0 )); 80} 81 82void main () { 83float j = float (bar ()); 84o = j * foo ()+ baz (structUniform .samplers ); 85}