John Kessenich | 01fc064 | 2013-06-24 21:22:03 +0000 | [diff] [blame] | 1 | #version 420 core |
John Kessenich | 66cdf36 | 2013-12-04 20:08:16 +0000 | [diff] [blame] | 2 | #version 420 core |
John Kessenich | 01fc064 | 2013-06-24 21:22:03 +0000 | [diff] [blame] | 3 | varying vec2 v2; // ERROR, varying reserved |
| 4 | in vec4 bad[10]; |
| 5 | highp in vec4 badorder; |
| 6 | out invariant vec4 badorder2; |
| 7 | in centroid vec4 badorder4; // ERROR, no centroid input to vertex stage |
| 8 | out flat vec4 badorder3; |
| 9 | void bar(in const float a); |
| 10 | void bar2(highp in float b); |
| 11 | smooth flat out vec4 rep; // ERROR, replicating interpolation qualification |
| 12 | centroid sample out vec4 rep2; // ERROR, replicating auxiliary qualification |
| 13 | in uniform vec4 rep3; // ERROR, replicating storage qualification |
John Kessenich | d46b31f | 2013-08-27 03:59:04 +0000 | [diff] [blame] | 14 | |
John Kessenich | e46b087 | 2013-10-17 20:55:30 +0000 | [diff] [blame] | 15 | int anonconst; |
| 16 | const int aconst = 5; |
| 17 | const int a = aconst; |
| 18 | const int b = anonconst; // ERROR at global scope |
| 19 | |
| 20 | const int foo() // ERROR, no const functions |
| 21 | { |
| 22 | const int a = aconst; |
| 23 | const int b = anonconst; |
| 24 | const int c = a; // still compile-time const |
| 25 | const int d = b; // not a compile-time const |
| 26 | float x[c]; // okay |
| 27 | float y[d]; // ERROR |
| 28 | |
| 29 | return b; |
| 30 | } |
| 31 | |
John Kessenich | d46b31f | 2013-08-27 03:59:04 +0000 | [diff] [blame] | 32 | void main() |
| 33 | { |
| 34 | int i; |
| 35 | if (i == 3) |
| 36 | int j = i; |
| 37 | else |
| 38 | int k = j; // ERROR, j is undeclared |
| 39 | int m = k; // ERROR, k is undeclared |
| 40 | int n = j; // ERROR, j is undeclared |
| 41 | |
| 42 | while (true) |
| 43 | int jj; |
| 44 | int kk = jj; // ERROR, jj is undeclared |
| 45 | } |
| 46 | |
John Kessenich | 8f13e13 | 2013-10-18 03:56:23 +0000 | [diff] [blame] | 47 | const float cx = 4.20; |
| 48 | const float dx = 4.20; |
| 49 | |
John Kessenich | d46b31f | 2013-08-27 03:59:04 +0000 | [diff] [blame] | 50 | void bar(in highp volatile vec4 v) |
| 51 | { |
John Kessenich | 8f13e13 | 2013-10-18 03:56:23 +0000 | [diff] [blame] | 52 | int s; |
| 53 | s.x; // okay |
| 54 | s.y; // ERROR |
| 55 | if (bad[0].x == cx.x) |
| 56 | ; |
| 57 | if (cx.x == dx.x) |
| 58 | badorder3 = bad[0]; |
| 59 | |
| 60 | float f; |
| 61 | vec3 smeared = f.xxx; |
| 62 | f.xxxxx; // ERROR |
| 63 | f.xxy; // ERROR |
| 64 | } |
John Kessenich | ab30803 | 2013-10-18 21:37:55 +0000 | [diff] [blame] | 65 | |
| 66 | layout(binding = 3) uniform; // ERROR |
| 67 | layout(binding = 3) uniform boundblock { int aoeu; } boundInst; |
| 68 | layout(binding = 7) uniform anonblock { int aoeu; } ; |
| 69 | layout(location = 1) in; // ERROR |
| 70 | layout(binding = 1) in inblock { int aoeua; }; // ERROR |
| 71 | layout(binding = 100000) uniform anonblock2 { int aooeu; } ; |
| 72 | layout(binding = 4) uniform sampler2D sampb1; |
| 73 | layout(binding = 5) uniform sampler2D sampb2[10]; |
John Kessenich | 623833f | 2013-12-11 18:57:40 +0000 | [diff] [blame] | 74 | layout(binding = 80) uniform sampler2D sampb3; // ERROR, binding too big |
John Kessenich | 1fbaa35 | 2013-11-27 02:41:52 +0000 | [diff] [blame] | 75 | layout(binding = 31) uniform sampler2D sampb4; |
John Kessenich | 623833f | 2013-12-11 18:57:40 +0000 | [diff] [blame] | 76 | layout(binding = 79) uniform sampler2D sampb5[2]; // ERROR, binding too big |
John Kessenich | 143c8bf | 2013-12-03 21:04:03 +0000 | [diff] [blame] | 77 | |
| 78 | int fgfg(float f, mediump int i); |
| 79 | int fgfg(float f, highp int i); |
John Kessenich | c719481 | 2013-12-09 00:37:46 +0000 | [diff] [blame] | 80 | |
| 81 | out gl_PerVertex { |
| 82 | float gl_ClipDistance[4]; |
| 83 | }; |
John Kessenich | 116c30b | 2013-12-12 01:25:37 +0000 | [diff] [blame] | 84 | |
| 85 | patch in vec4 patchIn; // ERROR |
John Kessenich | 0b9e112 | 2014-05-10 22:24:50 +0000 | [diff] [blame] | 86 | patch out vec4 patchOut; // ERROR |
| 87 | |
| 88 | void bar23444() |
| 89 | { |
| 90 | mat4x3 m43; \ |
| 91 | float a1 = m43[3].y; |
| 92 | vec3 v3; |
| 93 | int a2 = m43.length(); |
| 94 | a2 += m43[1].length(); |
| 95 | a2 += v3.length(); |
| 96 | const float b = 2 * a1; |
| 97 | int a = gl_MinProgramTexelOffset + gl_MaxProgramTexelOffset; |
| 98 | } |
John Kessenich | bae44b7 | 2014-05-11 01:07:31 +0000 | [diff] [blame] | 99 | |
| 100 | const int comma0 = (2, 3); // ERROR |
| 101 | int comma1[(2, 3)]; // ERROR |
John Kessenich | ddea678 | 2014-08-10 18:19:36 +0000 | [diff] [blame] | 102 | |
| 103 | layout(r32i) uniform iimage2D iimg2D; |
| 104 | layout(rgba32i) uniform iimage2D iimg2Drgba; |
| 105 | layout(rgba32f) uniform image2D img2Drgba; |
| 106 | layout(r32ui) uniform uimage2D uimg2D; |
| 107 | uniform image2DMS img2DMS; // ERROR image variables not declared writeonly must have format layout qualifier |
| 108 | uniform writeonly image2DMS img2DMSWO; |
| 109 | void qux() |
| 110 | { |
| 111 | int i = aoeu; |
| 112 | imageAtomicCompSwap(iimg2D, ivec2(i,i), i, i); |
| 113 | imageAtomicAdd(uimg2D, ivec2(i,i), uint(i)); |
| 114 | imageAtomicMin(iimg2Drgba, ivec2(i,i), i); // ERROR iimg2Drgba does not have r32i layout |
| 115 | imageAtomicMax(img2Drgba, ivec2(i,i), i); // ERROR img2Drgba is not integer image |
| 116 | ivec4 pos = imageLoad(iimg2D, ivec2(i,i)); |
| 117 | vec4 col = imageLoad(img2DMS, ivec2(i,i), i); |
| 118 | imageStore(img2DMSWO, ivec2(i,i), i, vec4(0)); |
| 119 | imageLoad(img2DMSWO, ivec2(i,i), i); // ERROR, drops writeonly |
| 120 | } |
| 121 | |
| 122 | volatile float vol; // ERROR, not an image |
| 123 | readonly int vol2; // ERROR, not an image |
| 124 | |
| 125 | void passr(coherent readonly iimage2D image) |
| 126 | { |
| 127 | } |
| 128 | |
| 129 | layout(r32i) coherent readonly uniform iimage2D qualim1; |
John Kessenich | 6df2904 | 2014-12-11 00:17:42 +0000 | [diff] [blame] | 130 | layout(r32i) coherent volatile readonly uniform iimage2D qualim2; |
John Kessenich | ddea678 | 2014-08-10 18:19:36 +0000 | [diff] [blame] | 131 | |
| 132 | void passrc() |
| 133 | { |
| 134 | passr(qualim1); |
John Kessenich | 6df2904 | 2014-12-11 00:17:42 +0000 | [diff] [blame] | 135 | passr(qualim2); // ERROR, drops volatile |
John Kessenich | ddea678 | 2014-08-10 18:19:36 +0000 | [diff] [blame] | 136 | passr(iimg2D); |
| 137 | } |
| 138 | |
| 139 | layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch |
| 140 | layout(rgba32i) uniform image2D i2bad; // ERROR, type mismatch |
| 141 | layout(rgba32f) uniform uimage2D i3bad; // ERROR, type mismatch |
| 142 | layout(r8_snorm) uniform iimage2D i4bad; // ERROR, type mismatch |
| 143 | layout(rgba32ui) uniform iimage2D i5bad; // ERROR, type mismatch |
| 144 | layout(r8ui) uniform iimage2D i6bad; // ERROR, type mismatch |
John Kessenich | 265f5fb | 2014-08-13 01:04:28 +0000 | [diff] [blame] | 145 | |
| 146 | uniform offcheck { |
| 147 | layout(offset = 16) int foo; // ERROR |
| 148 | } offcheckI; |
John Kessenich | 2398b3a | 2015-09-15 19:38:56 -0600 | [diff] [blame] | 149 | |
| 150 | uniform sampler1D samp1D;
|
| 151 | uniform sampler1DShadow samp1Ds;
|
| 152 |
|
| 153 | void qlod()
|
| 154 | {
|
| 155 | int levels;
|
| 156 |
|
| 157 | levels = textureQueryLevels(samp1D); // ERROR, not until 430
|
| 158 | levels = textureQueryLevels(samp1Ds); // ERROR, not until 430
|
John Kessenich | 414f735 | 2016-07-27 14:43:01 -0600 | [diff] [blame] | 159 | }
|
| 160 |
|
| 161 | layout(binding=0) writeonly uniform image1D badArray[];
|