blob: 228e4f0d3841f87ac5ff7c856b24f1591d200f82 [file] [log] [blame]
John Kessenich8ec55cd2013-11-05 18:07:25 +00001#version 150 core
2
3in vec4 gl_FragCoord;
4layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR
5layout(pixel_center_integer) in vec4 gl_FragCoord; // ERROR
6layout(origin_upper_left) in vec4 foo; // ERROR
7layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
8
9void main()
10{
11 vec4 c = gl_FragCoord;
12}
13
John Kessenich5134b9c2013-11-20 21:12:43 +000014layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use
John Kessenichafda2412013-12-04 20:41:33 +000015
16in struct S { float f; } s;
John Kesseniche8fe7b82013-12-18 18:47:12 +000017
John Kesseniche96ee852014-04-14 22:08:16 +000018float patch = 3.1;
19
20uniform sampler2DMS sms;
21uniform isampler2DMS isms;
22uniform usampler2DMS usms;
23uniform sampler2DMSArray smsa;
24uniform isampler2DMSArray ismsa;
25uniform usampler2DMSArray usmsa;
26
27flat in ivec2 p2;
28flat in ivec3 p3;
29flat in int samp;
30
31void barWxyz()
32{
33 ivec2 t11 = textureSize( sms);
34 ivec2 t12 = textureSize(isms);
35 ivec2 t13 = textureSize(usms);
36 ivec3 t21 = textureSize( smsa);
37 ivec3 t22 = textureSize(ismsa);
38 ivec3 t23 = textureSize(usmsa);
39 vec4 t31 = texelFetch( sms, p2, samp);
40 ivec4 t32 = texelFetch(isms, p2, samp);
41 uvec4 t33 = texelFetch(usms, p2, 3);
42 vec4 t41 = texelFetch( smsa, p3, samp);
43 ivec4 t42 = texelFetch(ismsa, ivec3(2), samp);
44 uvec4 t43 = texelFetch(usmsa, p3, samp);
45}
Rex Xue553ace2015-12-07 19:07:17 +080046
47int primitiveID()
48{
49 return gl_PrimitiveID;
John Kessenich664ad412019-09-05 02:26:39 -060050 gl_PerFragment; // ERROR, block name can't get reused
Rex Xue553ace2015-12-07 19:07:17 +080051}
Chowa3c7a252019-11-26 17:27:33 +080052
53in double type1; // ERROR
54#extension GL_ARB_gpu_shader_fp64 : enable
55double type2;
56double type3 = 2.0;
57int absTest = sqrt(type3);
58double absTest2 = sqrt(type3);
59double absTest3 = sqrt(2);
pmistryNV9f46e3d2020-04-17 04:24:12 -070060float dk = sqrt(11);
61
62#extension GL_ARB_shader_bit_encoding: enable
63
64float f;
65vec4 v4;
66ivec4 iv4a;
67uvec2 uv2c;
68void bitEncodingPass()
69{
70 int i = floatBitsToInt(f);
71 uvec4 uv11 = floatBitsToUint(v4);
72 vec4 v14 = intBitsToFloat(iv4a);
73 vec2 v15 = uintBitsToFloat(uv2c);
74}
75
76#extension GL_ARB_shader_bit_encoding: disable
77
78void bitEncodingFail()
79{
80 int i = floatBitsToInt(f); // Error, extention GL_ARB_bit_encoding is diabled
81}
pmistryNVea50f6d2020-04-27 01:46:32 -070082
83#extension GL_ARB_shading_language_packing : enable
84vec2 v2a;
85uint uy;
86
87void packingPass()
88{
89 uint u19 = packSnorm2x16(v2a);
90 vec2 v20 = unpackSnorm2x16(uy);
91 uint u15 = packUnorm2x16(v2a);
92 vec2 v16 = unpackUnorm2x16(uy);
93 uint u17 = packHalf2x16(v2a);
94 vec2 v18 = unpackHalf2x16(uy);
95}
96
97#extension GL_ARB_shading_language_packing : disable
98void packingFail()
99{
100 uint u19 = packSnorm2x16(v2a); // Error, extension GL_ARB_shading_language_packing is disabled
101}
pmistryNVf03cb292020-04-27 22:46:54 -0700102
103// Testing extension GL_ARB_texture_query_lod
104uniform sampler1D samp1D;
105uniform sampler2DShadow samp2Ds;
106
107void qlodFail()
108{
109 vec2 lod;
110 float pf;
111 vec2 pf2;
112 vec3 pf3;
113
114 lod = textureQueryLod(samp1D, pf); // ERROR, extension GL_ARB_texture_query_lod needed
115 lod = textureQueryLod(samp2Ds, pf2); // ERROR, extension GL_ARB_texture_query_lod needed
116}
117
118#extension GL_ARB_texture_query_lod : enable
119
120uniform isampler2D isamp2D;
121uniform usampler3D usamp3D;
122uniform samplerCube sampCube;
123uniform isampler1DArray isamp1DA;
124uniform usampler2DArray usamp2DA;
125
126uniform sampler1DShadow samp1Ds;
127uniform samplerCubeShadow sampCubes;
128uniform sampler1DArrayShadow samp1DAs;
129uniform sampler2DArrayShadow samp2DAs;
130
131uniform samplerBuffer sampBuf;
132uniform sampler2DRect sampRect;
133
134void qlodPass()
135{
136 vec2 lod;
137 float pf;
138 vec2 pf2;
139 vec3 pf3;
140
141 lod = textureQueryLod(samp1D, pf);
142 lod = textureQueryLod(isamp2D, pf2);
143 lod = textureQueryLod(usamp3D, pf3);
144 lod = textureQueryLod(sampCube, pf3);
145 lod = textureQueryLod(isamp1DA, pf);
146 lod = textureQueryLod(usamp2DA, pf2);
147
148 lod = textureQueryLod(samp1Ds, pf);
149 lod = textureQueryLod(samp2Ds, pf2);
150 lod = textureQueryLod(sampCubes, pf3);
151 lod = textureQueryLod(samp1DAs, pf);
152 lod = textureQueryLod(samp2DAs, pf2);
153
154 lod = textureQueryLod(sampBuf, pf); // ERROR
155 lod = textureQueryLod(sampRect, pf2); // ERROR
156}
pmistryNV2c53bae2020-04-30 21:41:33 -0700157
158// Test extension GL_EXT_shader_integer_mix
159#extension GL_EXT_shader_integer_mix : enable
160bool b1, b2, b;
161int x,y;
162uint z,w;
163
164void testmix()
165{
166 int ival = mix(x, y, b);
167 ivec2 iv2 = mix(ivec2(x), ivec2(y), bvec2(b));
168 ivec3 iv3 = mix(ivec3(x), ivec3(y), bvec3(b));
169 ivec4 iv4 = mix(ivec4(x), ivec4(x), bvec4(b));
170 uint uiv = mix(z, w, b);
171 uvec2 uv2 = mix(uvec2(z), uvec2(z), bvec2(b));
172 uvec3 uv3 = mix(uvec3(z), uvec3(z), bvec3(b));
173 uvec4 uv4 = mix(uvec4(z), uvec4(z), bvec4(b));
174 bool bv = mix(b1, b2, b);
175 bvec2 bv2 = mix(bvec2(b1), bvec2(b2), bvec2(b));
176 bvec3 bv3 = mix(bvec3(b1), bvec3(b2), bvec3(b));
177 bvec4 bv4 = mix(bvec4(b1), bvec4(b2), bvec4(b));
178}
179
180#extension GL_EXT_shader_integer_mix : disable
181void testmixFail()
182{
183 int ival = mix(x, y, b); // Error since extenson GL_EXT_shader_integer_mix is disabled
184}