John Kessenich | 1f2a36b | 2013-02-20 04:42:42 +0000 | [diff] [blame] | 1 | #version 300 es |
| 2 | |
| 3 | uniform mat4x3 m43; |
| 4 | uniform mat3x3 m33; |
| 5 | uniform mat4x4 m44; |
| 6 | |
| 7 | in vec3 v3; |
John Kessenich | 01fc064 | 2013-06-24 21:22:03 +0000 | [diff] [blame] | 8 | varying vec2 v2; // ERROR, varying reserved |
| 9 | in vec4 bad[10]; // ERROR, no arrayed inputs |
| 10 | highp in vec4 badorder; // ERROR, incorrect qualifier order |
| 11 | out invariant vec4 badorder2; // ERROR, incorrect qualifier order |
| 12 | in centroid vec4 badorder4; // ERROR, incorrect qualifier order |
| 13 | out flat vec4 badorder3; // ERROR, incorrect qualifier order |
| 14 | void bar(in const float a); // ERROR, incorrect qualifier order |
| 15 | void bar2(highp in float b); // ERROR, incorrect qualifier order |
| 16 | smooth flat out vec4 rep; // ERROR, replicating interpolation qualification |
| 17 | centroid sample out vec4 rep2; // ERROR, replicating auxiliary qualification |
| 18 | in uniform vec4 rep3; // ERROR, replicating storage qualification |
John Kessenich | 3ed2db5 | 2013-04-07 22:43:16 +0000 | [diff] [blame] | 19 | |
John Kessenich | b29ba33 | 2013-06-21 19:43:44 +0000 | [diff] [blame] | 20 | struct S { |
| 21 | vec3 c; |
| 22 | float f; |
| 23 | }; |
| 24 | |
| 25 | out S s; |
| 26 | |
John Kessenich | 1f2a36b | 2013-02-20 04:42:42 +0000 | [diff] [blame] | 27 | void main() |
| 28 | { |
| 29 | int id = gl_VertexID + gl_InstanceID; |
| 30 | |
| 31 | int c0 = gl_MaxVertexAttribs; |
| 32 | int c1 = gl_MaxVertexUniformVectors; |
| 33 | int c2 = gl_MaxVertexOutputVectors; |
| 34 | int c3 = gl_MaxFragmentInputVectors; |
| 35 | int c4 = gl_MaxVertexTextureImageUnits; |
| 36 | int c5 = gl_MaxCombinedTextureImageUnits; |
| 37 | int c6 = gl_MaxTextureImageUnits; |
| 38 | int c7 = gl_MaxFragmentUniformVectors; |
| 39 | int c8 = gl_MaxDrawBuffers; |
| 40 | int c9 = gl_MinProgramTexelOffset; |
| 41 | int c10 = gl_MaxProgramTexelOffset; |
| 42 | |
| 43 | mat3x4 tm = transpose(m43); |
| 44 | highp float dm = determinant(m44); |
| 45 | mat3x3 im = inverse(m33); |
| 46 | |
| 47 | mat3x2 op = outerProduct(v2, v3); |
John Kessenich | b51f62c | 2013-04-11 16:31:09 +0000 | [diff] [blame] | 48 | |
John Kessenich | 3ce5745 | 2013-06-07 18:54:19 +0000 | [diff] [blame] | 49 | gl_Position = m44[2]; |
| 50 | gl_PointSize = v2.y; |
| 51 | |
John Kessenich | b29ba33 | 2013-06-21 19:43:44 +0000 | [diff] [blame] | 52 | s.c = v3; |
| 53 | s.f = dm; |
| 54 | |
John Kessenich | b51f62c | 2013-04-11 16:31:09 +0000 | [diff] [blame] | 55 | #ifdef GL_ES |
| 56 | #error GL_ES is set |
| 57 | #else |
| 58 | #error GL_ES is not set |
| 59 | #endif |
John Kessenich | 1f2a36b | 2013-02-20 04:42:42 +0000 | [diff] [blame] | 60 | } |
John Kessenich | fb7044a | 2013-06-13 20:16:43 +0000 | [diff] [blame] | 61 | |
| 62 | float badsize[]; // ERROR |
| 63 | float[] badsize2; // ERROR |
| 64 | uniform ub { |
| 65 | int a[]; // ERROR |
| 66 | } ubInst[]; // ERROR |
| 67 | void foo(int a[]); // ERROR |
John Kessenich | 69aa9c1 | 2013-11-12 03:31:24 +0000 | [diff] [blame] | 68 | float okayA[] = float[](3.0f, 4.0F); // Okay |
John Kessenich | 01c22af | 2013-11-08 07:13:18 +0000 | [diff] [blame] | 69 | |
| 70 | out vec3 newV; |
| 71 | void newVFun() |
| 72 | { |
| 73 | newV = v3; |
| 74 | } |
| 75 | |
| 76 | invariant newV; // ERROR, variable already used |
| 77 | in vec4 invIn; |
| 78 | invariant invIn; // ERROR, in v300 |
| 79 | out S s2; |
| 80 | invariant s2; |
| 81 | invariant out S s3; |
| 82 | flat out int; |
John Kessenich | a4351c5 | 2013-11-11 04:21:31 +0000 | [diff] [blame] | 83 | |
| 84 | uniform ub2 { |
| 85 | float f; |
| 86 | } a; |
| 87 | |
| 88 | uniform ub2 { // ERROR redeclaration of block name (same instance name) |
| 89 | float g; |
| 90 | } a; |
| 91 | |
| 92 | uniform ub2 { // ERROR redeclaration of block name (different instance name) |
| 93 | float f; |
| 94 | } c; |
| 95 | |
| 96 | uniform ub2 { // ERROR redeclaration of block name (no instance name) |
| 97 | float f123; |
| 98 | }; |
| 99 | |
| 100 | uniform ub3 { |
| 101 | bool b23; |
| 102 | }; |
| 103 | |
| 104 | uniform ub3 { // ERROR redeclaration of block name (no instance name in first or declared) |
| 105 | bool b234; |
| 106 | }; |
John Kessenich | 13221d2 | 2013-12-02 18:09:08 +0000 | [diff] [blame] | 107 | |
| 108 | precision lowp sampler3D; |
| 109 | precision lowp sampler2DShadow; |
| 110 | precision lowp sampler2DArrayShadow; |
| 111 | |
| 112 | uniform sampler2D s2D; |
| 113 | uniform sampler3D s3D; |
| 114 | uniform sampler2DShadow s2DS; |
| 115 | uniform sampler2DArrayShadow s2DAS; |
| 116 | in vec2 c2D; |
| 117 | |
| 118 | void foo23() |
| 119 | { |
| 120 | ivec2 x1 = textureSize(s2D, 2); |
| 121 | textureSize(s2D); // ERROR, no lod |
| 122 | ivec3 x3 = textureSize(s2DAS, -1); |
| 123 | textureSize(s2DAS); // ERROR, no lod |
| 124 | vec4 x4 = texture(s2D, c2D); |
| 125 | texture(s2D, c2D, 0.2); // ERROR, bias |
| 126 | vec4 x5 = textureProjOffset(s3D, vec4(0.2), ivec3(1)); |
| 127 | textureProjOffset(s3D, vec4(0.2), ivec3(1), .03); // ERROR, bias |
| 128 | float x6 = textureProjGradOffset(s2DS, invIn, vec2(4.2), vec2(5.3), ivec2(1)); |
| 129 | } |
John Kessenich | 143c8bf | 2013-12-03 21:04:03 +0000 | [diff] [blame] | 130 | |
| 131 | int fgfg(float f, mediump int i); |
| 132 | int fgfg(float f, highp int i); // ERROR, precision qualifier difference |
| 133 | |
| 134 | int fgfgh(float f, const in mediump int i); |
| 135 | int fgfgh(float f, in mediump int i); // ERROR, precision qualifier difference |
John Kessenich | 34bd4fb | 2013-12-04 16:43:00 +0000 | [diff] [blame] | 136 | |
| 137 | void foo2349() |
| 138 | { |
| 139 | float[] x = float[] (1.0, 2.0, 3.0); |
| 140 | float[] y = x; |
| 141 | float[3] z = x; |
| 142 | float[3] w; |
| 143 | w = y; |
| 144 | } |
| 145 | |
| 146 | int[] foo213234(); // ERROR |
| 147 | int foo234234(float[]); // ERROR |
| 148 | int foo234235(vec2[] v); // ERROR |
| 149 | precision highp float[2]; // ERROR |
John Kessenich | b88c60b | 2013-12-04 19:43:05 +0000 | [diff] [blame] | 150 | |
| 151 | int fffg(float f); |
| 152 | int fffg(float f); |
| 153 | |
| 154 | int gggf(float f); |
| 155 | int gggf(float f) { return 2; } |
| 156 | int gggf(float f); |
| 157 | |
| 158 | int agggf(float f) { return 2; } |
| 159 | int agggf(float f); |
John Kessenich | afda241 | 2013-12-04 20:41:33 +0000 | [diff] [blame] | 160 | |
| 161 | out struct Ssss { float f; } ssss; |
John Kessenich | 56876dc | 2014-02-13 19:14:33 +0000 | [diff] [blame] | 162 | |
| 163 | uniform Bblock { |
| 164 | int a; |
| 165 | } Binst; |
| 166 | int Bfoo; |
| 167 | |
| 168 | layout(std140) Binst; // ERROR |
| 169 | layout(std140) Bblock; // ERROR |
| 170 | layout(std140) Bfoo; // ERROR |
John Kessenich | 4d57090 | 2014-08-12 22:07:22 +0000 | [diff] [blame] | 171 | |
John Kessenich | 93930d6 | 2015-06-12 22:09:25 +0000 | [diff] [blame] | 172 | layout(std430) uniform B430 { int a; } B430i; // ERROR |
| 173 | |
John Kessenich | 4d57090 | 2014-08-12 22:07:22 +0000 | [diff] [blame] | 174 | struct SNA { |
| 175 | int a[]; // ERROR |
| 176 | }; |
John Kessenich | 989df85 | 2015-11-28 12:52:29 -0700 | [diff] [blame] | 177 | |
| 178 | void fooDeeparray() |
| 179 | { |
| 180 | float[] x = float[] (1.0, 2.0, 3.0), |
| 181 | y = float[] (1.0, 2.0, 3.0, 4.0); |
| 182 | float xp[3], yp[4]; |
| 183 | xp = x; |
| 184 | yp = y; |
| 185 | xp = y; // ERROR, wrong size |
| 186 | yp = x; // ERROR, wrong size |
| 187 | } |