yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
14813995
main
1#version 440 2 3// Note 'location'-only tests for enhanced layouts are in 330.frag 4// Generic 'component' tests are in 440.vert 5 6// a consumes components 2 and 3 of location 4 7layout (location = 4 ,component = 2 )in vec2 a ; 8 9// b consumes component 1 of location 4 10layout (location = 4 ,component = 1 )in float b ; 11layout (location = 4 ,component = 2 )in vec2 h ;// ERROR, component overlap not okay for fragment in 12 13layout (location = 3 ,component = 2 )in vec3 c ;// ERROR: c overflows components 2 and 3 14 15// e consumes beginning (components 0, 1 and 2) of each of 6 slots 16layout (location = 20 ,component = 0 )in vec3 e [6 ]; 17 18// f consumes last component of the same 6 slots 19layout (location = 20 ,component = 3 )in float f [6 ]; 20 21layout (location = 30 ,component = 3 )out int be ; 22layout (location = 30 ,component = 0 )out vec3 bf ;// ERROR, not the same basic type 23 24writeonly uniform ;// ERROR 25readonly in ;// ERROR 26flat out ;// ERROR 27mediump uniform ; 28 29layout (offset = 12 )uniform ;// ERROR 30layout (offset = 12 )in ;// ERROR 31layout (offset = 12 )out ;// ERROR 32 33layout (align = 16 )uniform ;// ERROR 34layout (align = 16 )in ;// ERROR 35layout (align = 16 )out ;// ERROR 36 37layout (offset = 12 )uniform ubl1 {int a ; }inst1 ;// ERROR 38layout (offset = 12 )in inbl2 {int a ; }inst2 ;// ERROR 39layout (offset = 12 )out inbl3 {int a ; }inst3 ;// ERROR 40 41layout (align = 16 ,std140 )uniform ubl4 {int a ; }inst4 ; 42layout (align = 16 )uniform ubl8 {int a ; }inst8 ;// ERROR, no packing 43layout (align = 16 )in inbl5 {int a ; }inst5 ;// ERROR 44layout (align = 16 )out inbl6 {int a ; }inst6 ;// ERROR 45 46layout (offset = 12 )uniform vec4 v1 ;// ERROR 47layout (offset = 12 )in vec4 v2 ;// ERROR 48layout (offset = 12 )out vec4 v3 ;// ERROR 49 50layout (align = 16 )uniform vec4 v4 ;// ERROR 51layout (align = 16 )in vec4 v5 ;// ERROR 52layout (align = 16 )out vec4 v6 ;// ERROR 53 54layout (std140 )in ;// ERROR 55layout (std140 )uniform vec4 v7 ;// ERROR 56 57layout (align = 48 )uniform ubl7 {// ERROR, not power of 2 58layout (offset = 12 ,align = 4 )float f ;// ERROR, no packing 59}inst7 ; 60 61in ibl10 { 62layout (offset = 12 )float f ;// ERROR 63layout (align = 4 )float g ;// ERROR 64}inst10 ; 65 66layout (std430 )uniform ; 67 68layout (align = 32 )uniform ubl9 { 69float e ; 70layout (offset = 12 ,align = 4 )float f ; 71layout (offset = 20 )float g ; 72float h ; 73}inst9 ; 74 75uniform ubl11 { 76layout (offset = 12 ,align = 4 )float f ; 77float g ; 78}inst11 ; 79 80layout (std140 )uniform block { 81vec4 a ;// a takes offsets 0-15 82layout (offset = 32 )vec3 b ;// b takes offsets 32-43 83layout (offset = 40 )vec2 c ;// ERROR, lies within previous member 84layout (align = 6 )double g ;// ERROR, 6 is not a power of 2 85layout (offset = 68 )double h ;// ERROR, offset not aligned 86}specExampleErrors ; 87 88layout (std140 )uniform block2 { 89vec4 a ;// a takes offsets 0-15 90layout (offset = 32 )vec3 b ;// b takes offsets 32-43 91layout (offset = 48 )vec2 d ;// d takes offsets 48-55 92layout (align = 16 )float e ;// e takes offsets 64-67 93layout (align = 2 )double f ;// f takes offsets 72-79 94layout (offset = 80 )float h ;// h takes offsets 80-83 95layout (align = 64 )dvec3 i ;// i takes offsets 128-151 96layout (offset = 164 ,align = 8 )float j ;// j takes offsets 168-171 97}specExample ; 98 99layout (std430 )buffer block430 { 100vec4 a ;// a takes offsets 0-15 101layout (offset = 32 )vec3 b ;// b takes offsets 32-43 102layout (offset = 40 )vec2 c ;// ERROR, lies within previous member 103layout (align = 6 )double g ;// ERROR, 6 is not a power of 2 104layout (offset = 68 )double h ;// ERROR, offset not aligned 105layout (align = 0 )double i ;// ERROR, 0 not a power of 2 106}specExampleErrors430 ; 107 108layout (std430 )buffer block2430 { 109vec4 a ;// a takes offsets 0-15 110layout (offset = 32 )vec3 b ;// b takes offsets 32-43 111layout (offset = 48 )vec2 d ;// d takes offsets 48-55 112layout (align = 16 )float e ;// e takes offsets 64-67 113layout (align = 2 )double f ;// f takes offsets 72-79 114layout (offset = 80 )float h ;// h takes offsets 80-83 115layout (align = 64 )dvec3 i ;// i takes offsets 128-151 116layout (offset = 164 ,align = 8 )float j ;// j takes offsets 168-171 117}specExample430 ; 118 119layout (std430 ,align = 128 )buffer block24300 { 120vec4 a ; 121vec3 b ; 122vec2 d ; 123float e ; 124double f ; 125float h ; 126dvec3 i ; 127}specExample4300 ; 128 129layout (std430 ,align = 128 )buffer block24301 { 130vec4 a ; 131vec3 b ; 132vec2 d ; 133layout (offset = 388 )float e ; 134layout (align = 8 )double f ; 135float h ; 136dvec3 i ; 137}specExample4301 ; 138 139int aconst [gl_MaxTransformFeedbackBuffers ]; 140int bconst [gl_MaxTransformFeedbackInterleavedComponents ]; 141 142sample in vec3 sampInArray [4 ]; 143 144void interp () 145{ 146interpolateAtCentroid (sampInArray [2 ].xy ); 147interpolateAtSample (sampInArray [2 ].x .x ,2 ); 148} 149 150int layer () 151{ 152return gl_Layer ; 153} 154 155// The std140 layout qualifier should NOT propagate all the way down to 156// the vec3. It is unnecessary and it breaks downstream AST consumers, 157// notably LunarGlass. 158 159struct PointLight_t 160{ 161vec3 vPositionWs ; 162} ; 163 164layout (std140 ,row_major )uniform PerViewLightData_t 165{ 166 167PointLight_t g_pointLightData [128 ] ; 168} ;