blob: 8b67b981d71785e7c8edda8e5f4a5eeaf9443d84 [file] [log] [blame]
John Kessenichdb6b9112013-02-25 19:44:56 +00001#version 300 es
2
3uniform sampler2D s2D;
John Kessenich41a36bb2013-06-19 05:41:25 +00004uniform lowp sampler3D s3D;
John Kessenichdb6b9112013-02-25 19:44:56 +00005uniform samplerCube sCube;
John Kessenich41a36bb2013-06-19 05:41:25 +00006uniform lowp samplerCubeShadow sCubeShadow;
7uniform lowp sampler2DShadow s2DShadow;
8uniform lowp sampler2DArray s2DArray;
9uniform lowp sampler2DArrayShadow s2DArrayShadow;
John Kessenichdb6b9112013-02-25 19:44:56 +000010
John Kessenich41a36bb2013-06-19 05:41:25 +000011uniform lowp isampler2D is2D;
12uniform lowp isampler3D is3D;
13uniform lowp isamplerCube isCube;
14uniform lowp isampler2DArray is2DArray;
John Kessenichdb6b9112013-02-25 19:44:56 +000015
John Kessenich41a36bb2013-06-19 05:41:25 +000016uniform lowp usampler2D us2D;
17uniform lowp usampler3D us3D;
18uniform lowp usamplerCube usCube;
19uniform lowp usampler2DArray us2DArray;
20precision lowp float;
John Kessenichdb6b9112013-02-25 19:44:56 +000021in float c1D;
22in vec2 c2D;
23in vec3 c3D;
John Kessenichc2ff7702013-04-25 16:44:03 +000024smooth vec4 c4D;
John Kessenichdb6b9112013-02-25 19:44:56 +000025
John Kessenich3ed2db52013-04-07 22:43:16 +000026flat in int ic1D;
27flat in ivec2 ic2D;
28flat in ivec3 ic3D;
29flat in ivec4 ic4D;
John Kessenichc2ff7702013-04-25 16:44:03 +000030noperspective in vec4 badv; // ERROR
John Kessenich41a36bb2013-06-19 05:41:25 +000031in sampler2D bads; // ERROR
32precision lowp uint; // ERROR
John Kessenich3ed2db52013-04-07 22:43:16 +000033
34struct s {
35 int i;
John Kessenich41a36bb2013-06-19 05:41:25 +000036 sampler2D s;
John Kessenich3ed2db52013-04-07 22:43:16 +000037};
38
John Kessenich01c22af2013-11-08 07:13:18 +000039in s badout; // ERROR, can't contain a sampler
John Kessenichdb6b9112013-02-25 19:44:56 +000040
John Kessenichb29ba332013-06-21 19:43:44 +000041struct S2 {
42 vec3 c;
43 float f;
44};
45
46in S2 s2;
47
48out vec3 sc;
49out float sf;
50
John Kessenicheebed6f2013-06-24 21:52:41 +000051uniform sampler2D arrayedSampler[5];
52
John Kessenichdb6b9112013-02-25 19:44:56 +000053void main()
54{
John Kessenichdf807512013-02-26 19:48:48 +000055 float f;
56 vec4 v;
57 v = texture(s2D, c2D);
58 v = textureProj(s3D, c4D);
59 v = textureLod(s2DArray, c3D, 1.2);
John Kessenich1d1132d2013-11-20 23:46:57 +000060 f = textureOffset(s2DShadow, c3D, ic2D, c1D); // ERROR, offset argument not constant
John Kessenichdf807512013-02-26 19:48:48 +000061 v = texelFetch(s3D, ic3D, ic1D);
John Kessenicheebed6f2013-06-24 21:52:41 +000062 v = texelFetchOffset(arrayedSampler[2], ic2D, 4, ic2D);
John Kessenichdf807512013-02-26 19:48:48 +000063 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 Kessenicheebed6f2013-06-24 21:52:41 +000069 v = texture(arrayedSampler[ic1D], c2D); // ERROR
John Kessenichdb6b9112013-02-25 19:44:56 +000070
John Kessenichdf807512013-02-26 19:48:48 +000071 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 Kessenichdb6b9112013-02-25 19:44:56 +000079
John Kessenichdf807512013-02-26 19:48:48 +000080 iv.xy = textureSize(sCubeShadow, 2);
John Kessenichc2ff7702013-04-25 16:44:03 +000081
82 float precise;
83 double boo; // ERROR
84 dvec2 boo2; // ERROR
85 dvec3 boo3; // ERROR
86 dvec4 boo4; // ERROR
John Kessenich3ce57452013-06-07 18:54:19 +000087
88 f += gl_FragCoord.y;
89 gl_FragDepth = f;
John Kessenichb29ba332013-06-21 19:43:44 +000090
91 sc = s2.c;
92 sf = s2.f;
John Kessenichebf08252013-06-24 22:40:19 +000093
94 sinh(c1D) +
95 cosh(c1D) * tanh(c2D);
96 asinh(c4D) + acosh(c4D);
97 atanh(c3D);
John Kessenichdb6b9112013-02-25 19:44:56 +000098}
John Kessenichc2ff7702013-04-25 16:44:03 +000099
John Kesseniche369bfc2013-06-26 05:54:40 +0000100uniform 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 Kessenich8ec55cd2013-11-05 18:07:25 +0000106out vec4 colors[4];
107
108void foo()
109{
110 colors[2] = c4D;
John Kessenich01c22af2013-11-08 07:13:18 +0000111 colors[ic1D] = c4D; // ERROR
112}
113
114uniform s st1;
115uniform s st2;
116
117void 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 Kessenich8ec55cd2013-11-05 18:07:25 +0000124}
125
John Kessenich1d1132d2013-11-20 23:46:57 +0000126void foo23()
127{
128 textureOffset(s2DShadow, c3D, ivec2(-8, 7), c1D);
129 textureOffset(s2DShadow, c3D, ivec2(-9, 8), c1D);
130}
131
John Kessenich78fe3ac2013-12-02 16:38:53 +0000132void foo324(void)
133{
134 float p = pow(3.2, 4.6);
135 p += sin(0.4);
John Kessenicha4ca22f2013-12-03 01:18:06 +0000136 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 Kessenich78fe3ac2013-12-02 16:38:53 +0000146}
147
John Kessenich04b1c6e2014-01-28 21:13:59 +0000148uniform mediump; // ERROR
149
John Kessenichc2ff7702013-04-25 16:44:03 +0000150float imageBuffer; // ERROR, reserved
151float uimage2DRect; // ERROR, reserved