John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 1 | #version 300 es |
John Kessenich | f57aa7b | 2014-10-06 19:39:13 +0000 | [diff] [blame] | 2 | void nodef1(float f); // ERROR, no default precision |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 3 | uniform sampler2D s2D; |
John Kessenich | 41a36bb | 2013-06-19 05:41:25 +0000 | [diff] [blame] | 4 | uniform lowp sampler3D s3D; |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 5 | uniform samplerCube sCube; |
John Kessenich | 41a36bb | 2013-06-19 05:41:25 +0000 | [diff] [blame] | 6 | uniform lowp samplerCubeShadow sCubeShadow; |
| 7 | uniform lowp sampler2DShadow s2DShadow; |
| 8 | uniform lowp sampler2DArray s2DArray; |
| 9 | uniform lowp sampler2DArrayShadow s2DArrayShadow; |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 10 | |
John Kessenich | 41a36bb | 2013-06-19 05:41:25 +0000 | [diff] [blame] | 11 | uniform lowp isampler2D is2D; |
| 12 | uniform lowp isampler3D is3D; |
| 13 | uniform lowp isamplerCube isCube; |
| 14 | uniform lowp isampler2DArray is2DArray; |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 15 | |
John Kessenich | 41a36bb | 2013-06-19 05:41:25 +0000 | [diff] [blame] | 16 | uniform lowp usampler2D us2D; |
| 17 | uniform lowp usampler3D us3D; |
| 18 | uniform lowp usamplerCube usCube; |
| 19 | uniform lowp usampler2DArray us2DArray; |
| 20 | precision lowp float; |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 21 | in float c1D; |
| 22 | in vec2 c2D; |
| 23 | in vec3 c3D; |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 24 | smooth vec4 c4D; |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 25 | |
John Kessenich | 3ed2db5 | 2013-04-07 22:43:16 +0000 | [diff] [blame] | 26 | flat in int ic1D; |
| 27 | flat in ivec2 ic2D; |
| 28 | flat in ivec3 ic3D; |
| 29 | flat in ivec4 ic4D; |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 30 | noperspective in vec4 badv; // ERROR |
John Kessenich | 41a36bb | 2013-06-19 05:41:25 +0000 | [diff] [blame] | 31 | in sampler2D bads; // ERROR |
| 32 | precision lowp uint; // ERROR |
John Kessenich | 3ed2db5 | 2013-04-07 22:43:16 +0000 | [diff] [blame] | 33 | |
| 34 | struct s { |
| 35 | int i; |
John Kessenich | 41a36bb | 2013-06-19 05:41:25 +0000 | [diff] [blame] | 36 | sampler2D s; |
John Kessenich | 3ed2db5 | 2013-04-07 22:43:16 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
John Kessenich | 01c22af | 2013-11-08 07:13:18 +0000 | [diff] [blame] | 39 | in s badout; // ERROR, can't contain a sampler |
John Kessenich | 69d01ea | 2015-12-22 16:39:07 -0700 | [diff] [blame] | 40 | // ERROR, can't have int in struct without flat |
John Kessenich | b29ba33 | 2013-06-21 19:43:44 +0000 | [diff] [blame] | 41 | struct S2 { |
| 42 | vec3 c; |
| 43 | float f; |
| 44 | }; |
| 45 | |
| 46 | in S2 s2; |
| 47 | |
| 48 | out vec3 sc; |
| 49 | out float sf; |
| 50 | |
John Kessenich | eebed6f | 2013-06-24 21:52:41 +0000 | [diff] [blame] | 51 | uniform sampler2D arrayedSampler[5]; |
| 52 | |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 53 | void main() |
| 54 | { |
John Kessenich | df80751 | 2013-02-26 19:48:48 +0000 | [diff] [blame] | 55 | float f; |
| 56 | vec4 v; |
| 57 | v = texture(s2D, c2D); |
| 58 | v = textureProj(s3D, c4D); |
| 59 | v = textureLod(s2DArray, c3D, 1.2); |
John Kessenich | 1d1132d | 2013-11-20 23:46:57 +0000 | [diff] [blame] | 60 | f = textureOffset(s2DShadow, c3D, ic2D, c1D); // ERROR, offset argument not constant |
John Kessenich | df80751 | 2013-02-26 19:48:48 +0000 | [diff] [blame] | 61 | v = texelFetch(s3D, ic3D, ic1D); |
John Kessenich | ef676b0 | 2015-08-18 23:17:15 -0600 | [diff] [blame] | 62 | v = texelFetchOffset(arrayedSampler[2], ic2D, 4, ic2D); // ERROR, offset argument not constant |
John Kessenich | df80751 | 2013-02-26 19:48:48 +0000 | [diff] [blame] | 63 | f = textureLodOffset(s2DShadow, c3D, c1D, ic2D); |
| 64 | v = textureProjLodOffset(s2D, c3D, c1D, ic2D); |
| 65 | v = textureGrad(sCube, c3D, c3D, c3D); |
| 66 | f = textureGradOffset(s2DArrayShadow, c4D, c2D, c2D, ic2D); |
| 67 | v = textureProjGrad(s3D, c4D, c3D, c3D); |
| 68 | v = textureProjGradOffset(s2D, c3D, c2D, c2D, ic2D); |
John Kessenich | eebed6f | 2013-06-24 21:52:41 +0000 | [diff] [blame] | 69 | v = texture(arrayedSampler[ic1D], c2D); // ERROR |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 70 | |
John Kessenich | df80751 | 2013-02-26 19:48:48 +0000 | [diff] [blame] | 71 | ivec4 iv; |
| 72 | iv = texture(is2D, c2D); |
| 73 | iv = textureProjOffset(is2D, c4D, ic2D); |
| 74 | iv = textureProjLod(is2D, c3D, c1D); |
| 75 | iv = textureProjGrad(is2D, c3D, c2D, c2D); |
| 76 | iv = texture(is3D, c3D, 4.2); |
| 77 | iv = textureLod(isCube, c3D, c1D); |
| 78 | iv = texelFetch(is2DArray, ic3D, ic1D); |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 79 | |
John Kessenich | df80751 | 2013-02-26 19:48:48 +0000 | [diff] [blame] | 80 | iv.xy = textureSize(sCubeShadow, 2); |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 81 | |
| 82 | float precise; |
| 83 | double boo; // ERROR |
| 84 | dvec2 boo2; // ERROR |
| 85 | dvec3 boo3; // ERROR |
| 86 | dvec4 boo4; // ERROR |
John Kessenich | 3ce5745 | 2013-06-07 18:54:19 +0000 | [diff] [blame] | 87 | |
| 88 | f += gl_FragCoord.y; |
| 89 | gl_FragDepth = f; |
John Kessenich | b29ba33 | 2013-06-21 19:43:44 +0000 | [diff] [blame] | 90 | |
| 91 | sc = s2.c; |
| 92 | sf = s2.f; |
John Kessenich | ebf0825 | 2013-06-24 22:40:19 +0000 | [diff] [blame] | 93 | |
| 94 | sinh(c1D) + |
| 95 | cosh(c1D) * tanh(c2D); |
| 96 | asinh(c4D) + acosh(c4D); |
| 97 | atanh(c3D); |
John Kessenich | db6b911 | 2013-02-25 19:44:56 +0000 | [diff] [blame] | 98 | } |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 99 | |
John Kessenich | e369bfc | 2013-06-26 05:54:40 +0000 | [diff] [blame] | 100 | uniform multi { |
| 101 | int[2] a[3]; // ERROR |
| 102 | int[2][3] b; // ERROR |
| 103 | int c[2][3]; // ERROR |
| 104 | } multiInst[2][3]; // ERROR |
| 105 | |
John Kessenich | 8ec55cd | 2013-11-05 18:07:25 +0000 | [diff] [blame] | 106 | out vec4 colors[4]; |
| 107 | |
| 108 | void foo() |
| 109 | { |
| 110 | colors[2] = c4D; |
John Kessenich | 01c22af | 2013-11-08 07:13:18 +0000 | [diff] [blame] | 111 | colors[ic1D] = c4D; // ERROR |
| 112 | } |
| 113 | |
| 114 | uniform s st1; |
| 115 | uniform s st2; |
| 116 | |
| 117 | void foo13(s inSt2) |
| 118 | { |
| 119 | if (st1 == st2); // ERROR |
| 120 | if (st1 != st2); // ERROR |
| 121 | st1.s == st2.s; // ERROR |
| 122 | inSt2 = st1; // ERROR |
| 123 | inSt2 == st1; // ERROR |
John Kessenich | 8ec55cd | 2013-11-05 18:07:25 +0000 | [diff] [blame] | 124 | } |
| 125 | |
John Kessenich | 1d1132d | 2013-11-20 23:46:57 +0000 | [diff] [blame] | 126 | void foo23() |
| 127 | { |
| 128 | textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D); |
| 129 | textureOffset(s2DShadow, c3D, ivec2(-9, 8), c1D); |
| 130 | } |
| 131 | |
John Kessenich | 78fe3ac | 2013-12-02 16:38:53 +0000 | [diff] [blame] | 132 | void foo324(void) |
| 133 | { |
| 134 | float p = pow(3.2, 4.6); |
| 135 | p += sin(0.4); |
John Kessenich | a4ca22f | 2013-12-03 01:18:06 +0000 | [diff] [blame] | 136 | p += distance(vec2(10.0, 11.0), vec2(13.0, 15.0)); // 5 |
| 137 | p += dot(vec3(2,3,5), vec3(-2,-1,4)); // 13 |
| 138 | vec3 c3 = cross(vec3(3,-3,1), vec3(4,9,2)); // (-15, -2, 39) |
| 139 | c3 += faceforward(vec3(1,2,3), vec3(2,3,5), vec3(-2,-1,4)); // (-1,-2,-3) |
| 140 | c3 += faceforward(vec3(1,2,3), vec3(-2,-3,-5), vec3(-2,-1,4)); // (1,2,3) |
| 141 | vec2 c2 = reflect(vec2(1,3), vec2(0,1)); // (1,-3) |
| 142 | c2 += refract(vec2(1,3), vec2(0,1), 1.0); // (1,-3) |
| 143 | c2 += refract(vec2(1,3), vec2(0,1), 3.0); |
| 144 | c2 += refract(vec2(1,0.1), vec2(0,1), 5.0); // (0,0) |
| 145 | mat3x2 m32 = outerProduct(vec2(2,3), vec3(5,7,11));// rows: (10, 14, 22), (15, 21, 33) |
John Kessenich | 78fe3ac | 2013-12-02 16:38:53 +0000 | [diff] [blame] | 146 | } |
| 147 | |
John Kessenich | 04b1c6e | 2014-01-28 21:13:59 +0000 | [diff] [blame] | 148 | uniform mediump; // ERROR |
| 149 | |
John Kessenich | b300751 | 2014-08-14 07:07:21 +0000 | [diff] [blame] | 150 | layout(early_fragment_tests) in; // ERROR |
| 151 | |
John Kessenich | 39cf638 | 2014-10-08 16:31:44 +0000 | [diff] [blame] | 152 | #ifndef GL_FRAGMENT_PRECISION_HIGH |
| 153 | #error missing GL_FRAGMENT_PRECISION_HIGH |
| 154 | #endif |
| 155 | |
John Kessenich | f0fce80 | 2014-10-08 21:29:29 +0000 | [diff] [blame] | 156 | invariant in; // ERROR |
| 157 | invariant in vec4; // ERROR |
| 158 | invariant in vec4 fooinv; // ERROR |
| 159 | |
John Kessenich | c2ff770 | 2013-04-25 16:44:03 +0000 | [diff] [blame] | 160 | float imageBuffer; // ERROR, reserved |
| 161 | float uimage2DRect; // ERROR, reserved |