John Kessenich | ab41fe5 | 2013-10-24 01:25:40 +0000 | [diff] [blame] | 1 | #version 330 compatibility |
John Kessenich | ef8ae2e | 2013-02-27 19:02:52 +0000 | [diff] [blame] | 2 | |
| 3 | in vec4 inVar; |
John Kessenich | aa657c1 | 2014-08-19 02:12:44 +0000 | [diff] [blame] | 4 | layout(location=0, index=0) out vec4 outVar; |
John Kessenich | ef8ae2e | 2013-02-27 19:02:52 +0000 | [diff] [blame] | 5 | |
| 6 | varying vec4 varyingVar; |
| 7 | |
| 8 | void main() |
| 9 | { |
John Kessenich | 5134b9c | 2013-11-20 21:12:43 +0000 | [diff] [blame] | 10 | gl_FragColor = varyingVar; // link ERROR: user output was used |
| 11 | gl_FragData[1] = inVar; // link ERROR: user output was used |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 12 | int buffer = 4; |
John Kessenich | ef8ae2e | 2013-02-27 19:02:52 +0000 | [diff] [blame] | 13 | } |
John Kessenich | ab41fe5 | 2013-10-24 01:25:40 +0000 | [diff] [blame] | 14 | |
| 15 | #extension GL_ARB_separate_shader_objects : enable |
| 16 | |
| 17 | in gl_PerFragment { |
| 18 | vec4 gl_Color; |
| 19 | }; |
| 20 | |
| 21 | void foo() |
| 22 | { |
| 23 | vec4 c = gl_Color; |
John Kessenich | 5134b9c | 2013-11-20 21:12:43 +0000 | [diff] [blame] | 24 | outVar = inVar; |
John Kessenich | ab41fe5 | 2013-10-24 01:25:40 +0000 | [diff] [blame] | 25 | } |
John Kessenich | c719481 | 2013-12-09 00:37:46 +0000 | [diff] [blame] | 26 | |
| 27 | in gl_block { // ERROR |
| 28 | int gl_i; |
| 29 | } gl_name; |
| 30 | |
| 31 | in myBlock { |
| 32 | int gl_i; // ERROR |
| 33 | } gl_name; // ERROR |
| 34 | |
| 35 | in gl_PerVertex { // ERROR |
| 36 | vec4 gl_FragCoord; |
| 37 | } gl_in[]; |
| 38 | |
| 39 | in gl_PerVertex { // ERROR |
| 40 | vec4 gl_FragCoord; |
| 41 | }; // ERROR |
John Kessenich | b76d6d6 | 2014-01-07 18:14:48 +0000 | [diff] [blame] | 42 | |
| 43 | const int start = 6; |
| 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 |
John Kessenich | b35e9bf | 2014-02-24 21:16:19 +0000 | [diff] [blame] | 47 | layout(location = +60) in float v21; // ERROR |
| 48 | layout(location = (2)) in float v22; // ERROR |
John Kessenich | b76d6d6 | 2014-01-07 18:14:48 +0000 | [diff] [blame] | 49 | |
John Kessenich | 68546c6 | 2014-01-08 23:25:18 +0000 | [diff] [blame] | 50 | struct S { |
| 51 | float f1; |
| 52 | layout(location = 3) float f2; // ERROR |
| 53 | }; |
| 54 | |
| 55 | layout(location = 1) in inblock { // ERROR |
| 56 | float f1; |
| 57 | layout(location = 3) float f2; // ERROR |
| 58 | }; |
| 59 | |
| 60 | layout(location = 1) uniform ublock { // ERROR |
| 61 | float f1; |
| 62 | layout(location = 3) float f2; // ERROR |
| 63 | } uinst; |
| 64 | |
John Kessenich | b76d6d6 | 2014-01-07 18:14:48 +0000 | [diff] [blame] | 65 | #extension GL_ARB_enhanced_layouts : enable |
| 66 | |
| 67 | layout(location = start) in vec4 v3; |
| 68 | layout(location = -2) in vec4 v4; // ERROR |
| 69 | layout(location = -start) in vec4 v5; // ERROR |
John Kessenich | 68546c6 | 2014-01-08 23:25:18 +0000 | [diff] [blame] | 70 | layout(location = start*start - 2 - 4) in vec4 v6; |
John Kessenich | b35e9bf | 2014-02-24 21:16:19 +0000 | [diff] [blame] | 71 | layout(location = +61) in float v23; |
| 72 | layout(location = (62)) in float v24; |
John Kessenich | 68546c6 | 2014-01-08 23:25:18 +0000 | [diff] [blame] | 73 | |
| 74 | struct S2 { |
| 75 | float f1; |
| 76 | layout(location = 3) float f2; // ERROR |
| 77 | }; |
| 78 | |
| 79 | layout(location = 28) in inblock2 { |
| 80 | bool b1; |
| 81 | float f1; |
| 82 | layout(location = 25) float f2; |
| 83 | vec4 f3; |
| 84 | layout(location = 21) S2 s2; |
| 85 | vec4 f4; |
| 86 | vec4 f5; |
| 87 | } ininst2; |
| 88 | |
| 89 | layout(location = 13) uniform ublock2 { // ERROR |
| 90 | float f1; |
| 91 | layout(location = 3) float f2; // ERROR |
| 92 | } uinst2; |
| 93 | |
| 94 | in inblock3 { // ERROR, mix of location internal with no location external |
| 95 | float f1; |
| 96 | layout(location = 40) float f2; |
| 97 | } in3; |
| 98 | |
| 99 | in ublock4 { |
| 100 | layout(location = 50) float f1; |
| 101 | layout(location = 51) float f2; |
| 102 | } in4; |
| 103 | |
| 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 |
| 109 | } s; |
| 110 | |
| 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 |
| 120 | }; |
John Kessenich | aa657c1 | 2014-08-19 02:12:44 +0000 | [diff] [blame] | 121 | |
| 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 |
John Kessenich | 2398b3a | 2015-09-15 19:38:56 -0600 | [diff] [blame] | 128 | layout(location=26, index=0) out indexBlock { int a; } indexBlockI; // ERROR, not on a block |
| 129 |
|
| 130 | uniform sampler1D samp1D;
|
| 131 | uniform sampler2DShadow samp2Ds;
|
| 132 |
|
| 133 | void qlod()
|
| 134 | {
|
| 135 | vec2 lod;
|
| 136 | float pf;
|
| 137 | vec2 pf2;
|
| 138 | vec3 pf3;
|
| 139 |
|
| 140 | lod = textureQueryLod(samp1D, pf); // ERROR, not until 400
|
| 141 | lod = textureQueryLod(samp2Ds, pf2); // ERROR, not until 400
|
| 142 | }
|
John Kessenich | eb505e4 | 2015-10-02 15:01:53 -0600 | [diff] [blame] | 143 |
|
| 144 | int precise; // okay, not a keyword yet
|
| 145 | struct SKeyMem { int precise; } KeyMem; // okay, not a keyword yet
|
| 146 |
|
| 147 | void fooKeyMem()
|
| 148 | {
|
| 149 | KeyMem.precise;
|
| 150 | }
|
John Kessenich | 133253b | 2016-06-05 17:25:34 -0600 | [diff] [blame] | 151 |
|
| 152 | layout(location=28, index=2) out vec4 outIndex2; // ERROR index out of range |