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 58 layout(offset=12, align=4) float f; // ERROR, no packing 59} inst7; 60 61in ibl10 { 62 layout(offset=12) float f; // ERROR 63 layout(align=4) float g; // ERROR 64} inst10; 65 66layout(std430) uniform; 67 68layout(align=32) uniform ubl9 { 69 float e; 70 layout(offset=12, align=4) float f; 71 layout(offset=20) float g; 72 float h; 73} inst9; 74 75uniform ubl11 { 76 layout(offset=12, align=4) float f; 77 float g; 78} inst11; 79 80layout(std140) uniform block { 81 vec4 a; // a takes offsets 0-15 82 layout(offset = 32) vec3 b; // b takes offsets 32-43 83 layout(offset = 40) vec2 c; // ERROR, lies within previous member 84 layout(align = 6) double g; // ERROR, 6 is not a power of 2 85 layout(offset=68) double h; // ERROR, offset not aligned 86} specExampleErrors; 87 88layout(std140) uniform block2 { 89 vec4 a; // a takes offsets 0-15 90 layout(offset = 32) vec3 b; // b takes offsets 32-43 91 layout(offset = 48) vec2 d; // d takes offsets 48-55 92 layout(align = 16) float e; // e takes offsets 64-67 93 layout(align = 2) double f; // f takes offsets 72-79 94 layout(offset = 80) float h; // h takes offsets 80-83 95 layout(align = 64) dvec3 i; // i takes offsets 128-151 96 layout(offset = 164, align = 8) float j; // j takes offsets 168-171 97} specExample; 98 99layout(std430) buffer block430 { 100 vec4 a; // a takes offsets 0-15 101 layout(offset = 32) vec3 b; // b takes offsets 32-43 102 layout(offset = 40) vec2 c; // ERROR, lies within previous member 103 layout(align = 6) double g; // ERROR, 6 is not a power of 2 104 layout(offset=68) double h; // ERROR, offset not aligned 105 layout(align = 0) double i; // ERROR, 0 not a power of 2 106} specExampleErrors430; 107 108layout(std430) buffer block2430 { 109 vec4 a; // a takes offsets 0-15 110 layout(offset = 32) vec3 b; // b takes offsets 32-43 111 layout(offset = 48) vec2 d; // d takes offsets 48-55 112 layout(align = 16) float e; // e takes offsets 64-67 113 layout(align = 2) double f; // f takes offsets 72-79 114 layout(offset = 80) float h; // h takes offsets 80-83 115 layout(align = 64) dvec3 i; // i takes offsets 128-151 116 layout(offset = 164, align = 8) float j; // j takes offsets 168-171 117} specExample430; 118 119layout(std430, align = 128) buffer block24300 { 120 vec4 a; 121 vec3 b; 122 vec2 d; 123 float e; 124 double f; 125 float h; 126 dvec3 i; 127} specExample4300; 128 129layout(std430, align = 128) buffer block24301 { 130 vec4 a; 131 vec3 b; 132 vec2 d; 133 layout(offset=388) float e; 134 layout(align=8) double f; 135 float h; 136 dvec3 i; 137} specExample4301; 138 139int aconst[gl_MaxTransformFeedbackBuffers]; 140int bconst[gl_MaxTransformFeedbackInterleavedComponents]; 141 142sample in vec3 sampInArray[4]; 143 144void interp() 145{ 146 interpolateAtCentroid(sampInArray[2].xy); 147 interpolateAtSample(sampInArray[2].x.x, 2); 148} 149 150int layer() 151{ 152 return gl_Layer; 153} 154