2013-10-24 01:25:40 +00:00
|
|
|
#version 330 compatibility
|
2013-02-27 19:02:52 +00:00
|
|
|
|
|
|
|
in vec4 inVar;
|
2014-08-19 02:12:44 +00:00
|
|
|
layout(location=0, index=0) out vec4 outVar;
|
2013-02-27 19:02:52 +00:00
|
|
|
|
|
|
|
varying vec4 varyingVar;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2013-11-20 21:12:43 +00:00
|
|
|
gl_FragColor = varyingVar; // link ERROR: user output was used
|
|
|
|
gl_FragData[1] = inVar; // link ERROR: user output was used
|
2013-04-25 16:44:03 +00:00
|
|
|
int buffer = 4;
|
2013-02-27 19:02:52 +00:00
|
|
|
}
|
2013-10-24 01:25:40 +00:00
|
|
|
|
|
|
|
#extension GL_ARB_separate_shader_objects : enable
|
|
|
|
|
|
|
|
in gl_PerFragment {
|
|
|
|
vec4 gl_Color;
|
|
|
|
};
|
|
|
|
|
|
|
|
void foo()
|
|
|
|
{
|
|
|
|
vec4 c = gl_Color;
|
2013-11-20 21:12:43 +00:00
|
|
|
outVar = inVar;
|
2013-10-24 01:25:40 +00:00
|
|
|
}
|
2013-12-09 00:37:46 +00:00
|
|
|
|
|
|
|
in gl_block { // ERROR
|
|
|
|
int gl_i;
|
|
|
|
} gl_name;
|
|
|
|
|
|
|
|
in myBlock {
|
|
|
|
int gl_i; // ERROR
|
|
|
|
} gl_name; // ERROR
|
|
|
|
|
|
|
|
in gl_PerVertex { // ERROR
|
|
|
|
vec4 gl_FragCoord;
|
|
|
|
} gl_in[];
|
|
|
|
|
|
|
|
in gl_PerVertex { // ERROR
|
|
|
|
vec4 gl_FragCoord;
|
|
|
|
}; // ERROR
|
2014-01-07 18:14:48 +00:00
|
|
|
|
|
|
|
const int start = 6;
|
|
|
|
layout(location = -2) in vec4 v1; // ERROR
|
|
|
|
layout(location = start + 2) in vec4 v2; // ERROR
|
|
|
|
layout(location = 4.7e10) in vec4 v20; // ERROR
|
2014-02-24 21:16:19 +00:00
|
|
|
layout(location = +60) in float v21; // ERROR
|
|
|
|
layout(location = (2)) in float v22; // ERROR
|
2014-01-07 18:14:48 +00:00
|
|
|
|
2014-01-08 23:25:18 +00:00
|
|
|
struct S {
|
|
|
|
float f1;
|
|
|
|
layout(location = 3) float f2; // ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(location = 1) in inblock { // ERROR
|
|
|
|
float f1;
|
|
|
|
layout(location = 3) float f2; // ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(location = 1) uniform ublock { // ERROR
|
|
|
|
float f1;
|
|
|
|
layout(location = 3) float f2; // ERROR
|
|
|
|
} uinst;
|
|
|
|
|
2014-01-07 18:14:48 +00:00
|
|
|
#extension GL_ARB_enhanced_layouts : enable
|
|
|
|
|
|
|
|
layout(location = start) in vec4 v3;
|
|
|
|
layout(location = -2) in vec4 v4; // ERROR
|
|
|
|
layout(location = -start) in vec4 v5; // ERROR
|
2014-01-08 23:25:18 +00:00
|
|
|
layout(location = start*start - 2 - 4) in vec4 v6;
|
2014-02-24 21:16:19 +00:00
|
|
|
layout(location = +61) in float v23;
|
|
|
|
layout(location = (62)) in float v24;
|
2014-01-08 23:25:18 +00:00
|
|
|
|
|
|
|
struct S2 {
|
|
|
|
float f1;
|
|
|
|
layout(location = 3) float f2; // ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
layout(location = 28) in inblock2 {
|
|
|
|
bool b1;
|
|
|
|
float f1;
|
|
|
|
layout(location = 25) float f2;
|
|
|
|
vec4 f3;
|
|
|
|
layout(location = 21) S2 s2;
|
|
|
|
vec4 f4;
|
|
|
|
vec4 f5;
|
|
|
|
} ininst2;
|
|
|
|
|
|
|
|
layout(location = 13) uniform ublock2 { // ERROR
|
|
|
|
float f1;
|
|
|
|
layout(location = 3) float f2; // ERROR
|
|
|
|
} uinst2;
|
|
|
|
|
|
|
|
in inblock3 { // ERROR, mix of location internal with no location external
|
|
|
|
float f1;
|
|
|
|
layout(location = 40) float f2;
|
|
|
|
} in3;
|
|
|
|
|
|
|
|
in ublock4 {
|
|
|
|
layout(location = 50) float f1;
|
|
|
|
layout(location = 51) float f2;
|
|
|
|
} in4;
|
|
|
|
|
|
|
|
layout(location = 33) in struct SS {
|
|
|
|
vec3 a; // gets location 33
|
|
|
|
mat2 b; // gets locations 34 and 35
|
|
|
|
vec4 c[2]; // gets locations 36 and 37
|
|
|
|
layout (location = 38) vec2 A; // ERROR, can't use on struct member
|
|
|
|
} s;
|
|
|
|
|
|
|
|
layout(location = 44) in block {
|
|
|
|
vec4 d; // gets location 44
|
|
|
|
vec4 e; // gets location 45
|
|
|
|
layout(location = 47) vec4 f; // gets location 47
|
|
|
|
vec4 g; // gets location 48
|
|
|
|
layout (location = 41) vec4 h; // gets location 41
|
|
|
|
vec4 i; // gets location 42
|
|
|
|
vec4 j; // gets location 43
|
|
|
|
vec4 k; // ERROR, location 44 already used
|
|
|
|
};
|
2014-08-19 02:12:44 +00:00
|
|
|
|
|
|
|
layout(index=0) out vec4 outVar2; // ERROR: missing explicit location
|
|
|
|
layout(location=0, index=1) out vec4 outVar3; // no error even though location is overlapping
|
|
|
|
layout(location=0, index=1) out vec4 outVar4; // ERROR overlapping
|
|
|
|
layout(location=27, index=0) in vec4 indexIn; // ERROR, not on in
|
|
|
|
layout(location=0, index=0) in; // ERROR, not just on in
|
|
|
|
layout(location=0, index=0) out; // ERROR, need a variable
|
2015-09-16 01:38:56 +00:00
|
|
|
layout(location=26, index=0) out indexBlock { int a; } indexBlockI; // ERROR, not on a block
|
2020-04-28 05:46:54 +00:00
|
|
|
|
|
|
|
int precise; // okay, not a keyword yet
|
|
|
|
struct SKeyMem { int precise; } KeyMem; // okay, not a keyword yet
|
|
|
|
|
|
|
|
void fooKeyMem()
|
|
|
|
{
|
|
|
|
KeyMem.precise;
|
|
|
|
}
|
|
|
|
|
2019-08-24 21:16:10 +00:00
|
|
|
layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range
|
|
|
|
|
|
|
|
layout(location=4) uniform vec4 ucolor0; // ERROR: extension is not enabled
|
|
|
|
|
|
|
|
#extension GL_ARB_explicit_uniform_location : enable
|
|
|
|
|
|
|
|
layout(location=5) uniform vec4 ucolor1;
|
|
|
|
|
|
|
|
layout(location=6) uniform ColorsBuffer // ERROR: location cannot be applied in uniform buffer block
|
|
|
|
{
|
|
|
|
vec4 colors[128];
|
|
|
|
} colorsBuffer;
|
|
|
|
|
|
|
|
|
2020-05-18 09:41:52 +00:00
|
|
|
void testOverload() {
|
|
|
|
float overloadTest = 42;
|
|
|
|
overloadTest = smoothstep(0, 1, overloadTest);
|
|
|
|
}
|