1 #version 330 compatibility
4 layout(location=0, index=0) out vec4 outVar;
6 varying vec4 varyingVar;
10 gl_FragColor = varyingVar; // link ERROR: user output was used
11 gl_FragData[1] = inVar; // link ERROR: user output was used
15 #extension GL_ARB_separate_shader_objects : enable
27 in gl_block { // ERROR
35 in gl_PerVertex { // ERROR
39 in gl_PerVertex { // ERROR
44 layout(location = -2) in vec4 v1; // ERROR
45 layout(location = start + 2) in vec4 v2; // ERROR
46 layout(location = 4.7e10) in vec4 v20; // ERROR
47 layout(location = +60) in float v21; // ERROR
48 layout(location = (2)) in float v22; // ERROR
52 layout(location = 3) float f2; // ERROR
55 layout(location = 1) in inblock { // ERROR
57 layout(location = 3) float f2; // ERROR
60 layout(location = 1) uniform ublock { // ERROR
62 layout(location = 3) float f2; // ERROR
65 #extension GL_ARB_enhanced_layouts : enable
67 layout(location = start) in vec4 v3;
68 layout(location = -2) in vec4 v4; // ERROR
69 layout(location = -start) in vec4 v5; // ERROR
70 layout(location = start*start - 2 - 4) in vec4 v6;
71 layout(location = +61) in float v23;
72 layout(location = (62)) in float v24;
76 layout(location = 3) float f2; // ERROR
79 layout(location = 28) in inblock2 {
82 layout(location = 25) float f2;
84 layout(location = 21) S2 s2;
89 layout(location = 13) uniform ublock2 { // ERROR
91 layout(location = 3) float f2; // ERROR
94 in inblock3 { // ERROR, mix of location internal with no location external
96 layout(location = 40) float f2;
100 layout(location = 50) float f1;
101 layout(location = 51) float f2;
104 layout(location = 33) in struct SS {
105 vec3 a; // gets location 33
106 mat2 b; // gets locations 34 and 35
107 vec4 c[2]; // gets locations 36 and 37
108 layout (location = 38) vec2 A; // ERROR, can't use on struct member
111 layout(location = 44) in block {
112 vec4 d; // gets location 44
113 vec4 e; // gets location 45
114 layout(location = 47) vec4 f; // gets location 47
115 vec4 g; // gets location 48
116 layout (location = 41) vec4 h; // gets location 41
117 vec4 i; // gets location 42
118 vec4 j; // gets location 43
119 vec4 k; // ERROR, location 44 already used
122 layout(index=0) out vec4 outVar2; // ERROR: missing explicit location
123 layout(location=0, index=1) out vec4 outVar3; // no error even though location is overlapping
124 layout(location=0, index=1) out vec4 outVar4; // ERROR overlapping
125 layout(location=27, index=0) in vec4 indexIn; // ERROR, not on in
126 layout(location=0, index=0) in; // ERROR, not just on in
127 layout(location=0, index=0) out; // ERROR, need a variable
128 layout(location=26, index=0) out indexBlock { int a; } indexBlockI; // ERROR, not on a block
130 int precise; // okay, not a keyword yet
131 struct SKeyMem { int precise; } KeyMem; // okay, not a keyword yet
138 layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range
140 layout(location=4) uniform vec4 ucolor0; // ERROR: extension is not enabled
142 #extension GL_ARB_explicit_uniform_location : enable
144 layout(location=5) uniform vec4 ucolor1;
146 layout(location=6) uniform ColorsBuffer // ERROR: location cannot be applied in uniform buffer block
152 void testOverload() {
153 float overloadTest = 42;
154 overloadTest = smoothstep(0, 1, overloadTest);