yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
091b9fd9
16.6.0
1#version 400 core 2 3in vec2 c2D ; 4flat in int i ; 5out vec4 outp ; 6uniform sampler2D arrayedSampler [ 5 ] ; 7uniform usampler2DRect samp2dr ; 8uniform isampler2DArray isamp2DA ; 9 10#extension GL_ARB_shader_storage_buffer_object : enable 11 12buffer Buffer 13{ 14int atomi ; 15uint atomu ; 16} ; 17 18void atomicOpPass () 19{ 20int origi = atomicAdd ( atomi , 3 ) ; 21uint origu = atomicAnd ( atomu , 7u ) ; 22origi = atomicExchange ( atomi , 4 ) ; 23origu = atomicCompSwap ( atomu , 10u , 8u ) ; 24} 25 26buffer ssboElem01 27{ 28int member01 ; 29int memberArr01 [ 2 ] ; 30int memberUnsizedArr01 [] ; 31} ssboStd430Arr [ 2 ] ; 32 33// if turns on EShReflectionSharedStd140SSBO, SPIR-V would be different 34buffer ssboElem02 35{ 36int member02 ; 37int memberArr02 [ 2 ] ; 38int memberUnsizedArr02 [] ; 39} ssboSharedArr [ 2 ] ; 40 41#extension GL_ARB_shader_storage_buffer_object : disable 42 43void main () 44{ 45vec4 v ; 46v = texture ( arrayedSampler [ i ] , c2D ) ; 47outp . x = gl_ClipDistance [ 1 ] ; 48 49ivec2 offsets [ 4 ] ; 50const ivec2 constOffsets [ 4 ] = ivec2 [ 4 ]( ivec2 ( 1 , 2 ) , ivec2 ( 3 , 4 ) , ivec2 ( 15 , 16 ) , ivec2 ( - 2 , 0 )) ; 51uvec4 uv4 = textureGatherOffsets ( samp2dr , c2D , offsets , 2 ) ; // ERROR, offsets not constant 52uv4 = textureGatherOffsets ( samp2dr , c2D , constOffsets , 2 ) ; 53vec4 v4 = textureGather ( arrayedSampler [ 0 ] , c2D ) ; 54ivec4 iv4 = textureGatherOffset ( isamp2DA , vec3 ( 0.1 ) , ivec2 ( 1 ) , 3 ) ; 55iv4 = textureGatherOffset ( isamp2DA , vec3 ( 0.1 ) , ivec2 ( 1 ) , i ) ; // ERROR, last argument not const 56iv4 = textureGatherOffset ( isamp2DA , vec3 ( 0.1 ) , ivec2 ( 1 ) , 4 ) ; // ERROR, last argument out of range 57iv4 = textureGatherOffset ( isamp2DA , vec3 ( 0.1 ) , ivec2 ( 1 ) , 1 + 2 ) ; 58iv4 = textureGatherOffset ( isamp2DA , vec3 ( 0.1 ) , ivec2 ( i )) ; 59 60vec4 c = gl_FragCoord ; 61} 62 63layout ( location = 4 ) in vec4 vl ; // ERROR, not supported 64 65#ifdef GL_ARB_separate_shader_objects 66#extension GL_ARB_separate_shader_objects : enable 67#endif 68 69layout ( location = 6 ) in vec4 vl2 ; 70 71layout ( location = 3 ) uniform vec3 uv3 ; 72 73layout ( location = 5 ) in vec4 gl_Color ; // ERROR, layout 74noperspective in float gl_ClipDistance [ 4 ] ; // ERROR, can't change qualifier 75 76layout ( origin_upper_left , pixel_center_integer ) in vec4 gl_FragCoord ; // ERROR, declared after use 77 78uniform sampler2DRectShadow u2drs ; 79 80void foo23 () 81{ 82const ivec2 [ 3 ] offsets = ivec2 [ 3 ]( ivec2 ( 1 , 2 ) , ivec2 ( 3 , 4 ) , ivec2 ( 15 , 16 )) ; 83 84textureProjGradOffset ( u2drs , outp , vec2 ( 0.0 ) , vec2 ( 0.0 ) , ivec2 ( c2D )) ; // ERROR, offset not constant 85textureProjGradOffset ( u2drs , outp , vec2 ( 0.0 ) , vec2 ( 0.0 ) , offsets [ 1 ]) ; 86textureProjGradOffset ( u2drs , outp , vec2 ( 0.0 ) , vec2 ( 0.0 ) , offsets [ 2 ]) ; // ERROR, offset out of range 87textureProjGradOffset ( u2drs , outp , vec2 ( 0.0 ) , vec2 ( 0.0 ) , ivec2 ( - 10 , 20 )) ; // ERROR, offset out of range 88} 89 90patch in vec4 patchIn ; // ERROR 91patch out vec4 patchOut ; // ERROR 92 93void foo24 () 94{ 95dvec3 df , di ; 96df = modf ( dvec3 ( outp . xyz ) , di ) ; 97} 98 99in float in1 ; 100in vec2 in2 ; 101in vec3 in3 ; 102in vec4 in4 ; 103 104void foodc1 () 105{ 106vec2 v2 = dFdxFine ( in2 ) ; // ERROR 107vec3 v3 = dFdyCoarse ( in3 ) ; // ERROR 108vec4 v4 = fwidthCoarse ( in4 ) + fwidthFine ( in4 ) ; // ERROR 109} 110 111#extension GL_ARB_derivative_control : enable 112 113void foodc2 () 114{ 115vec2 v2 = dFdxFine ( in2 ) ; 116vec3 v3 = dFdyCoarse ( in3 ) ; 117vec4 v4 = fwidthCoarse ( in4 ) + fwidthFine ( in4 ) ; 118 119uint u1 ; 120ivec3 i3 ; 121ivec2 i2 ; 122v2 = frexp ( v2 , i2 ) ; 123v3 = ldexp ( v3 , i3 ) ; 124 125u1 = packUnorm4x8 ( v4 ) ; 126u1 = packSnorm4x8 ( v4 ) ; 127v4 = unpackUnorm4x8 ( u1 ) ; 128v4 = unpackSnorm4x8 ( u1 ) ; 129 130double d ; 131uvec2 u2 ; 132d = packDouble2x32 ( u2 ) ; 133u2 = unpackDouble2x32 ( d ) ; 134} 135 136sample in vec4 colorSampIn ; 137sample out vec4 colorSampleBad ; // ERROR 138noperspective in vec4 colorfsi ; 139sample in vec3 sampInArray [ 4 ] ; 140smooth in float scalarIn ; 141flat centroid in vec2 colorfc ; 142 143struct S { 144float x ; 145} ; 146 147in S s1 ; 148sample S s2 ; 149 150void interp () 151{ 152interpolateAtCentroid ( colorfc ) ; 153interpolateAtCentroid ( colorSampIn ) ; 154interpolateAtCentroid ( colorfsi ) ; 155interpolateAtCentroid ( scalarIn ) ; 156interpolateAtCentroid ( sampInArray ) ; // ERROR 157interpolateAtCentroid ( sampInArray [ 2 ]) ; 158interpolateAtCentroid ( sampInArray [ 2 ] . xy ) ; // ERROR 159 160interpolateAtSample ( sampInArray , 1 ) ; // ERROR 161interpolateAtSample ( sampInArray [ i ] , 0 ) ; 162interpolateAtSample ( s1 . x , 2 ) ; 163interpolateAtSample ( scalarIn , 1 ) ; 164 165interpolateAtOffset ( sampInArray , vec2 ( 0.2 )) ; // ERROR 166interpolateAtOffset ( sampInArray [ 2 ] , vec2 ( 0.2 )) ; 167interpolateAtOffset ( sampInArray [ 2 ] . xy , vec2 ( 0.2 )) ; // ERROR, no swizzle 168interpolateAtOffset ( scalarIn + scalarIn , vec2 ( 0.2 )) ; // ERROR, no binary ops other than dereference 169interpolateAtOffset ( s2 . x , vec2 ( 0.2 )) ; // ERROR 170 171float f ; 172interpolateAtCentroid ( f ) ; // ERROR, not interpolant 173interpolateAtSample ( outp , 0 ) ; // ERROR, not interpolant 174} 175 176uniform sampler1D samp1D ; 177uniform isampler2D isamp2D ; 178uniform usampler3D usamp3D ; 179uniform samplerCube sampCube ; 180uniform isampler1DArray isamp1DA ; 181uniform usampler2DArray usamp2DA ; 182uniform isamplerCubeArray isampCubeA ; 183 184uniform sampler1DShadow samp1Ds ; 185uniform sampler2DShadow samp2Ds ; 186uniform samplerCubeShadow sampCubes ; 187uniform sampler1DArrayShadow samp1DAs ; 188uniform sampler2DArrayShadow samp2DAs ; 189uniform samplerCubeArrayShadow sampCubeAs ; 190 191uniform samplerBuffer sampBuf ; 192uniform sampler2DRect sampRect ; 193 194void qlod () 195{ 196vec2 lod ; 197float pf ; 198vec2 pf2 ; 199vec3 pf3 ; 200 201lod = textureQueryLod ( samp1D , pf ) ; 202lod = textureQueryLod ( isamp2D , pf2 ) ; 203lod = textureQueryLod ( usamp3D , pf3 ) ; 204lod = textureQueryLod ( sampCube , pf3 ) ; 205lod = textureQueryLod ( isamp1DA , pf ) ; 206lod = textureQueryLod ( usamp2DA , pf2 ) ; 207lod = textureQueryLod ( isampCubeA , pf3 ) ; 208 209lod = textureQueryLod ( samp1Ds , pf ) ; 210lod = textureQueryLod ( samp2Ds , pf2 ) ; 211lod = textureQueryLod ( sampCubes , pf3 ) ; 212lod = textureQueryLod ( samp1DAs , pf ) ; 213lod = textureQueryLod ( samp2DAs , pf2 ) ; 214lod = textureQueryLod ( sampCubeAs , pf3 ) ; 215 216lod = textureQueryLod ( sampBuf , pf ) ; // ERROR 217lod = textureQueryLod ( sampRect , pf2 ) ; // ERROR 218} 219 220uniform uint uu ; 221out uint iout ; 222 223void bitwiseConv () 224{ 225iout = uu & i ; 226iout += uu ^ i ; 227iout += i | uu ; 228} 229 230subroutine ( subT1 , subT2 ) ; 231subroutine float subT1 () { return 1.0 ; } 232subroutine float subT2 () { return 1.0 ; } 233 234struct SKeyMem { int precise ; } KeyMem ; // ERROR, keyword can't be a member