John Kessenich | 77d908a | 2013-11-09 00:18:22 +0000 | [diff] [blame] | 1 | // okay
|
John Kessenich | 816e9bc | 2013-10-04 21:09:36 +0000 | [diff] [blame] | 2 | #version 100
|
John Kessenich | 968c8f8 | 2015-04-30 03:22:41 +0000 | [diff] [blame] | 3 | int a[3] = { 2, 3, 4, }; // ERROR (lots)
|
John Kessenich | 66cdf36 | 2013-12-04 20:08:16 +0000 | [diff] [blame] | 4 | #version 100
|
John Kessenich | 816e9bc | 2013-10-04 21:09:36 +0000 | [diff] [blame] | 5 | int uint;
|
| 6 |
|
| 7 | attribute vec4 v[3]; // ERROR
|
| 8 |
|
| 9 | float f = 2; // ERROR
|
| 10 |
|
| 11 | uniform block { // ERROR
|
| 12 | int x;
|
| 13 | };
|
| 14 |
|
| 15 | void foo(float);
|
| 16 |
|
| 17 | void main()
|
| 18 | {
|
| 19 | foo(3); // ERROR
|
| 20 | int s = 1 << 4; // ERROR
|
| 21 | s = 16 >> 2; // ERROR
|
| 22 | if (a == a); // ERROR
|
| 23 | int b, c;
|
| 24 | b = c & 4; // ERROR
|
| 25 | b = c % 4; // ERROR
|
| 26 | b = c | 4; // ERROR
|
| 27 | b >>= 2; // ERROR
|
| 28 | b <<= 2; // ERROR
|
| 29 | b %= 3; // ERROR
|
| 30 |
|
| 31 | struct S {
|
| 32 | float f;
|
| 33 | float a[10];
|
| 34 | } s1, s2;
|
| 35 |
|
| 36 | s1 = s2; // ERROR
|
| 37 | if (s1 == s2); // ERROR
|
| 38 | if (s1 != s2); // ERROR
|
| 39 |
|
| 40 | switch(b) { // ERROR
|
| 41 | }
|
| 42 | }
|
| 43 |
|
| 44 | invariant gl_FragColor;
|
| 45 | float fa[]; // ERROR
|
John Kessenich | 01c22af | 2013-11-08 07:13:18 +0000 | [diff] [blame] | 46 | float f13;
|
| 47 | invariant f13; // ERROR
|
| 48 | struct S { int a; };
|
John Kessenich | f0fce80 | 2014-10-08 21:29:29 +0000 | [diff] [blame] | 49 | invariant S; // ERROR, not an input or output
|
John Kessenich | 01c22af | 2013-11-08 07:13:18 +0000 | [diff] [blame] | 50 | invariant float fi; // ERROR
|
| 51 | varying vec4 av;
|
| 52 | invariant av; // okay in v100
|
| 53 |
|
| 54 | void foo10()
|
| 55 | {
|
| 56 | invariant f; // ERROR
|
| 57 | invariant float f2; // ERROR
|
| 58 | float f3;
|
| 59 | invariant f3; // ERROR
|
| 60 | }
|
| 61 |
|
| 62 | uniform vec2 uv2;
|
| 63 | invariant uv2; // ERROR
|
| 64 | invariant uniform vec3 uv3; // ERROR
|
| 65 |
|
| 66 | sampler2D glob2D; // ERROR
|
| 67 | void f11(sampler2D p2d)
|
| 68 | {
|
| 69 | sampler2D v2D; // ERROR
|
| 70 | }
|
| 71 | varying sampler2D vary2D; // ERROR
|
| 72 |
|
| 73 | struct sp {
|
| 74 | highp float f;
|
| 75 | in float g; // ERROR
|
| 76 | uniform float h; // ERROR
|
| 77 | invariant float i; // ERROR
|
| 78 | };
|
John Kessenich | 115a0ad | 2013-11-11 18:50:06 +0000 | [diff] [blame] | 79 |
|
| 80 | uniform sampler3D s3D; // ERROR
|
| 81 |
|
| 82 | #extension GL_OES_texture_3D : enable
|
| 83 |
|
| 84 | precision highp sampler3D;
|
| 85 | uniform sampler3D s3D2;
|
| 86 |
|
| 87 | void foo234()
|
| 88 | {
|
| 89 | texture3D(s3D2, vec3(0.2), 0.2);
|
| 90 | texture3DProj(s3D2, v[1], 0.4);
|
John Kessenich | 06a37c3 | 2013-11-11 20:31:45 +0000 | [diff] [blame] | 91 | dFdx(v[0]); // ERROR
|
| 92 | dFdy(3.2); // ERROR
|
| 93 | fwidth(f13); // ERROR
|
| 94 | }
|
| 95 |
|
| 96 | #extension GL_OES_standard_derivatives : enable
|
| 97 |
|
| 98 | void foo236()
|
| 99 | {
|
| 100 | dFdx(v[0]);
|
| 101 | dFdy(3.2);
|
| 102 | fwidth(f13);
|
John Kessenich | 9929636 | 2013-11-11 20:51:50 +0000 | [diff] [blame] | 103 | gl_FragDepth = f13; // ERROR
|
| 104 | gl_FragDepthEXT = f13; // ERROR
|
John Kessenich | 115a0ad | 2013-11-11 18:50:06 +0000 | [diff] [blame] | 105 | }
|
John Kessenich | 9929636 | 2013-11-11 20:51:50 +0000 | [diff] [blame] | 106 |
|
| 107 | #extension GL_EXT_frag_depth : enable
|
| 108 |
|
| 109 | void foo239()
|
| 110 | {
|
| 111 | gl_FragDepth = f13; // ERROR
|
| 112 | gl_FragDepthEXT = f13;
|
John Kessenich | bd1a5b7 | 2013-11-11 23:29:59 +0000 | [diff] [blame] | 113 | }
|
| 114 |
|
| 115 | #extension GL_OES_EGL_image_external : enable
|
| 116 |
|
| 117 | uniform samplerExternalOES sExt;
|
| 118 |
|
| 119 | void foo245()
|
| 120 | {
|
| 121 | texture2D(sExt, vec2(0.2));
|
| 122 | texture2DProj(sExt, vec3(f13));
|
| 123 | texture2DProj(sExt, v[2]);
|
| 124 | }
|
| 125 |
|
| 126 | precision mediump samplerExternalOES;
|
| 127 | uniform samplerExternalOES mediumExt;
|
| 128 | uniform highp samplerExternalOES highExt;
|
| 129 |
|
| 130 | void foo246()
|
| 131 | {
|
| 132 | texture2D(mediumExt, vec2(0.2));
|
| 133 | texture2DProj(highExt, v[2]);
|
| 134 | texture3D(sExt, vec3(f13)); // ERROR
|
| 135 | texture2DProjLod(sExt, vec3(f13), f13); // ERROR
|
John Kessenich | 67c9f3a | 2013-11-12 01:02:51 +0000 | [diff] [blame] | 136 | int a;
|
| 137 | ~a; // ERROR
|
| 138 | a | a; // ERROR
|
| 139 | a & a; // ERROR
|
John Kessenich | bd1a5b7 | 2013-11-11 23:29:59 +0000 | [diff] [blame] | 140 | }
|
| 141 |
|
| 142 | #extension GL_OES_EGL_image_external : disable
|
John Kessenich | ad43f6f | 2013-11-22 17:30:34 +0000 | [diff] [blame] | 143 | uniform sampler2D s2Dg;
|
John Kessenich | bd1a5b7 | 2013-11-11 23:29:59 +0000 | [diff] [blame] | 144 |
|
John Kessenich | 67c9f3a | 2013-11-12 01:02:51 +0000 | [diff] [blame] | 145 | int foo203940(int a, float b, float a) // ERROR, a redefined
|
| 146 | {
|
John Kessenich | ad43f6f | 2013-11-22 17:30:34 +0000 | [diff] [blame] | 147 | texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2); // ERROR, extension not enabled
|
John Kessenich | 67c9f3a | 2013-11-12 01:02:51 +0000 | [diff] [blame] | 148 | return a;
|
| 149 | }
|
| 150 |
|
John Kessenich | 69aa9c1 | 2013-11-12 03:31:24 +0000 | [diff] [blame] | 151 | float f123 = 4.0f; // ERROR
|
| 152 | float f124 = 5e10F; // ERROR
|
| 153 |
|
John Kessenich | ad43f6f | 2013-11-22 17:30:34 +0000 | [diff] [blame] | 154 | #extension GL_EXT_shader_texture_lod : enable
|
| 155 |
|
| 156 | uniform samplerCube sCube;
|
| 157 |
|
| 158 | void foo323433()
|
| 159 | {
|
| 160 | texture2DLodEXT(s2Dg, uv2, f13);
|
| 161 | texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2);
|
| 162 | texture2DGradEXT(s2Dg, uv2, uv2, uv2);
|
| 163 | textureCubeGradEXT(sCube, vec3(f13), vec3(f13), vec3(f13));
|
| 164 | }
|
| 165 |
|
John Kessenich | 143c8bf | 2013-12-03 21:04:03 +0000 | [diff] [blame] | 166 | int fgfg(float f, mediump int i);
|
John Kessenich | b88c60b | 2013-12-04 19:43:05 +0000 | [diff] [blame] | 167 | int fgfg(float f, highp int i) { return 2; } // ERROR, precision qualifier difference
|
| 168 |
|
| 169 | int fffg(float f);
|
| 170 | int fffg(float f); // ERROR, can't have multiple prototypes
|
| 171 |
|
| 172 | int gggf(float f);
|
| 173 | int gggf(float f) { return 2; }
|
| 174 |
|
| 175 | int agggf(float f) { return 2; }
|
| 176 | int agggf(float f);
|
| 177 | int agggf(float f); // ERROR, second prototype
|
John Kessenich | 143c8bf | 2013-12-03 21:04:03 +0000 | [diff] [blame] | 178 |
|
John Kessenich | afda241 | 2013-12-04 20:41:33 +0000 | [diff] [blame] | 179 | varying struct SSS { float f; } s; // ERROR
|
| 180 |
|
John Kessenich | 974258d | 2014-05-27 01:34:38 +0000 | [diff] [blame] | 181 | int vf(void);
|
| 182 | int vf2();
|
| 183 | int vf3(void v); // ERROR
|
| 184 | int vf4(int, void); // ERROR
|
| 185 | int vf5(int, void v); // ERROR
|
| 186 |
|
| 187 | void badswizzle()
|
| 188 | {
|
| 189 | vec3 a[5];
|
| 190 | a.y; // ERROR, no array swizzle
|
| 191 | a.zy; // ERROR, no array swizzle
|
| 192 | a.nothing; // ERROR
|
| 193 | a.length(); // ERROR, not this version
|
| 194 | a.method(); // ERROR
|
| 195 | }
|
| 196 |
|
John Kessenich | 968c8f8 | 2015-04-30 03:22:41 +0000 | [diff] [blame] | 197 | float fooinit();
|
| 198 |
|
| 199 | float fooinittest()
|
| 200 | {
|
| 201 | return fooinit();
|
| 202 | }
|
| 203 |
|
| 204 | // Test extra-function initializers
|
| 205 | const float fi1 = 3.0;
|
| 206 | const float fi2 = 4.0;
|
| 207 | const float fi3 = 5.0;
|
| 208 |
|
| 209 | float fooinit()
|
| 210 | {
|
| 211 | return fi1 + fi2 + fi3; // should make a constant of 12.0
|
| 212 | }
|
| 213 |
|
| 214 | int init1 = gl_FrontFacing ? 1 : 2; // ERROR, non-const initializer
|
| 215 |
|
John Kessenich | 21f1286 | 2016-06-17 12:43:31 -0600 | [diff] [blame] | 216 | #ifdef GL_EXT_shader_non_constant_global_initializers
|
| 217 | #extension GL_EXT_shader_non_constant_global_initializers : enable
|
| 218 | #endif
|
| 219 |
|
| 220 | int init2 = gl_FrontFacing ? 1 : 2;
|
| 221 |
|
John Kessenich | f0fce80 | 2014-10-08 21:29:29 +0000 | [diff] [blame] | 222 | #pragma STDGL invariant(all)
|
| 223 |
|
John Kessenich | 2b20dcb | 2014-12-20 07:03:18 +0000 | [diff] [blame] | 224 | #line 3000
|
| 225 | #error line of this error should be 3000
|
| 226 |
|
John Kessenich | bd1a5b7 | 2013-11-11 23:29:59 +0000 | [diff] [blame] | 227 | uniform samplerExternalOES badExt; // syntax ERROR
|