Merge vk-gl-cts/opengl-es-cts-3.2.3 into vk-gl-cts/opengl-es-cts-3.2.4
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / shaderrender / vktShaderRenderTextureFunctionTests.cpp
1 /*------------------------------------------------------------------------
2  * Vulkan Conformance Tests
3  * ------------------------
4  *
5  * Copyright (c) 2016 The Khronos Group Inc.
6  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7  * Copyright (c) 2016 The Android Open Source Project
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief Texture access and query function tests.
24  *//*--------------------------------------------------------------------*/
25
26 #include "vktShaderRenderTextureFunctionTests.hpp"
27 #include "vktShaderRender.hpp"
28 #include "gluTextureUtil.hpp"
29 #include "tcuTexture.hpp"
30 #include "tcuTextureUtil.hpp"
31 #include "tcuTestLog.hpp"
32 #include "glwEnums.hpp"
33 #include "deMath.h"
34 #include "vkImageUtil.hpp"
35 #include "vkQueryUtil.hpp"
36
37 namespace vkt
38 {
39 namespace sr
40 {
41 namespace
42 {
43
44 using tcu::Vec2;
45 using tcu::Vec3;
46 using tcu::Vec4;
47 using tcu::IVec2;
48 using tcu::IVec3;
49 using tcu::IVec4;
50
51 using std::vector;
52
53 enum Function
54 {
55         FUNCTION_TEXTURE = 0,           //!< texture(), textureOffset()
56         FUNCTION_TEXTUREPROJ,           //!< textureProj(), textureProjOffset()
57         FUNCTION_TEXTUREPROJ2,          //!< textureProj(sampler1D, vec2)
58         FUNCTION_TEXTUREPROJ3,          //!< textureProj(sampler2D, vec3)
59         FUNCTION_TEXTURELOD,            // ...
60         FUNCTION_TEXTUREPROJLOD,
61         FUNCTION_TEXTUREPROJLOD2,       //!< textureProjLod(sampler1D, vec2)
62         FUNCTION_TEXTUREPROJLOD3,       //!< textureProjLod(sampler2D, vec3)
63         FUNCTION_TEXTUREGRAD,
64         FUNCTION_TEXTUREPROJGRAD,
65         FUNCTION_TEXTUREPROJGRAD2,      //!< textureProjGrad(sampler1D, vec2)
66         FUNCTION_TEXTUREPROJGRAD3,      //!< textureProjGrad(sampler2D, vec3)
67         FUNCTION_TEXELFETCH,
68
69         FUNCTION_LAST
70 };
71
72 inline bool functionHasAutoLod (glu::ShaderType shaderType, Function function)
73 {
74         return shaderType == glu::SHADERTYPE_FRAGMENT &&
75                    (function == FUNCTION_TEXTURE                ||
76                         function == FUNCTION_TEXTUREPROJ        ||
77                         function == FUNCTION_TEXTUREPROJ2       ||
78                         function == FUNCTION_TEXTUREPROJ3);
79 }
80
81 inline bool functionHasProj (Function function)
82 {
83         return function == FUNCTION_TEXTUREPROJ         ||
84                    function == FUNCTION_TEXTUREPROJ2    ||
85                    function == FUNCTION_TEXTUREPROJ3    ||
86                    function == FUNCTION_TEXTUREPROJLOD  ||
87                    function == FUNCTION_TEXTUREPROJLOD2 ||
88                    function == FUNCTION_TEXTUREPROJLOD3 ||
89                    function == FUNCTION_TEXTUREPROJGRAD ||
90                    function == FUNCTION_TEXTUREPROJGRAD2||
91                    function == FUNCTION_TEXTUREPROJGRAD3;
92 }
93
94 inline bool functionHasGrad (Function function)
95 {
96         return function == FUNCTION_TEXTUREGRAD         ||
97                    function == FUNCTION_TEXTUREPROJGRAD ||
98                    function == FUNCTION_TEXTUREPROJGRAD2||
99                    function == FUNCTION_TEXTUREPROJGRAD3;
100 }
101
102 inline bool functionHasLod (Function function)
103 {
104         return function == FUNCTION_TEXTURELOD          ||
105                    function == FUNCTION_TEXTUREPROJLOD  ||
106                    function == FUNCTION_TEXTUREPROJLOD2 ||
107                    function == FUNCTION_TEXTUREPROJLOD3 ||
108                    function == FUNCTION_TEXELFETCH;
109 }
110
111 struct TextureLookupSpec
112 {
113         Function                function;
114
115         tcu::Vec4               minCoord;
116         tcu::Vec4               maxCoord;
117
118         // Bias
119         bool                    useBias;
120
121         // Bias or Lod for *Lod* functions
122         float                   minLodBias;
123         float                   maxLodBias;
124
125         // For *Grad* functions
126         tcu::Vec3               minDX;
127         tcu::Vec3               maxDX;
128         tcu::Vec3               minDY;
129         tcu::Vec3               maxDY;
130
131         bool                    useOffset;
132         tcu::IVec3              offset;
133
134         TextureLookupSpec (void)
135                 : function              (FUNCTION_LAST)
136                 , minCoord              (0.0f)
137                 , maxCoord              (1.0f)
138                 , useBias               (false)
139                 , minLodBias    (0.0f)
140                 , maxLodBias    (0.0f)
141                 , minDX                 (0.0f)
142                 , maxDX                 (0.0f)
143                 , minDY                 (0.0f)
144                 , maxDY                 (0.0f)
145                 , useOffset             (false)
146                 , offset                (0)
147         {
148         }
149
150         TextureLookupSpec (Function                             function_,
151                                            const tcu::Vec4&             minCoord_,
152                                            const tcu::Vec4&             maxCoord_,
153                                            bool                                 useBias_,
154                                            float                                minLodBias_,
155                                            float                                maxLodBias_,
156                                            const tcu::Vec3&             minDX_,
157                                            const tcu::Vec3&             maxDX_,
158                                            const tcu::Vec3&             minDY_,
159                                            const tcu::Vec3&             maxDY_,
160                                            bool                                 useOffset_,
161                                            const tcu::IVec3&    offset_)
162                 : function              (function_)
163                 , minCoord              (minCoord_)
164                 , maxCoord              (maxCoord_)
165                 , useBias               (useBias_)
166                 , minLodBias    (minLodBias_)
167                 , maxLodBias    (maxLodBias_)
168                 , minDX                 (minDX_)
169                 , maxDX                 (maxDX_)
170                 , minDY                 (minDY_)
171                 , maxDY                 (maxDY_)
172                 , useOffset             (useOffset_)
173                 , offset                (offset_)
174         {
175         }
176 };
177
178 enum TextureType
179 {
180         TEXTURETYPE_1D = 0,
181         TEXTURETYPE_2D,
182         TEXTURETYPE_3D,
183         TEXTURETYPE_CUBE_MAP,
184         TEXTURETYPE_1D_ARRAY,
185         TEXTURETYPE_2D_ARRAY,
186         TEXTURETYPE_CUBE_ARRAY,
187
188         TEXTURETYPE_LAST
189 };
190
191 struct TextureSpec
192 {
193         TextureType                     type;           //!< Texture type (2D, cubemap, ...)
194         deUint32                        format;         //!< Internal format.
195         int                                     width;
196         int                                     height;
197         int                                     depth;
198         int                                     numLevels;
199         tcu::Sampler            sampler;
200
201         TextureSpec (void)
202                 : type                  (TEXTURETYPE_LAST)
203                 , format                (GL_NONE)
204                 , width                 (0)
205                 , height                (0)
206                 , depth                 (0)
207                 , numLevels             (0)
208         {
209         }
210
211         TextureSpec (TextureType                        type_,
212                                  deUint32                               format_,
213                                  int                                    width_,
214                                  int                                    height_,
215                                  int                                    depth_,
216                                  int                                    numLevels_,
217                                  const tcu::Sampler&    sampler_)
218                 : type                  (type_)
219                 , format                (format_)
220                 , width                 (width_)
221                 , height                (height_)
222                 , depth                 (depth_)
223                 , numLevels             (numLevels_)
224                 , sampler               (sampler_)
225         {
226         }
227 };
228
229 struct TexLookupParams
230 {
231         float                           lod;
232         tcu::IVec3                      offset;
233         tcu::Vec4                       scale;
234         tcu::Vec4                       bias;
235
236         TexLookupParams (void)
237                 : lod           (0.0f)
238                 , offset        (0)
239                 , scale         (1.0f)
240                 , bias          (0.0f)
241         {
242         }
243 };
244
245 // \note LodMode and computeLodFromDerivates functions are copied from glsTextureTestUtil
246 namespace TextureTestUtil
247 {
248
249 enum LodMode
250 {
251         LODMODE_EXACT = 0,              //!< Ideal lod computation.
252         LODMODE_MIN_BOUND,              //!< Use estimation range minimum bound.
253         LODMODE_MAX_BOUND,              //!< Use estimation range maximum bound.
254
255         LODMODE_LAST
256 };
257
258 // 1D lookup LOD computation.
259
260 float computeLodFromDerivates (LodMode mode, float dudx, float dudy)
261 {
262         float p = 0.0f;
263         switch (mode)
264         {
265                 // \note [mika] Min and max bounds equal to exact with 1D textures
266                 case LODMODE_EXACT:
267                 case LODMODE_MIN_BOUND:
268                 case LODMODE_MAX_BOUND:
269                         p = de::max(deFloatAbs(dudx), deFloatAbs(dudy));
270                         break;
271
272                 default:
273                         DE_ASSERT(DE_FALSE);
274         }
275
276         return deFloatLog2(p);
277 }
278
279 // 2D lookup LOD computation.
280
281 float computeLodFromDerivates (LodMode mode, float dudx, float dvdx, float dudy, float dvdy)
282 {
283         float p = 0.0f;
284         switch (mode)
285         {
286                 case LODMODE_EXACT:
287                         p = de::max(deFloatSqrt(dudx*dudx + dvdx*dvdx), deFloatSqrt(dudy*dudy + dvdy*dvdy));
288                         break;
289
290                 case LODMODE_MIN_BOUND:
291                 case LODMODE_MAX_BOUND:
292                 {
293                         float mu = de::max(deFloatAbs(dudx), deFloatAbs(dudy));
294                         float mv = de::max(deFloatAbs(dvdx), deFloatAbs(dvdy));
295
296                         p = mode == LODMODE_MIN_BOUND ? de::max(mu, mv) : mu + mv;
297                         break;
298                 }
299
300                 default:
301                         DE_ASSERT(DE_FALSE);
302         }
303
304         return deFloatLog2(p);
305 }
306
307 // 3D lookup LOD computation.
308
309 float computeLodFromDerivates (LodMode mode, float dudx, float dvdx, float dwdx, float dudy, float dvdy, float dwdy)
310 {
311         float p = 0.0f;
312         switch (mode)
313         {
314                 case LODMODE_EXACT:
315                         p = de::max(deFloatSqrt(dudx*dudx + dvdx*dvdx + dwdx*dwdx), deFloatSqrt(dudy*dudy + dvdy*dvdy + dwdy*dwdy));
316                         break;
317
318                 case LODMODE_MIN_BOUND:
319                 case LODMODE_MAX_BOUND:
320                 {
321                         float mu = de::max(deFloatAbs(dudx), deFloatAbs(dudy));
322                         float mv = de::max(deFloatAbs(dvdx), deFloatAbs(dvdy));
323                         float mw = de::max(deFloatAbs(dwdx), deFloatAbs(dwdy));
324
325                         p = mode == LODMODE_MIN_BOUND ? de::max(de::max(mu, mv), mw) : (mu + mv + mw);
326                         break;
327                 }
328
329                 default:
330                         DE_ASSERT(DE_FALSE);
331         }
332
333         return deFloatLog2(p);
334 }
335
336 } // TextureTestUtil
337
338 using namespace TextureTestUtil;
339
340 static const LodMode DEFAULT_LOD_MODE = LODMODE_EXACT;
341
342 inline float computeLodFromGrad2D (const ShaderEvalContext& c)
343 {
344         float w = (float)c.textures[0].tex2D->getWidth();
345         float h = (float)c.textures[0].tex2D->getHeight();
346         return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h);
347 }
348
349 inline float computeLodFromGrad2DArray (const ShaderEvalContext& c)
350 {
351         float w = (float)c.textures[0].tex2DArray->getWidth();
352         float h = (float)c.textures[0].tex2DArray->getHeight();
353         return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[2].x()*w, c.in[2].y()*h);
354 }
355
356 inline float computeLodFromGrad3D (const ShaderEvalContext& c)
357 {
358         float w = (float)c.textures[0].tex3D->getWidth();
359         float h = (float)c.textures[0].tex3D->getHeight();
360         float d = (float)c.textures[0].tex3D->getDepth();
361         return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[1].y()*h, c.in[1].z()*d, c.in[2].x()*w, c.in[2].y()*h, c.in[2].z()*d);
362 }
363
364 inline float computeLodFromGradCube (const ShaderEvalContext& c)
365 {
366         // \note Major axis is always -Z or +Z
367         float m = de::abs(c.in[0].z());
368         float d = (float)c.textures[0].texCube->getSize();
369         float s = d/(2.0f*m);
370         float t = d/(2.0f*m);
371         return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*s, c.in[1].y()*t, c.in[2].x()*s, c.in[2].y()*t);
372 }
373
374 inline float computeLodFromGrad1D (const ShaderEvalContext& c)
375 {
376         float w = (float)c.textures[0].tex1D->getWidth();
377         return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[2].x()*w);
378 }
379
380 inline float computeLodFromGrad1DArray (const ShaderEvalContext& c)
381 {
382         float w = (float)c.textures[0].tex1DArray->getWidth();
383         return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*w, c.in[2].x()*w);
384 }
385
386 inline float computeLodFromGradCubeArray (const ShaderEvalContext& c)
387 {
388         // \note Major axis is always -Z or +Z
389         float m = de::abs(c.in[0].z());
390         float d = (float)c.textures[0].texCubeArray->getSize();
391         float s = d/(2.0f*m);
392         float t = d/(2.0f*m);
393         return computeLodFromDerivates(DEFAULT_LOD_MODE, c.in[1].x()*s, c.in[1].y()*t, c.in[2].x()*s, c.in[2].y()*t);
394 }
395
396 typedef void (*TexEvalFunc) (ShaderEvalContext& c, const TexLookupParams& lookupParams);
397
398 inline Vec4 texture2D                   (const ShaderEvalContext& c, float s, float t, float lod)                                       { return c.textures[0].tex2D->sample(c.textures[0].sampler, s, t, lod);                                 }
399 inline Vec4 textureCube                 (const ShaderEvalContext& c, float s, float t, float r, float lod)                      { return c.textures[0].texCube->sample(c.textures[0].sampler, s, t, r, lod);                    }
400 inline Vec4 texture2DArray              (const ShaderEvalContext& c, float s, float t, float r, float lod)                      { return c.textures[0].tex2DArray->sample(c.textures[0].sampler, s, t, r, lod);                 }
401 inline Vec4 texture3D                   (const ShaderEvalContext& c, float s, float t, float r, float lod)                      { return c.textures[0].tex3D->sample(c.textures[0].sampler, s, t, r, lod);                              }
402 inline Vec4 texture1D                   (const ShaderEvalContext& c, float s, float lod)                                                        { return c.textures[0].tex1D->sample(c.textures[0].sampler, s, lod);                                    }
403 inline Vec4 texture1DArray              (const ShaderEvalContext& c, float s, float t, float lod)                                       { return c.textures[0].tex1DArray->sample(c.textures[0].sampler, s, t, lod);                    }
404 inline Vec4 textureCubeArray    (const ShaderEvalContext& c, float s, float t, float r, float q, float lod)     { return c.textures[0].texCubeArray->sample(c.textures[0].sampler, s, t, r, q, lod);    }
405
406 inline float texture2DShadow            (const ShaderEvalContext& c, float ref, float s, float t, float lod)                                    { return c.textures[0].tex2D->sampleCompare(c.textures[0].sampler, ref, s, t, lod);                                     }
407 inline float textureCubeShadow          (const ShaderEvalContext& c, float ref, float s, float t, float r, float lod)                   { return c.textures[0].texCube->sampleCompare(c.textures[0].sampler, ref, s, t, r, lod);                        }
408 inline float texture2DArrayShadow       (const ShaderEvalContext& c, float ref, float s, float t, float r, float lod)                   { return c.textures[0].tex2DArray->sampleCompare(c.textures[0].sampler, ref, s, t, r, lod);                     }
409 inline float texture1DShadow            (const ShaderEvalContext& c, float ref, float s, float lod)                                                             { return c.textures[0].tex1D->sampleCompare(c.textures[0].sampler, ref, s, lod);                                        }
410 inline float texture1DArrayShadow       (const ShaderEvalContext& c, float ref, float s, float t, float lod)                                    { return c.textures[0].tex1DArray->sampleCompare(c.textures[0].sampler, ref, s, t, lod);                        }
411 inline float textureCubeArrayShadow     (const ShaderEvalContext& c, float ref, float s, float t, float r, float q, float lod)  { return c.textures[0].texCubeArray->sampleCompare(c.textures[0].sampler, ref, s, t, r, q, lod);        }
412
413 inline Vec4 texture2DOffset                     (const ShaderEvalContext& c, float s, float t, float lod, IVec2 offset)                         { return c.textures[0].tex2D->sampleOffset(c.textures[0].sampler, s, t, lod, offset);                   }
414 inline Vec4 texture2DArrayOffset        (const ShaderEvalContext& c, float s, float t, float r, float lod, IVec2 offset)        { return c.textures[0].tex2DArray->sampleOffset(c.textures[0].sampler, s, t, r, lod, offset);   }
415 inline Vec4 texture3DOffset                     (const ShaderEvalContext& c, float s, float t, float r, float lod, IVec3 offset)        { return c.textures[0].tex3D->sampleOffset(c.textures[0].sampler, s, t, r, lod, offset);                }
416 inline Vec4 texture1DOffset                     (const ShaderEvalContext& c, float s, float lod, deInt32 offset)                                        { return c.textures[0].tex1D->sampleOffset(c.textures[0].sampler, s, lod, offset);                              }
417 inline Vec4 texture1DArrayOffset        (const ShaderEvalContext& c, float s, float t, float lod, deInt32 offset)                       { return c.textures[0].tex1DArray->sampleOffset(c.textures[0].sampler, s, t, lod, offset);              }
418
419 inline float texture2DShadowOffset              (const ShaderEvalContext& c, float ref, float s, float t, float lod, IVec2 offset)                      { return c.textures[0].tex2D->sampleCompareOffset(c.textures[0].sampler, ref, s, t, lod, offset);                       }
420 inline float texture2DArrayShadowOffset (const ShaderEvalContext& c, float ref, float s, float t, float r, float lod, IVec2 offset)     { return c.textures[0].tex2DArray->sampleCompareOffset(c.textures[0].sampler, ref, s, t, r, lod, offset);       }
421 inline float texture1DShadowOffset              (const ShaderEvalContext& c, float ref, float s, float lod, deInt32 offset)                                     { return c.textures[0].tex1D->sampleCompareOffset(c.textures[0].sampler, ref, s, lod, offset);                          }
422 inline float texture1DArrayShadowOffset (const ShaderEvalContext& c, float ref, float s, float t, float lod, deInt32 offset)            { return c.textures[0].tex1DArray->sampleCompareOffset(c.textures[0].sampler, ref, s, t, lod, offset);          }
423
424 // Eval functions.
425 static void             evalTexture2D                   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), p.lod)*p.scale + p.bias; }
426 static void             evalTextureCube                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod)*p.scale + p.bias; }
427 static void             evalTexture2DArray              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod)*p.scale + p.bias; }
428 static void             evalTexture3D                   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod)*p.scale + p.bias; }
429 static void             evalTexture1D                   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x(), p.lod)*p.scale + p.bias; }
430 static void             evalTexture1DArray              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArray(c, c.in[0].x(), c.in[0].y(), p.lod)*p.scale + p.bias; }
431 static void             evalTextureCubeArray    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCubeArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[0].w(), p.lod)*p.scale + p.bias; }
432
433 static void             evalTexture2DBias               (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x())*p.scale + p.bias; }
434 static void             evalTextureCubeBias             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; }
435 static void             evalTexture2DArrayBias  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; }
436 static void             evalTexture3DBias               (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; }
437 static void             evalTexture1DBias               (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x(), p.lod+c.in[1].x())*p.scale + p.bias; }
438 static void             evalTexture1DArrayBias  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArray(c, c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x())*p.scale + p.bias; }
439 static void             evalTextureCubeArrayBias(ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCubeArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[0].w(), p.lod+c.in[1].x())*p.scale + p.bias; }
440
441 static void             evalTexture2DProj3              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod)*p.scale + p.bias; }
442 static void             evalTexture2DProj3Bias  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod+c.in[1].x())*p.scale + p.bias; }
443 static void             evalTexture2DProj               (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod)*p.scale + p.bias; }
444 static void             evalTexture2DProjBias   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x())*p.scale + p.bias; }
445 static void             evalTexture3DProj               (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod)*p.scale + p.bias; }
446 static void             evalTexture3DProjBias   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod+c.in[1].x())*p.scale + p.bias; }
447 static void             evalTexture1DProj2              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].y(), p.lod)*p.scale + p.bias; }
448 static void             evalTexture1DProj2Bias  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].y(), p.lod+c.in[1].x())*p.scale + p.bias; }
449 static void             evalTexture1DProj               (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].w(), p.lod)*p.scale + p.bias; }
450 static void             evalTexture1DProjBias   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].w(), p.lod+c.in[1].x())*p.scale + p.bias; }
451
452 static void             evalTexture2DLod                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), c.in[1].x())*p.scale + p.bias; }
453 static void             evalTextureCubeLod              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x())*p.scale + p.bias; }
454 static void             evalTexture2DArrayLod   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x())*p.scale + p.bias; }
455 static void             evalTexture3DLod                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x())*p.scale + p.bias; }
456 static void             evalTexture1DLod                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x(), c.in[1].x())*p.scale + p.bias; }
457 static void             evalTexture1DArrayLod   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArray(c, c.in[0].x(), c.in[0].y(), c.in[1].x())*p.scale + p.bias; }
458 static void             evalTextureCubeArrayLod (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCubeArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[0].w(), c.in[1].x())*p.scale + p.bias; }
459
460 static void             evalTexture2DProjLod3   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), c.in[1].x())*p.scale + p.bias; }
461 static void             evalTexture2DProjLod    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x())*p.scale + p.bias; }
462 static void             evalTexture3DProjLod    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), c.in[1].x())*p.scale + p.bias; }
463 static void             evalTexture1DProjLod2   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].y(), c.in[1].x())*p.scale + p.bias; }
464 static void             evalTexture1DProjLod    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].w(), c.in[1].x())*p.scale + p.bias; }
465
466 // Offset variants
467
468 static void             evalTexture2DOffset                             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; }
469 static void             evalTexture2DArrayOffset                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; }
470 static void             evalTexture3DOffset                             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod, p.offset)*p.scale + p.bias; }
471 static void             evalTexture1DOffset                             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x(), p.lod, p.offset.x())*p.scale + p.bias; }
472 static void             evalTexture1DArrayOffset                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArrayOffset(c, c.in[0].x(), c.in[0].y(), p.lod, p.offset.x())*p.scale + p.bias; }
473
474 static void             evalTexture2DOffsetBias                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
475 static void             evalTexture2DArrayOffsetBias    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
476 static void             evalTexture3DOffsetBias                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x(), p.offset)*p.scale + p.bias; }
477 static void             evalTexture1DOffsetBias                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x(), p.lod+c.in[1].x(), p.offset.x())*p.scale + p.bias; }
478 static void             evalTexture1DArrayOffsetBias    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArrayOffset(c, c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x(), p.offset.x())*p.scale + p.bias; }
479
480 static void             evalTexture2DLodOffset                  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
481 static void             evalTexture2DArrayLodOffset             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
482 static void             evalTexture3DLodOffset                  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[1].x(), p.offset)*p.scale + p.bias; }
483 static void             evalTexture1DLodOffset                  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x(), c.in[1].x(), p.offset.x())*p.scale + p.bias; }
484 static void             evalTexture1DArrayLodOffset             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[1].x(), p.offset.x())*p.scale + p.bias; }
485
486 static void             evalTexture2DProj3Offset                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; }
487 static void             evalTexture2DProj3OffsetBias    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
488 static void             evalTexture2DProjOffset                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod, p.offset.swizzle(0,1))*p.scale + p.bias; }
489 static void             evalTexture2DProjOffsetBias             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
490 static void             evalTexture3DProjOffset                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod, p.offset)*p.scale + p.bias; }
491 static void             evalTexture3DProjOffsetBias             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), p.lod+c.in[1].x(), p.offset)*p.scale + p.bias; }
492 static void             evalTexture1DProj2Offset                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].y(), p.lod, p.offset.x())*p.scale + p.bias; }
493 static void             evalTexture1DProj2OffsetBias    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].y(), p.lod+c.in[1].x(), p.offset.x())*p.scale + p.bias; }
494 static void             evalTexture1DProjOffset                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].w(), p.lod, p.offset.x())*p.scale + p.bias; }
495 static void             evalTexture1DProjOffsetBias             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].w(), p.lod+c.in[1].x(), p.offset.x())*p.scale + p.bias; }
496
497 static void             evalTexture2DProjLod3Offset             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
498 static void             evalTexture2DProjLodOffset              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x(), p.offset.swizzle(0,1))*p.scale + p.bias; }
499 static void             evalTexture3DProjLodOffset              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), c.in[1].x(), p.offset)*p.scale + p.bias; }
500 static void             evalTexture1DProjLod2Offset             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].y(), c.in[1].x(), p.offset.x())*p.scale + p.bias; }
501 static void             evalTexture1DProjLodOffset              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].w(), c.in[1].x(), p.offset.x())*p.scale + p.bias; }
502
503 // Shadow variants
504
505 static void             evalTexture2DShadow                             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod); }
506 static void             evalTexture2DShadowBias                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x()); }
507
508 static void             evalTextureCubeShadow                   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = textureCubeShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod); }
509 static void             evalTextureCubeShadowBias               (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = textureCubeShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod+c.in[1].x()); }
510
511 static void             evalTexture2DArrayShadow                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DArrayShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod); }
512 static void             evalTexture1DShadow                             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadow(c, c.in[0].z(), c.in[0].x(), p.lod); }
513 static void             evalTexture1DShadowBias                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadow(c, c.in[0].z(), c.in[0].x(), p.lod+c.in[1].x()); }
514 static void             evalTexture1DArrayShadow                (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DArrayShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod); }
515 static void             evalTexture1DArrayShadowBias    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DArrayShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x()); }
516 static void             evalTextureCubeArrayShadow              (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = textureCubeArrayShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[0].w(), p.lod); }
517
518 static void             evalTexture2DShadowLod                          (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), c.in[1].x()); }
519 static void             evalTexture2DShadowLodOffset            (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), c.in[1].x(), p.offset.swizzle(0,1)); }
520 static void             evalTexture1DShadowLod                          (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture1DShadow(c, c.in[0].z(), c.in[0].x(), c.in[1].x()); }
521 static void             evalTexture1DShadowLodOffset            (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[1].x(), p.offset.x()); }
522 static void             evalTexture1DArrayShadowLod                     (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture1DArrayShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), c.in[1].x()); }
523 static void             evalTexture1DArrayShadowLodOffset       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DArrayShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), c.in[1].x(), p.offset.x()); }
524
525 static void             evalTexture2DShadowProj                         (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod); }
526 static void             evalTexture2DShadowProjBias                     (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x()); }
527 static void             evalTexture1DShadowProj                         (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), p.lod); }
528 static void             evalTexture1DShadowProjBias                     (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), p.lod+c.in[1].x()); }
529
530 static void             evalTexture2DShadowProjLod                      (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x()); }
531 static void             evalTexture2DShadowProjLodOffset        (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[1].x(), p.offset.swizzle(0,1)); }
532 static void             evalTexture1DShadowProjLod                      (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture1DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[1].x()); }
533 static void             evalTexture1DShadowProjLodOffset        (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[1].x(), p.offset.x()); }
534
535 static void             evalTexture2DShadowOffset                       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod, p.offset.swizzle(0,1)); }
536 static void             evalTexture2DShadowOffsetBias           (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x(), p.offset.swizzle(0,1)); }
537 static void             evalTexture2DArrayShadowOffset          (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DArrayShadowOffset(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), p.lod, p.offset.swizzle(0,1)); }
538 static void             evalTexture1DShadowOffset                       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z(), c.in[0].x(), p.lod, p.offset.x()); }
539 static void             evalTexture1DShadowOffsetBias           (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z(), c.in[0].x(), p.lod+c.in[1].x(), p.offset.x()); }
540 static void             evalTexture1DArrayShadowOffset          (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DArrayShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod, p.offset.x()); }
541 static void             evalTexture1DArrayShadowOffsetBias      (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DArrayShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), p.lod+c.in[1].x(), p.offset.x()); }
542
543 static void             evalTexture2DShadowProjOffset           (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod, p.offset.swizzle(0,1)); }
544 static void             evalTexture2DShadowProjOffsetBias       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), p.lod+c.in[1].x(), p.offset.swizzle(0,1)); }
545 static void             evalTexture1DShadowProjOffset           (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), p.lod, p.offset.x()); }
546 static void             evalTexture1DShadowProjOffsetBias       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), p.lod+c.in[1].x(), p.offset.x()); }
547
548 // Gradient variarts
549
550 static void             evalTexture2DGrad                       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c))*p.scale + p.bias; }
551 static void             evalTextureCubeGrad                     (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCube(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGradCube(c))*p.scale + p.bias; }
552 static void             evalTexture2DArrayGrad          (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c))*p.scale + p.bias; }
553 static void             evalTexture3DGrad                       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad3D(c))*p.scale + p.bias; }
554 static void             evalTexture1DGrad                       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x(), computeLodFromGrad1D(c))*p.scale + p.bias; }
555 static void             evalTexture1DArrayGrad          (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArray(c, c.in[0].x(), c.in[0].y(), computeLodFromGrad1DArray(c))*p.scale + p.bias; }
556 static void             evalTextureCubeArrayGrad        (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = textureCubeArray(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), c.in[0].w(), computeLodFromGradCubeArray(c))*p.scale + p.bias; }
557
558 static void             evalTexture2DShadowGrad                 (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture2DShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c)); }
559 static void             evalTextureCubeShadowGrad               (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = textureCubeShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGradCube(c)); }
560 static void             evalTexture2DArrayShadowGrad    (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture2DArrayShadow(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c)); }
561 static void             evalTexture1DShadowGrad                 (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture1DShadow(c, c.in[0].z(), c.in[0].x(), computeLodFromGrad1D(c)); }
562 static void             evalTexture1DArrayShadowGrad    (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture1DArrayShadow(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), computeLodFromGrad1DArray(c)); }
563
564 static void             evalTexture2DGradOffset                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c), p.offset.swizzle(0,1))*p.scale + p.bias; }
565 static void             evalTexture2DArrayGradOffset    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DArrayOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c), p.offset.swizzle(0,1))*p.scale + p.bias; }
566 static void             evalTexture3DGradOffset                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad3D(c), p.offset)*p.scale + p.bias; }
567 static void             evalTexture1DGradOffset                 (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x(), computeLodFromGrad1D(c), p.offset.x())*p.scale + p.bias; }
568 static void             evalTexture1DArrayGradOffset    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DArrayOffset(c, c.in[0].x(), c.in[0].y(), computeLodFromGrad1DArray(c), p.offset.x())*p.scale + p.bias; }
569
570 static void             evalTexture2DShadowGradOffset           (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), computeLodFromGrad2D(c), p.offset.swizzle(0,1)); }
571 static void             evalTexture2DArrayShadowGradOffset      (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DArrayShadowOffset(c, c.in[0].w(), c.in[0].x(), c.in[0].y(), c.in[0].z(), computeLodFromGrad2DArray(c), p.offset.swizzle(0,1)); }
572 static void             evalTexture1DShadowGradOffset           (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z(), c.in[0].x(), computeLodFromGrad1D(c), p.offset.x()); }
573 static void             evalTexture1DArrayShadowGradOffset      (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DArrayShadowOffset(c, c.in[0].z(), c.in[0].x(), c.in[0].y(), computeLodFromGrad1DArray(c), p.offset.x()); }
574
575 static void             evalTexture2DShadowProjGrad                     (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture2DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c)); }
576 static void             evalTexture2DShadowProjGradOffset       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture2DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c), p.offset.swizzle(0,1)); }
577 static void             evalTexture1DShadowProjGrad                     (ShaderEvalContext& c, const TexLookupParams&)          { c.color.x() = texture1DShadow(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), computeLodFromGrad1D(c)); }
578 static void             evalTexture1DShadowProjGradOffset       (ShaderEvalContext& c, const TexLookupParams& p)        { c.color.x() = texture1DShadowOffset(c, c.in[0].z()/c.in[0].w(), c.in[0].x()/c.in[0].w(), computeLodFromGrad1D(c), p.offset.x()); }
579
580 static void             evalTexture2DProjGrad3                  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), computeLodFromGrad2D(c))*p.scale + p.bias; }
581 static void             evalTexture2DProjGrad                   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c))*p.scale + p.bias; }
582 static void             evalTexture3DProjGrad                   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3D(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), computeLodFromGrad3D(c))*p.scale + p.bias; }
583 static void             evalTexture1DProjGrad2                  (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].y(), computeLodFromGrad1D(c))*p.scale + p.bias; }
584 static void             evalTexture1DProjGrad                   (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1D(c, c.in[0].x()/c.in[0].w(), computeLodFromGrad1D(c))*p.scale + p.bias; }
585
586 static void             evalTexture2DProjGrad3Offset    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].z(), c.in[0].y()/c.in[0].z(), computeLodFromGrad2D(c), p.offset.swizzle(0,1))*p.scale + p.bias; }
587 static void             evalTexture2DProjGradOffset             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture2DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), computeLodFromGrad2D(c), p.offset.swizzle(0,1))*p.scale + p.bias; }
588 static void             evalTexture3DProjGradOffset             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture3DOffset(c, c.in[0].x()/c.in[0].w(), c.in[0].y()/c.in[0].w(), c.in[0].z()/c.in[0].w(), computeLodFromGrad3D(c), p.offset)*p.scale + p.bias; }
589 static void             evalTexture1DProjGrad2Offset    (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].y(), computeLodFromGrad1D(c), p.offset.x())*p.scale + p.bias; }
590 static void             evalTexture1DProjGradOffset             (ShaderEvalContext& c, const TexLookupParams& p)        { c.color = texture1DOffset(c, c.in[0].x()/c.in[0].w(), computeLodFromGrad1D(c), p.offset.x())*p.scale + p.bias; }
591
592 // Texel fetch variants
593
594 static void evalTexelFetch2D (ShaderEvalContext& c, const TexLookupParams& p)
595 {
596         int     x       = deChopFloatToInt32(c.in[0].x())+p.offset.x();
597         int     y       = deChopFloatToInt32(c.in[0].y())+p.offset.y();
598         int     lod = deChopFloatToInt32(c.in[1].x());
599         c.color = c.textures[0].tex2D->getLevel(lod).getPixel(x, y)*p.scale + p.bias;
600 }
601
602 static void evalTexelFetch2DArray (ShaderEvalContext& c, const TexLookupParams& p)
603 {
604         int     x       = deChopFloatToInt32(c.in[0].x())+p.offset.x();
605         int     y       = deChopFloatToInt32(c.in[0].y())+p.offset.y();
606         int     l       = deChopFloatToInt32(c.in[0].z());
607         int     lod = deChopFloatToInt32(c.in[1].x());
608         c.color = c.textures[0].tex2DArray->getLevel(lod).getPixel(x, y, l)*p.scale + p.bias;
609 }
610
611 static void evalTexelFetch3D (ShaderEvalContext& c, const TexLookupParams& p)
612 {
613         int     x       = deChopFloatToInt32(c.in[0].x())+p.offset.x();
614         int     y       = deChopFloatToInt32(c.in[0].y())+p.offset.y();
615         int     z       = deChopFloatToInt32(c.in[0].z())+p.offset.z();
616         int     lod = deChopFloatToInt32(c.in[1].x());
617         c.color = c.textures[0].tex3D->getLevel(lod).getPixel(x, y, z)*p.scale + p.bias;
618 }
619
620 static void evalTexelFetch1D (ShaderEvalContext& c, const TexLookupParams& p)
621 {
622         int     x       = deChopFloatToInt32(c.in[0].x())+p.offset.x();
623         int     lod = deChopFloatToInt32(c.in[1].x());
624         c.color = c.textures[0].tex1D->getLevel(lod).getPixel(x, 0)*p.scale + p.bias;
625 }
626
627 static void evalTexelFetch1DArray (ShaderEvalContext& c, const TexLookupParams& p)
628 {
629         int     x       = deChopFloatToInt32(c.in[0].x())+p.offset.x();
630         int     l       = deChopFloatToInt32(c.in[0].y());
631         int     lod = deChopFloatToInt32(c.in[1].x());
632         c.color = c.textures[0].tex1DArray->getLevel(lod).getPixel(x, l)*p.scale + p.bias;
633 }
634
635 class TexLookupEvaluator : public ShaderEvaluator
636 {
637 public:
638                                                         TexLookupEvaluator              (TexEvalFunc evalFunc, const TexLookupParams& lookupParams) : m_evalFunc(evalFunc), m_lookupParams(lookupParams) {}
639         virtual                                 ~TexLookupEvaluator             (void) {}
640
641         virtual void                    evaluate                                (ShaderEvalContext& ctx) const { m_evalFunc(ctx, m_lookupParams); }
642
643 private:
644         TexEvalFunc                             m_evalFunc;
645         const TexLookupParams&  m_lookupParams;
646 };
647
648 static void checkDeviceFeatures (Context& context, TextureType textureType)
649 {
650         if (textureType == TEXTURETYPE_CUBE_ARRAY)
651         {
652                 const vk::VkPhysicalDeviceFeatures&     deviceFeatures  = context.getDeviceFeatures();
653
654                 if (!deviceFeatures.imageCubeArray)
655                         TCU_THROW(NotSupportedError, "Cube array is not supported");
656         }
657 }
658
659 class ShaderTextureFunctionInstance : public ShaderRenderCaseInstance
660 {
661 public:
662                                                                 ShaderTextureFunctionInstance           (Context&                                       context,
663                                                                                                                                          const bool                                     isVertexCase,
664                                                                                                                                          const ShaderEvaluator&         evaluator,
665                                                                                                                                          const UniformSetup&            uniformSetup,
666                                                                                                                                          const TextureLookupSpec&       lookupSpec,
667                                                                                                                                          const TextureSpec&                     textureSpec,
668                                                                                                                                          const TexLookupParams&         lookupParams,
669                                                                                                                                          const ImageBackingMode         imageBackingMode = IMAGE_BACKING_MODE_REGULAR);
670         virtual                                         ~ShaderTextureFunctionInstance          (void);
671
672 protected:
673         virtual void                            setupUniforms                                           (const tcu::Vec4&);
674         void                                            initTexture                                                     (void);
675 private:
676         const TextureLookupSpec&        m_lookupSpec;
677         const TextureSpec&                      m_textureSpec;
678         const TexLookupParams&          m_lookupParams;
679 };
680
681 ShaderTextureFunctionInstance::ShaderTextureFunctionInstance (Context&                                          context,
682                                                                                                                           const bool                                    isVertexCase,
683                                                                                                                           const ShaderEvaluator&                evaluator,
684                                                                                                                           const UniformSetup&                   uniformSetup,
685                                                                                                                           const TextureLookupSpec&              lookupSpec,
686                                                                                                                           const TextureSpec&                    textureSpec,
687                                                                                                                           const TexLookupParams&                lookupParams,
688                                                                                                                           const ImageBackingMode                imageBackingMode)
689         : ShaderRenderCaseInstance      (context, isVertexCase, evaluator, uniformSetup, DE_NULL, imageBackingMode)
690         , m_lookupSpec                          (lookupSpec)
691         , m_textureSpec                         (textureSpec)
692         , m_lookupParams                        (lookupParams)
693 {
694         checkDeviceFeatures(m_context, m_textureSpec.type);
695
696         {
697                 // Base coord scale & bias
698                 Vec4 s = m_lookupSpec.maxCoord-m_lookupSpec.minCoord;
699                 Vec4 b = m_lookupSpec.minCoord;
700
701                 float baseCoordTrans[] =
702                 {
703                         s.x(),          0.0f,           0.f,    b.x(),
704                         0.f,            s.y(),          0.f,    b.y(),
705                         s.z()/2.f,      -s.z()/2.f,     0.f,    s.z()/2.f + b.z(),
706                         -s.w()/2.f,     s.w()/2.f,      0.f,    s.w()/2.f + b.w()
707                 };
708
709                 m_userAttribTransforms.push_back(tcu::Mat4(baseCoordTrans));
710
711                 useAttribute(4u, A_IN0);
712         }
713
714         bool hasLodBias = functionHasLod(m_lookupSpec.function) || m_lookupSpec.useBias;
715         bool isGrad             = functionHasGrad(m_lookupSpec.function);
716         DE_ASSERT(!isGrad || !hasLodBias);
717
718         if (hasLodBias)
719         {
720                 float s = m_lookupSpec.maxLodBias-m_lookupSpec.minLodBias;
721                 float b = m_lookupSpec.minLodBias;
722                 float lodCoordTrans[] =
723                 {
724                         s/2.0f,         s/2.0f,         0.f,    b,
725                         0.0f,           0.0f,           0.0f,   0.0f,
726                         0.0f,           0.0f,           0.0f,   0.0f,
727                         0.0f,           0.0f,           0.0f,   0.0f
728                 };
729
730                 m_userAttribTransforms.push_back(tcu::Mat4(lodCoordTrans));
731
732                 useAttribute(5u, A_IN1);
733         }
734         else if (isGrad)
735         {
736                 Vec3 sx = m_lookupSpec.maxDX-m_lookupSpec.minDX;
737                 Vec3 sy = m_lookupSpec.maxDY-m_lookupSpec.minDY;
738                 float gradDxTrans[] =
739                 {
740                         sx.x()/2.0f,    sx.x()/2.0f,    0.f,    m_lookupSpec.minDX.x(),
741                         sx.y()/2.0f,    sx.y()/2.0f,    0.0f,   m_lookupSpec.minDX.y(),
742                         sx.z()/2.0f,    sx.z()/2.0f,    0.0f,   m_lookupSpec.minDX.z(),
743                         0.0f,                   0.0f,                   0.0f,   0.0f
744                 };
745                 float gradDyTrans[] =
746                 {
747                         -sy.x()/2.0f,   -sy.x()/2.0f,   0.f,    m_lookupSpec.maxDY.x(),
748                         -sy.y()/2.0f,   -sy.y()/2.0f,   0.0f,   m_lookupSpec.maxDY.y(),
749                         -sy.z()/2.0f,   -sy.z()/2.0f,   0.0f,   m_lookupSpec.maxDY.z(),
750                         0.0f,                   0.0f,                   0.0f,   0.0f
751                 };
752
753                 m_userAttribTransforms.push_back(tcu::Mat4(gradDxTrans));
754                 m_userAttribTransforms.push_back(tcu::Mat4(gradDyTrans));
755
756                 useAttribute(5u, A_IN1);
757                 useAttribute(6u, A_IN2);
758         }
759
760         initTexture();
761 }
762
763 ShaderTextureFunctionInstance::~ShaderTextureFunctionInstance (void)
764 {
765 }
766
767 void ShaderTextureFunctionInstance::setupUniforms (const tcu::Vec4&)
768 {
769         useSampler(0u, 0u);
770         addUniform(1u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(tcu::Vec4), m_lookupParams.scale.getPtr());
771         addUniform(2u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(tcu::Vec4), m_lookupParams.bias.getPtr());
772 }
773
774 void ShaderTextureFunctionInstance::initTexture (void)
775 {
776         static const IVec4              texCubeSwz[] =
777         {
778                 IVec4(0,0,1,1),
779                 IVec4(1,1,0,0),
780                 IVec4(0,1,0,1),
781                 IVec4(1,0,1,0),
782                 IVec4(0,1,1,0),
783                 IVec4(1,0,0,1)
784         };
785         DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(texCubeSwz) == tcu::CUBEFACE_LAST);
786
787         tcu::TextureFormat              texFmt                  = glu::mapGLInternalFormat(m_textureSpec.format);
788         tcu::TextureFormatInfo  fmtInfo                 = tcu::getTextureFormatInfo(texFmt);
789         tcu::UVec2                              viewportSize    = getViewportSize();
790         bool                                    isProj                  = functionHasProj(m_lookupSpec.function);
791         bool                                    isAutoLod               = functionHasAutoLod(m_isVertexCase ? glu::SHADERTYPE_VERTEX : glu::SHADERTYPE_FRAGMENT,
792                                                                                                                                  m_lookupSpec.function); // LOD can vary significantly
793         float                                   proj                    = isProj ? 1.0f/m_lookupSpec.minCoord[m_lookupSpec.function == FUNCTION_TEXTUREPROJ2 ? 1 : m_lookupSpec.function == FUNCTION_TEXTUREPROJ3 ? 2 : 3] : 1.0f;
794         TexLookupParams                 lookupParams;
795
796         switch (m_textureSpec.type)
797         {
798                 case TEXTURETYPE_2D:
799                 {
800                         float                                                           levelStep               = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1);
801                         Vec4                                                            cScale                  = fmtInfo.valueMax-fmtInfo.valueMin;
802                         Vec4                                                            cBias                   = fmtInfo.valueMin;
803                         int                                                                     baseCellSize    = de::min(m_textureSpec.width/4, m_textureSpec.height/4);
804                         de::MovePtr<tcu::Texture2D>                     texture2D;
805
806                         texture2D = de::MovePtr<tcu::Texture2D>(new tcu::Texture2D(texFmt, m_textureSpec.width, m_textureSpec.height));
807
808                         for (int level = 0; level < m_textureSpec.numLevels; level++)
809                         {
810                                 float   fA              = float(level)*levelStep;
811                                 float   fB              = 1.0f-fA;
812                                 Vec4    colorA  = cBias + cScale*Vec4(fA, fB, fA, fB);
813                                 Vec4    colorB  = cBias + cScale*Vec4(fB, fA, fB, fA);
814
815                                 texture2D->allocLevel(level);
816                                 tcu::fillWithGrid(texture2D->getLevel(level), de::max(1, baseCellSize>>level), colorA, colorB);
817                         }
818
819                         // Compute LOD.
820                         float   dudx    = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width   / (float)viewportSize[0];
821                         float   dvdy    = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height  / (float)viewportSize[1];
822                         lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy);
823
824                         // Append to texture list.
825                         m_textures.push_back(TextureBindingSp(new TextureBinding(texture2D.release(), m_textureSpec.sampler)));
826                         break;
827                 }
828
829                 case TEXTURETYPE_CUBE_MAP:
830                 {
831                         float                                                           levelStep               = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1);
832                         Vec4                                                            cScale                  = fmtInfo.valueMax-fmtInfo.valueMin;
833                         Vec4                                                            cBias                   = fmtInfo.valueMin;
834                         Vec4                                                            cCorner                 = cBias + cScale*0.5f;
835                         int                                                                     baseCellSize    = de::min(m_textureSpec.width/4, m_textureSpec.height/4);
836                         de::MovePtr<tcu::TextureCube>           textureCube;
837
838                         DE_ASSERT(m_textureSpec.width == m_textureSpec.height);
839                         textureCube = de::MovePtr<tcu::TextureCube>(new tcu::TextureCube(texFmt, m_textureSpec.width));
840
841                         for (int level = 0; level < m_textureSpec.numLevels; level++)
842                         {
843                                 float   fA              = float(level)*levelStep;
844                                 float   fB              = 1.0f-fA;
845                                 Vec2    f               (fA, fB);
846
847                                 for (int face = 0; face < tcu::CUBEFACE_LAST; face++)
848                                 {
849                                         const IVec4&    swzA    = texCubeSwz[face];
850                                         IVec4                   swzB    = 1-swzA;
851                                         Vec4                    colorA  = cBias + cScale*f.swizzle(swzA[0], swzA[1], swzA[2], swzA[3]);
852                                         Vec4                    colorB  = cBias + cScale*f.swizzle(swzB[0], swzB[1], swzB[2], swzB[3]);
853
854                                         textureCube->allocLevel((tcu::CubeFace)face, level);
855
856                                         {
857                                                 const tcu::PixelBufferAccess    access          = textureCube->getLevelFace(level, (tcu::CubeFace)face);
858                                                 const int                                               lastPix         = access.getWidth()-1;
859
860                                                 tcu::fillWithGrid(access, de::max(1, baseCellSize>>level), colorA, colorB);
861
862                                                 // Ensure all corners have identical colors in order to avoid dealing with ambiguous corner texel filtering
863                                                 access.setPixel(cCorner, 0, 0);
864                                                 access.setPixel(cCorner, 0, lastPix);
865                                                 access.setPixel(cCorner, lastPix, 0);
866                                                 access.setPixel(cCorner, lastPix, lastPix);
867                                         }
868                                 }
869                         }
870
871                         // Compute LOD \note Assumes that only single side is accessed and R is constant major axis.
872                         DE_ASSERT(de::abs(m_lookupSpec.minCoord[2] - m_lookupSpec.maxCoord[2]) < 0.005);
873                         DE_ASSERT(de::abs(m_lookupSpec.minCoord[0]) < de::abs(m_lookupSpec.minCoord[2]) && de::abs(m_lookupSpec.maxCoord[0]) < de::abs(m_lookupSpec.minCoord[2]));
874                         DE_ASSERT(de::abs(m_lookupSpec.minCoord[1]) < de::abs(m_lookupSpec.minCoord[2]) && de::abs(m_lookupSpec.maxCoord[1]) < de::abs(m_lookupSpec.minCoord[2]));
875
876                         tcu::CubeFaceFloatCoords        c00             = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
877                         tcu::CubeFaceFloatCoords        c10             = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.maxCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
878                         tcu::CubeFaceFloatCoords        c01             = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.maxCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
879                         float                                           dudx    = (c10.s - c00.s)*(float)m_textureSpec.width    / (float)viewportSize[0];
880                         float                                           dvdy    = (c01.t - c00.t)*(float)m_textureSpec.height   / (float)viewportSize[1];
881                         lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy);
882
883                         // Append to texture list.
884                         m_textures.push_back(TextureBindingSp(new TextureBinding(textureCube.release(), m_textureSpec.sampler)));
885                         break;
886                 }
887
888                 case TEXTURETYPE_2D_ARRAY:
889                 {
890                         float                                                           layerStep               = 1.0f / (float)m_textureSpec.depth;
891                         float                                                           levelStep               = isAutoLod ? 0.0f : 1.0f / (float)(de::max(1, m_textureSpec.numLevels-1)*m_textureSpec.depth);
892                         Vec4                                                            cScale                  = fmtInfo.valueMax-fmtInfo.valueMin;
893                         Vec4                                                            cBias                   = fmtInfo.valueMin;
894                         int                                                                     baseCellSize    = de::min(m_textureSpec.width/4, m_textureSpec.height/4);
895                         de::MovePtr<tcu::Texture2DArray>        texture2DArray;
896
897                         texture2DArray = de::MovePtr<tcu::Texture2DArray>(new tcu::Texture2DArray(texFmt, m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth));
898
899                         for (int level = 0; level < m_textureSpec.numLevels; level++)
900                         {
901                                 texture2DArray->allocLevel(level);
902                                 tcu::PixelBufferAccess levelAccess = texture2DArray->getLevel(level);
903
904                                 for (int layer = 0; layer < levelAccess.getDepth(); layer++)
905                                 {
906                                         float   fA              = (float)layer*layerStep + (float)level*levelStep;
907                                         float   fB              = 1.0f-fA;
908                                         Vec4    colorA  = cBias + cScale*Vec4(fA, fB, fA, fB);
909                                         Vec4    colorB  = cBias + cScale*Vec4(fB, fA, fB, fA);
910
911                                         tcu::fillWithGrid(tcu::getSubregion(levelAccess, 0, 0, layer, levelAccess.getWidth(), levelAccess.getHeight(), 1), de::max(1, baseCellSize>>level), colorA, colorB);
912                                 }
913                         }
914
915                         // Compute LOD.
916                         float   dudx    = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width   / (float)viewportSize[0];
917                         float   dvdy    = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height  / (float)viewportSize[1];
918                         lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy);
919
920                         // Append to texture list.
921                         m_textures.push_back(TextureBindingSp(new TextureBinding(texture2DArray.release(), m_textureSpec.sampler)));
922                         break;
923                 }
924
925                 case TEXTURETYPE_3D:
926                 {
927                         float                                                           levelStep               = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1);
928                         Vec4                                                            cScale                  = fmtInfo.valueMax-fmtInfo.valueMin;
929                         Vec4                                                            cBias                   = fmtInfo.valueMin;
930                         int                                                                     baseCellSize    = de::min(de::min(m_textureSpec.width/2, m_textureSpec.height/2), m_textureSpec.depth/2);
931                         de::MovePtr<tcu::Texture3D>                     texture3D;
932
933                         texture3D = de::MovePtr<tcu::Texture3D>(new tcu::Texture3D(texFmt, m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth));
934
935                         for (int level = 0; level < m_textureSpec.numLevels; level++)
936                         {
937                                 float   fA              = (float)level*levelStep;
938                                 float   fB              = 1.0f-fA;
939                                 Vec4    colorA  = cBias + cScale*Vec4(fA, fB, fA, fB);
940                                 Vec4    colorB  = cBias + cScale*Vec4(fB, fA, fB, fA);
941
942                                 texture3D->allocLevel(level);
943                                 tcu::fillWithGrid(texture3D->getLevel(level), de::max(1, baseCellSize>>level), colorA, colorB);
944                         }
945
946                         // Compute LOD.
947                         float   dudx    = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width           / (float)viewportSize[0];
948                         float   dvdy    = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height          / (float)viewportSize[1];
949                         float   dwdx    = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth      / (float)viewportSize[0];
950                         float   dwdy    = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth      / (float)viewportSize[1];
951                         lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, dwdx, 0.0f, dvdy, dwdy);
952
953                         // Append to texture list.
954                         m_textures.push_back(TextureBindingSp(new TextureBinding(texture3D.release(), m_textureSpec.sampler)));
955                         break;
956                 }
957
958                 case TEXTURETYPE_1D:
959                 {
960                         float                                                           levelStep               = isAutoLod ? 0.0f : 1.0f / (float)de::max(1, m_textureSpec.numLevels-1);
961                         Vec4                                                            cScale                  = fmtInfo.valueMax-fmtInfo.valueMin;
962                         Vec4                                                            cBias                   = fmtInfo.valueMin;
963                         int                                                                     baseCellSize    = m_textureSpec.width/4;
964                         de::MovePtr<tcu::Texture1D>                     texture1D;
965
966                         texture1D = de::MovePtr<tcu::Texture1D>(new tcu::Texture1D(texFmt, m_textureSpec.width));
967
968                         for (int level = 0; level < m_textureSpec.numLevels; level++)
969                         {
970                                 float   fA              = float(level)*levelStep;
971                                 float   fB              = 1.0f-fA;
972                                 Vec4    colorA  = cBias + cScale*Vec4(fA, fB, fA, fB);
973                                 Vec4    colorB  = cBias + cScale*Vec4(fB, fA, fB, fA);
974
975                                 texture1D->allocLevel(level);
976                                 tcu::fillWithGrid(texture1D->getLevel(level), de::max(1, baseCellSize>>level), colorA, colorB);
977                         }
978
979                         // Compute LOD.
980                         float   dudx    = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width   / (float)viewportSize[0];
981                         lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f);
982
983                         // Append to texture list.
984                         m_textures.push_back(TextureBindingSp(new TextureBinding(texture1D.release(), m_textureSpec.sampler)));
985                         break;
986                 }
987
988                 case TEXTURETYPE_1D_ARRAY:
989                 {
990                         float                                                           layerStep               = 1.0f / (float)m_textureSpec.depth;
991                         float                                                           levelStep               = isAutoLod ? 0.0f : 1.0f / (float)(de::max(1, m_textureSpec.numLevels-1)*m_textureSpec.depth);
992                         Vec4                                                            cScale                  = fmtInfo.valueMax-fmtInfo.valueMin;
993                         Vec4                                                            cBias                   = fmtInfo.valueMin;
994                         int                                                                     baseCellSize    = m_textureSpec.width/4;
995                         de::MovePtr<tcu::Texture1DArray>        texture1DArray;
996
997                         texture1DArray = de::MovePtr<tcu::Texture1DArray>(new tcu::Texture1DArray(texFmt, m_textureSpec.width, m_textureSpec.depth));
998
999                         for (int level = 0; level < m_textureSpec.numLevels; level++)
1000                         {
1001                                 texture1DArray->allocLevel(level);
1002                                 tcu::PixelBufferAccess levelAccess = texture1DArray->getLevel(level);
1003
1004                                 for (int layer = 0; layer < levelAccess.getHeight(); layer++)
1005                                 {
1006                                         float   fA              = (float)layer*layerStep + (float)level*levelStep;
1007                                         float   fB              = 1.0f-fA;
1008                                         Vec4    colorA  = cBias + cScale*Vec4(fA, fB, fA, fB);
1009                                         Vec4    colorB  = cBias + cScale*Vec4(fB, fA, fB, fA);
1010
1011                                         tcu::fillWithGrid(tcu::getSubregion(levelAccess, 0, layer, 0, levelAccess.getWidth(), 1, 1), de::max(1, baseCellSize>>level), colorA, colorB);
1012                                 }
1013                         }
1014
1015                         // Compute LOD.
1016                         float   dudx    = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width   / (float)viewportSize[0];
1017                         lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f);
1018
1019                         // Append to texture list.
1020                         m_textures.push_back(TextureBindingSp(new TextureBinding(texture1DArray.release(), m_textureSpec.sampler)));
1021                         break;
1022                 }
1023
1024                 case TEXTURETYPE_CUBE_ARRAY:
1025                 {
1026                         float                                                           layerStep                       = 1.0f / (float)(m_textureSpec.depth/6);
1027                         float                                                           levelStep                       = isAutoLod ? 0.0f : 1.0f / (float)(de::max(1, m_textureSpec.numLevels-1)*(m_textureSpec.depth/6));
1028                         Vec4                                                            cScale                          = fmtInfo.valueMax-fmtInfo.valueMin;
1029                         Vec4                                                            cBias                           = fmtInfo.valueMin;
1030                         Vec4                                                            cCorner                         = cBias + cScale*0.5f;
1031                         int                                                                     baseCellSize            = de::min(m_textureSpec.width/4, m_textureSpec.height/4);
1032                         de::MovePtr<tcu::TextureCubeArray>      textureCubeArray;
1033
1034                         DE_ASSERT(m_textureSpec.width == m_textureSpec.height);
1035                         DE_ASSERT(m_textureSpec.depth % 6 == 0);
1036
1037                         textureCubeArray = de::MovePtr<tcu::TextureCubeArray>(new tcu::TextureCubeArray(texFmt, m_textureSpec.width, m_textureSpec.depth));
1038
1039                         for (int level = 0; level < m_textureSpec.numLevels; level++)
1040                         {
1041                                 float   fA              = float(level)*levelStep;
1042                                 float   fB              = 1.0f-fA;
1043                                 Vec2    f               (fA, fB);
1044
1045                                 textureCubeArray->allocLevel(level);
1046                                 tcu::PixelBufferAccess levelAccess = textureCubeArray->getLevel(level);
1047
1048                                 for (int layer = 0; layer < m_textureSpec.depth/6; layer++)
1049                                 {
1050                                         float layerCorr = 1.0f-(float)layer*layerStep;
1051
1052                                         for (int face = 0; face < tcu::CUBEFACE_LAST; face++)
1053                                         {
1054                                                 const IVec4&    swzA    = texCubeSwz[face];
1055                                                 IVec4                   swzB    = 1-swzA;
1056                                                 Vec4                    colorA  = cBias + cScale*f.swizzle(swzA[0], swzA[1], swzA[2], swzA[3])*layerCorr;
1057                                                 Vec4                    colorB  = cBias + cScale*f.swizzle(swzB[0], swzB[1], swzB[2], swzB[3])*layerCorr;
1058
1059                                                 {
1060                                                         const tcu::PixelBufferAccess    access          = tcu::getSubregion(levelAccess, 0, 0, (layer*6)+face, levelAccess.getWidth(), levelAccess.getHeight(), 1);
1061                                                         const int                                               lastPix         = access.getWidth()-1;
1062
1063                                                         tcu::fillWithGrid(access, de::max(1, baseCellSize>>level), colorA, colorB);
1064
1065                                                         // Ensure all corners have identical colors in order to avoid dealing with ambiguous corner texel filtering
1066                                                         access.setPixel(cCorner, 0, 0);
1067                                                         access.setPixel(cCorner, 0, lastPix);
1068                                                         access.setPixel(cCorner, lastPix, 0);
1069                                                         access.setPixel(cCorner, lastPix, lastPix);
1070                                                 }
1071                                         }
1072                                 }
1073                         }
1074
1075                         // Compute LOD \note Assumes that only single side is accessed and R is constant major axis.
1076                         DE_ASSERT(de::abs(m_lookupSpec.minCoord[2] - m_lookupSpec.maxCoord[2]) < 0.005);
1077                         DE_ASSERT(de::abs(m_lookupSpec.minCoord[0]) < de::abs(m_lookupSpec.minCoord[2]) && de::abs(m_lookupSpec.maxCoord[0]) < de::abs(m_lookupSpec.minCoord[2]));
1078                         DE_ASSERT(de::abs(m_lookupSpec.minCoord[1]) < de::abs(m_lookupSpec.minCoord[2]) && de::abs(m_lookupSpec.maxCoord[1]) < de::abs(m_lookupSpec.minCoord[2]));
1079
1080                         tcu::CubeFaceFloatCoords        c00             = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
1081                         tcu::CubeFaceFloatCoords        c10             = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.maxCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
1082                         tcu::CubeFaceFloatCoords        c01             = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.maxCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
1083                         float                                           dudx    = (c10.s - c00.s)*(float)m_textureSpec.width    / (float)viewportSize[0];
1084                         float                                           dvdy    = (c01.t - c00.t)*(float)m_textureSpec.height   / (float)viewportSize[1];
1085                         lookupParams.lod = computeLodFromDerivates(DEFAULT_LOD_MODE, dudx, 0.0f, 0.0f, dvdy);
1086
1087                         // Append to texture list.
1088                         m_textures.push_back(TextureBindingSp(new TextureBinding(textureCubeArray.release(), m_textureSpec.sampler)));
1089                         break;
1090                 }
1091
1092                 default:
1093                         DE_ASSERT(DE_FALSE);
1094         }
1095
1096         // Set lookup scale & bias
1097         lookupParams.scale              = fmtInfo.lookupScale;
1098         lookupParams.bias               = fmtInfo.lookupBias;
1099         lookupParams.offset             = m_lookupSpec.offset;
1100
1101         // \todo [dirnerakos] Avoid const cast somehow
1102         const_cast<TexLookupParams&>(m_lookupParams) = lookupParams;
1103 }
1104
1105 class ShaderTextureFunctionCase : public ShaderRenderCase
1106 {
1107 public:
1108                                                                 ShaderTextureFunctionCase               (tcu::TestContext&                              testCtx,
1109                                                                                                                                  const std::string&                             name,
1110                                                                                                                                  const std::string&                             desc,
1111                                                                                                                                  const TextureLookupSpec&               lookup,
1112                                                                                                                                  const TextureSpec&                             texture,
1113                                                                                                                                  TexEvalFunc                                    evalFunc,
1114                                                                                                                                  bool                                                   isVertexCase);
1115         virtual                                         ~ShaderTextureFunctionCase              (void);
1116
1117         virtual TestInstance*           createInstance                                  (Context& context) const;
1118
1119 protected:
1120         const TextureLookupSpec         m_lookupSpec;
1121         const TextureSpec                       m_textureSpec;
1122         const TexLookupParams           m_lookupParams;
1123
1124         void                                            initShaderSources                               (void);
1125 };
1126
1127 ShaderTextureFunctionCase::ShaderTextureFunctionCase (tcu::TestContext&                         testCtx,
1128                                                                                                           const std::string&                    name,
1129                                                                                                           const std::string&                    desc,
1130                                                                                                           const TextureLookupSpec&              lookup,
1131                                                                                                           const TextureSpec&                    texture,
1132                                                                                                           TexEvalFunc                                   evalFunc,
1133                                                                                                           bool                                                  isVertexCase)
1134         : ShaderRenderCase              (testCtx, name, desc, isVertexCase, new TexLookupEvaluator(evalFunc, m_lookupParams), NULL, NULL)
1135         , m_lookupSpec                  (lookup)
1136         , m_textureSpec                 (texture)
1137 {
1138         initShaderSources();
1139 }
1140
1141 ShaderTextureFunctionCase::~ShaderTextureFunctionCase (void)
1142 {
1143 }
1144
1145 TestInstance* ShaderTextureFunctionCase::createInstance (Context& context) const
1146 {
1147         DE_ASSERT(m_evaluator != DE_NULL);
1148         DE_ASSERT(m_uniformSetup != DE_NULL);
1149         return new ShaderTextureFunctionInstance(context, m_isVertexCase, *m_evaluator, *m_uniformSetup, m_lookupSpec, m_textureSpec, m_lookupParams);
1150 }
1151
1152 void ShaderTextureFunctionCase::initShaderSources (void)
1153 {
1154         Function                        function                        = m_lookupSpec.function;
1155         bool                            isVtxCase                       = m_isVertexCase;
1156         bool                            isProj                          = functionHasProj(function);
1157         bool                            isGrad                          = functionHasGrad(function);
1158         bool                            isShadow                        = m_textureSpec.sampler.compare != tcu::Sampler::COMPAREMODE_NONE;
1159         bool                            is2DProj4                       = !isShadow && m_textureSpec.type == TEXTURETYPE_2D && (function == FUNCTION_TEXTUREPROJ || function == FUNCTION_TEXTUREPROJLOD || function == FUNCTION_TEXTUREPROJGRAD);
1160         bool                            is1DProj4                       = !isShadow && m_textureSpec.type == TEXTURETYPE_1D && (function == FUNCTION_TEXTUREPROJ || function == FUNCTION_TEXTUREPROJLOD || function == FUNCTION_TEXTUREPROJGRAD);
1161         bool                            isIntCoord                      = function == FUNCTION_TEXELFETCH;
1162         bool                            hasLodBias                      = functionHasLod(m_lookupSpec.function) || m_lookupSpec.useBias;
1163         int                                     texCoordComps           = m_textureSpec.type == TEXTURETYPE_1D ? 1 :
1164                                                                                           m_textureSpec.type == TEXTURETYPE_1D_ARRAY || m_textureSpec.type == TEXTURETYPE_2D ? 2 :
1165                                                                                           m_textureSpec.type == TEXTURETYPE_CUBE_ARRAY ? 4 :
1166                                                                                           3;
1167         int                                     extraCoordComps         = (isProj ? (is2DProj4 ? 2 : (is1DProj4 ? 3 : 1)) : 0) + (isShadow ? (m_textureSpec.type == TEXTURETYPE_1D ? 2 : 1) : 0);
1168         const bool                      isCubeArrayShadow       = isShadow && m_textureSpec.type == TEXTURETYPE_CUBE_ARRAY;
1169         glu::DataType           coordType                       = glu::getDataTypeFloatVec(isCubeArrayShadow ? 4 : texCoordComps+extraCoordComps);
1170         glu::Precision          coordPrec                       = glu::PRECISION_HIGHP;
1171         const char*                     coordTypeName           = glu::getDataTypeName(coordType);
1172         const char*                     coordPrecName           = glu::getPrecisionName(coordPrec);
1173         tcu::TextureFormat      texFmt                          = glu::mapGLInternalFormat(m_textureSpec.format);
1174         glu::DataType           samplerType                     = glu::TYPE_LAST;
1175         glu::DataType           gradType                        = m_textureSpec.type == TEXTURETYPE_1D || m_textureSpec.type == TEXTURETYPE_1D_ARRAY ? glu::TYPE_FLOAT :
1176                                                                                           m_textureSpec.type == TEXTURETYPE_3D || m_textureSpec.type == TEXTURETYPE_CUBE_MAP || m_textureSpec.type == TEXTURETYPE_CUBE_ARRAY ? glu::TYPE_FLOAT_VEC3 :
1177                                                                                           glu::TYPE_FLOAT_VEC2;
1178         const char*                     gradTypeName            = glu::getDataTypeName(gradType);
1179         const char*                     baseFuncName            = DE_NULL;
1180
1181         DE_ASSERT(!isGrad || !hasLodBias);
1182
1183         switch (m_textureSpec.type)
1184         {
1185                 case TEXTURETYPE_2D:                    samplerType = isShadow ? glu::TYPE_SAMPLER_2D_SHADOW                    : glu::getSampler2DType(texFmt);                break;
1186                 case TEXTURETYPE_CUBE_MAP:              samplerType = isShadow ? glu::TYPE_SAMPLER_CUBE_SHADOW                  : glu::getSamplerCubeType(texFmt);              break;
1187                 case TEXTURETYPE_2D_ARRAY:              samplerType = isShadow ? glu::TYPE_SAMPLER_2D_ARRAY_SHADOW              : glu::getSampler2DArrayType(texFmt);   break;
1188                 case TEXTURETYPE_3D:                    DE_ASSERT(!isShadow); samplerType = glu::getSampler3DType(texFmt);                                                                              break;
1189                 case TEXTURETYPE_1D:                    samplerType = isShadow ? glu::TYPE_SAMPLER_1D_SHADOW                    : glu::getSampler1DType(texFmt);                break;
1190                 case TEXTURETYPE_1D_ARRAY:              samplerType = isShadow ? glu::TYPE_SAMPLER_1D_ARRAY_SHADOW              : glu::getSampler1DArrayType(texFmt);   break;
1191                 case TEXTURETYPE_CUBE_ARRAY:    samplerType = isShadow ? glu::TYPE_SAMPLER_CUBE_ARRAY_SHADOW    : glu::getSamplerCubeArrayType(texFmt); break;
1192                 default:
1193                         DE_ASSERT(DE_FALSE);
1194         }
1195
1196         switch (m_lookupSpec.function)
1197         {
1198                 case FUNCTION_TEXTURE:                  baseFuncName = "texture";                       break;
1199                 case FUNCTION_TEXTUREPROJ:              baseFuncName = "textureProj";           break;
1200                 case FUNCTION_TEXTUREPROJ2:             baseFuncName = "textureProj";           break;
1201                 case FUNCTION_TEXTUREPROJ3:             baseFuncName = "textureProj";           break;
1202                 case FUNCTION_TEXTURELOD:               baseFuncName = "textureLod";            break;
1203                 case FUNCTION_TEXTUREPROJLOD:   baseFuncName = "textureProjLod";        break;
1204                 case FUNCTION_TEXTUREPROJLOD2:  baseFuncName = "textureProjLod";        break;
1205                 case FUNCTION_TEXTUREPROJLOD3:  baseFuncName = "textureProjLod";        break;
1206                 case FUNCTION_TEXTUREGRAD:              baseFuncName = "textureGrad";           break;
1207                 case FUNCTION_TEXTUREPROJGRAD:  baseFuncName = "textureProjGrad";       break;
1208                 case FUNCTION_TEXTUREPROJGRAD2: baseFuncName = "textureProjGrad";       break;
1209                 case FUNCTION_TEXTUREPROJGRAD3: baseFuncName = "textureProjGrad";       break;
1210                 case FUNCTION_TEXELFETCH:               baseFuncName = "texelFetch";            break;
1211                 default:
1212                         DE_ASSERT(DE_FALSE);
1213         }
1214
1215         std::ostringstream      vert;
1216         std::ostringstream      frag;
1217         std::ostringstream&     op              = isVtxCase ? vert : frag;
1218         glu::GLSLVersion        version = glu::GLSL_VERSION_LAST;
1219
1220         switch (m_textureSpec.type)
1221         {
1222                 case TEXTURETYPE_2D:
1223                 case TEXTURETYPE_3D:
1224                 case TEXTURETYPE_CUBE_MAP:
1225                 case TEXTURETYPE_2D_ARRAY:
1226                         version = glu::GLSL_VERSION_310_ES;
1227                         break;
1228
1229                 case TEXTURETYPE_1D:
1230                 case TEXTURETYPE_1D_ARRAY:
1231                 case TEXTURETYPE_CUBE_ARRAY:
1232                         version = glu::GLSL_VERSION_420;
1233                         break;
1234
1235                 default:
1236                         DE_ASSERT(DE_FALSE);
1237                         break;
1238         }
1239
1240         vert << glu::getGLSLVersionDeclaration(version) << "\n"
1241                  << "layout(location = 0) in highp vec4 a_position;\n"
1242                  << "layout(location = 4) in " << coordPrecName << " " << coordTypeName << " a_in0;\n";
1243
1244         if (isGrad)
1245         {
1246                 vert << "layout(location = 5) in " << coordPrecName << " " << gradTypeName << " a_in1;\n";
1247                 vert << "layout(location = 6) in " << coordPrecName << " " << gradTypeName << " a_in2;\n";
1248         }
1249         else if (hasLodBias)
1250                 vert << "layout(location = 5) in " << coordPrecName << " float a_in1;\n";
1251
1252         frag << glu::getGLSLVersionDeclaration(version) << "\n"
1253                  << "layout(location = 0) out mediump vec4 o_color;\n";
1254
1255         if (isVtxCase)
1256         {
1257                 vert << "layout(location = 0) out mediump vec4 v_color;\n";
1258                 frag << "layout(location = 0) in mediump vec4 v_color;\n";
1259         }
1260         else
1261         {
1262                 vert << "layout(location = 0) out " << coordPrecName << " " << coordTypeName << " v_texCoord;\n";
1263                 frag << "layout(location = 0) in " << coordPrecName << " " << coordTypeName << " v_texCoord;\n";
1264
1265                 if (isGrad)
1266                 {
1267                         vert << "layout(location = 1) out " << coordPrecName << " " << gradTypeName << " v_gradX;\n";
1268                         vert << "layout(location = 2) out " << coordPrecName << " " << gradTypeName << " v_gradY;\n";
1269                         frag << "layout(location = 1) in " << coordPrecName << " " << gradTypeName << " v_gradX;\n";
1270                         frag << "layout(location = 2) in " << coordPrecName << " " << gradTypeName << " v_gradY;\n";
1271                 }
1272                 else if (hasLodBias)
1273                 {
1274                         vert << "layout(location = 1) out " << coordPrecName << " float v_lodBias;\n";
1275                         frag << "layout(location = 1) in " << coordPrecName << " float v_lodBias;\n";
1276                 }
1277         }
1278
1279         // Uniforms
1280         op << "layout(set = 0, binding = 0) uniform highp " << glu::getDataTypeName(samplerType) << " u_sampler;\n"
1281            << "layout(set = 0, binding = 1) uniform buf0 { highp vec4 u_scale; };\n"
1282            << "layout(set = 0, binding = 2) uniform buf1 { highp vec4 u_bias; };\n";
1283
1284         if (version != glu::GLSL_VERSION_310_ES)
1285                 vert << "out gl_PerVertex {\n"
1286                          << "\tvec4 gl_Position;\n"
1287                          << "};\n";
1288
1289         vert << "\nvoid main()\n{\n"
1290                  << "\tgl_Position = a_position;\n";
1291         frag << "\nvoid main()\n{\n";
1292
1293         if (isVtxCase)
1294                 vert << "\tv_color = ";
1295         else
1296                 frag << "\to_color = ";
1297
1298         // Op.
1299         {
1300                 const char*     texCoord        = isVtxCase ? "a_in0" : "v_texCoord";
1301                 const char* gradX               = isVtxCase ? "a_in1" : "v_gradX";
1302                 const char* gradY               = isVtxCase ? "a_in2" : "v_gradY";
1303                 const char*     lodBias         = isVtxCase ? "a_in1" : "v_lodBias";
1304
1305                 op << "vec4(" << baseFuncName;
1306                 if (m_lookupSpec.useOffset)
1307                         op << "Offset";
1308                 op << "(u_sampler, ";
1309
1310                 if (isIntCoord)
1311                         op << glu::getDataTypeName(glu::getDataTypeIntVec(texCoordComps+extraCoordComps)) << "(";
1312
1313                 op << texCoord;
1314
1315                 if (isIntCoord)
1316                         op << ")";
1317
1318                 if (isGrad)
1319                         op << ", " << gradX << ", " << gradY;
1320
1321                 if (functionHasLod(function))
1322                 {
1323                         if (isIntCoord)
1324                                 op << ", int(" << lodBias << ")";
1325                         else
1326                                 op << ", " << lodBias;
1327                 }
1328
1329                 if (m_lookupSpec.useOffset)
1330                 {
1331                         int offsetComps = m_textureSpec.type == TEXTURETYPE_1D || m_textureSpec.type == TEXTURETYPE_1D_ARRAY ? 1 :
1332                                                           m_textureSpec.type == TEXTURETYPE_3D ? 3 : 2;
1333
1334                         op << ", " << glu::getDataTypeName(glu::getDataTypeIntVec(offsetComps)) << "(";
1335                         for (int ndx = 0; ndx < offsetComps; ndx++)
1336                         {
1337                                 if (ndx != 0)
1338                                         op << ", ";
1339                                 op << m_lookupSpec.offset[ndx];
1340                         }
1341                         op << ")";
1342                 }
1343
1344                 if (isCubeArrayShadow && m_lookupSpec.function == FUNCTION_TEXTURE)
1345                         op << ", " << texCoord << ".w";
1346
1347                 if (m_lookupSpec.useBias)
1348                         op << ", " << lodBias;
1349
1350                 op << ")";
1351
1352                 if (isShadow)
1353                         op << ", 0.0, 0.0, 1.0)";
1354                 else
1355                         op << ")*u_scale + u_bias";
1356
1357                 op << ";\n";
1358         }
1359
1360         if (isVtxCase)
1361                 frag << "\to_color = v_color;\n";
1362         else
1363         {
1364                 vert << "\tv_texCoord = a_in0;\n";
1365
1366                 if (isGrad)
1367                 {
1368                         vert << "\tv_gradX = a_in1;\n";
1369                         vert << "\tv_gradY = a_in2;\n";
1370                 }
1371                 else if (hasLodBias)
1372                         vert << "\tv_lodBias = a_in1;\n";
1373         }
1374
1375         vert << "}\n";
1376         frag << "}\n";
1377
1378         m_vertShaderSource = vert.str();
1379         m_fragShaderSource = frag.str();
1380 }
1381
1382 enum QueryFunction
1383 {
1384         QUERYFUNCTION_TEXTURESIZE = 0,
1385         QUERYFUNCTION_TEXTUREQUERYLOD,
1386         QUERYFUNCTION_TEXTUREQUERYLEVELS,
1387         QUERYFUNCTION_TEXTURESAMPLES,
1388
1389         QUERYFUNCTION_LAST
1390 };
1391
1392 class TextureQueryInstance : public ShaderRenderCaseInstance
1393 {
1394 public:
1395                                                                 TextureQueryInstance                    (Context&                                       context,
1396                                                                                                                                  const bool                                     isVertexCase,
1397                                                                                                                                  const TextureSpec&                     textureSpec);
1398         virtual                                         ~TextureQueryInstance                   (void);
1399
1400 protected:
1401         virtual void                            setupDefaultInputs                              (void);
1402         virtual void                            setupUniforms                                   (const tcu::Vec4&);
1403
1404         void                                            render                                                  (void);
1405
1406 protected:
1407         const TextureSpec&                      m_textureSpec;
1408 };
1409
1410 TextureQueryInstance::TextureQueryInstance (Context&                            context,
1411                                                                                         const bool                              isVertexCase,
1412                                                                                         const TextureSpec&              textureSpec)
1413         : ShaderRenderCaseInstance      (context, isVertexCase, DE_NULL, DE_NULL, DE_NULL)
1414         , m_textureSpec                         (textureSpec)
1415 {
1416         m_colorFormat = vk::VK_FORMAT_R32G32B32A32_SFLOAT;
1417
1418         checkDeviceFeatures(m_context, m_textureSpec.type);
1419 }
1420
1421 TextureQueryInstance::~TextureQueryInstance (void)
1422 {
1423 }
1424
1425 void TextureQueryInstance::setupDefaultInputs (void)
1426 {
1427         const deUint32          numVertices             = 4;
1428         const float                     positions[]             =
1429         {
1430                 -1.0f, -1.0f, 0.0f, 1.0f,
1431                 -1.0f,  1.0f, 0.0f, 1.0f,
1432                  1.0f, -1.0f, 0.0f, 1.0f,
1433                  1.0f,  1.0f, 0.0f, 1.0f
1434         };
1435
1436         addAttribute(0u, vk::VK_FORMAT_R32G32B32A32_SFLOAT, 4 * (deUint32)sizeof(float), numVertices, positions);
1437 }
1438
1439 void TextureQueryInstance::setupUniforms (const tcu::Vec4&)
1440 {
1441         useSampler(0u, 0u);
1442 }
1443
1444 void TextureQueryInstance::render (void)
1445 {
1446         const deUint32          numVertices             = 4;
1447         const deUint32          numTriangles    = 2;
1448         const deUint16          indices[6]              = { 0, 1, 2, 2, 1, 3 };
1449
1450         ShaderRenderCaseInstance::setup();
1451
1452         ShaderRenderCaseInstance::render(numVertices, numTriangles, indices);
1453 }
1454
1455 static int getMaxTextureSize (TextureType type, const tcu::IVec3& textureSize)
1456 {
1457         int             maxSize         = 0;
1458
1459         switch (type)
1460         {
1461                 case TEXTURETYPE_1D:
1462                 case TEXTURETYPE_1D_ARRAY:
1463                         maxSize = textureSize.x();
1464                         break;
1465
1466                 case TEXTURETYPE_2D:
1467                 case TEXTURETYPE_2D_ARRAY:
1468                 case TEXTURETYPE_CUBE_MAP:
1469                 case TEXTURETYPE_CUBE_ARRAY:
1470                         maxSize = de::max(textureSize.x(), textureSize.y());
1471                         break;
1472
1473                 case TEXTURETYPE_3D:
1474                         maxSize = de::max(textureSize.x(), de::max(textureSize.y(), textureSize.z()));
1475                         break;
1476
1477                 default:
1478                         DE_ASSERT(false);
1479         }
1480
1481         return maxSize;
1482 }
1483
1484 static std::string getTextureSizeString (TextureType type, const tcu::IVec3& textureSize)
1485 {
1486         std::ostringstream      str;
1487
1488         switch (type)
1489         {
1490                 case TEXTURETYPE_1D:
1491                         str << textureSize.x() << "x1";
1492                         break;
1493
1494                 case TEXTURETYPE_2D:
1495                 case TEXTURETYPE_CUBE_MAP:
1496                         str << textureSize.x() << "x" << textureSize.y();
1497                         break;
1498
1499                 case TEXTURETYPE_3D:
1500                         str << textureSize.x() << "x" << textureSize.y() << "x" << textureSize.z();
1501                         break;
1502
1503                 case TEXTURETYPE_1D_ARRAY:
1504                         str << textureSize.x() << "x1 with " << textureSize.z() << " layer(s)";
1505                         break;
1506
1507                 case TEXTURETYPE_2D_ARRAY:
1508                 case TEXTURETYPE_CUBE_ARRAY:
1509                         str << textureSize.x() << "x" << textureSize.y() << " with " << textureSize.z() << " layers(s)";
1510                         break;
1511
1512                 default:
1513                         DE_ASSERT(false);
1514                         break;
1515         }
1516
1517         return str.str();
1518 }
1519
1520 static bool isValidCase (TextureType type, const tcu::IVec3& textureSize, int lod, int lodBase)
1521 {
1522         const bool              isSquare                = textureSize.x() == textureSize.y();
1523         const bool              isCubeArray             = isSquare && (textureSize.z() % 6) == 0;
1524         const int               maxSize                 = getMaxTextureSize(type, textureSize);
1525         const bool              isLodValid              = (maxSize >> (lod + lodBase)) != 0;
1526
1527         if (!isLodValid)
1528                 return false;
1529         if (type == TEXTURETYPE_CUBE_MAP && !isSquare)
1530                 return false;
1531         if (type == TEXTURETYPE_CUBE_ARRAY && !isCubeArray)
1532                 return false;
1533
1534         return true;
1535 }
1536
1537 static TextureBindingSp createEmptyTexture (deUint32                            format,
1538                                                                                         TextureType                             type,
1539                                                                                         const tcu::IVec3&               textureSize,
1540                                                                                         int                                             numLevels,
1541                                                                                         int                                             lodBase,
1542                                                                                         const tcu::Sampler&             sampler)
1543 {
1544         const tcu::TextureFormat                        texFmt                          = glu::mapGLInternalFormat(format);
1545         const TextureBinding::Parameters        params                          (lodBase);
1546         TextureBindingSp                                        textureBinding;
1547
1548         switch (type)
1549         {
1550
1551                 case TEXTURETYPE_1D:
1552                 {
1553                         de::MovePtr<tcu::Texture1D>                     texture         (new tcu::Texture1D(texFmt, textureSize.x()));
1554
1555                         for (int level = 0; level < numLevels; level++)
1556                                 texture->allocLevel(level);
1557
1558                         textureBinding = TextureBindingSp(new TextureBinding(texture.release(), sampler));
1559                         break;
1560                 }
1561
1562                 case TEXTURETYPE_2D:
1563                 {
1564                         de::MovePtr<tcu::Texture2D>                     texture         (new tcu::Texture2D(texFmt, textureSize.x(), textureSize.y()));
1565
1566                         for (int level = 0; level < numLevels; level++)
1567                                 texture->allocLevel(level);
1568
1569                         textureBinding = TextureBindingSp(new TextureBinding(texture.release(), sampler));
1570                         break;
1571                 }
1572
1573                 case TEXTURETYPE_3D:
1574                 {
1575                         de::MovePtr<tcu::Texture3D>                     texture         (new tcu::Texture3D(texFmt, textureSize.x(), textureSize.y(), textureSize.z()));
1576
1577                         for (int level = 0; level < numLevels; level++)
1578                                 texture->allocLevel(level);
1579
1580                         textureBinding = TextureBindingSp(new TextureBinding(texture.release(), sampler));
1581                         break;
1582                 }
1583
1584                 case TEXTURETYPE_CUBE_MAP:
1585                 {
1586                         de::MovePtr<tcu::TextureCube>           texture         (new tcu::TextureCube(texFmt, textureSize.x()));
1587
1588                         for (int level = 0; level < numLevels; level++)
1589                                 for (int face = 0; face < tcu::CUBEFACE_LAST; face++)
1590                                         texture->allocLevel((tcu::CubeFace)face, level);
1591
1592                         textureBinding = TextureBindingSp(new TextureBinding(texture.release(), sampler));
1593                         break;
1594                 }
1595
1596                 case TEXTURETYPE_1D_ARRAY:
1597                 {
1598                         de::MovePtr<tcu::Texture1DArray>        texture         (new tcu::Texture1DArray(texFmt, textureSize.x(), textureSize.z()));
1599
1600                         for (int level = 0; level < numLevels; level++)
1601                                 texture->allocLevel(level);
1602
1603                         textureBinding = TextureBindingSp(new TextureBinding(texture.release(), sampler));
1604                         break;
1605                 }
1606
1607                 case TEXTURETYPE_2D_ARRAY:
1608                 {
1609                         de::MovePtr<tcu::Texture2DArray>        texture         (new tcu::Texture2DArray(texFmt, textureSize.x(), textureSize.y(), textureSize.z()));
1610
1611                         for (int level = 0; level < numLevels; level++)
1612                                 texture->allocLevel(level);
1613
1614                         textureBinding = TextureBindingSp(new TextureBinding(texture.release(), sampler));
1615                         break;
1616                 }
1617
1618                 case TEXTURETYPE_CUBE_ARRAY:
1619                 {
1620                         de::MovePtr<tcu::TextureCubeArray>      texture         (new tcu::TextureCubeArray(texFmt, textureSize.x(), textureSize.z()));
1621
1622                         for (int level = 0; level < numLevels; level++)
1623                                 texture->allocLevel(level);
1624
1625                         textureBinding = TextureBindingSp(new TextureBinding(texture.release(), sampler));
1626                         break;
1627                 }
1628
1629                 default:
1630                         DE_ASSERT(false);
1631                         break;
1632         }
1633
1634         textureBinding->setParameters(params);
1635         return textureBinding;
1636 }
1637
1638 static inline glu::DataType getTextureSizeFuncResultType (TextureType textureType)
1639 {
1640         switch (textureType)
1641         {
1642                 case TEXTURETYPE_1D:
1643                         return glu::TYPE_INT;
1644
1645                 case TEXTURETYPE_2D:
1646                 case TEXTURETYPE_CUBE_MAP:
1647                 case TEXTURETYPE_1D_ARRAY:
1648                         return glu::TYPE_INT_VEC2;
1649
1650                 case TEXTURETYPE_3D:
1651                 case TEXTURETYPE_2D_ARRAY:
1652                 case TEXTURETYPE_CUBE_ARRAY:
1653                         return glu::TYPE_INT_VEC3;
1654
1655                 default:
1656                         DE_ASSERT(false);
1657                         return glu::TYPE_LAST;
1658         }
1659 }
1660
1661 class TextureSizeInstance : public TextureQueryInstance
1662 {
1663 public:
1664                                                                 TextureSizeInstance                             (Context&                                       context,
1665                                                                                                                                  const bool                                     isVertexCase,
1666                                                                                                                                  const TextureSpec&                     textureSpec);
1667         virtual                                         ~TextureSizeInstance                    (void);
1668
1669         virtual tcu::TestStatus         iterate                                                 (void);
1670
1671 protected:
1672         virtual void                            setupUniforms                                   (const tcu::Vec4& constCoords);
1673
1674 private:
1675         struct TestSize
1676         {
1677                 tcu::IVec3      textureSize;
1678                 int                     lod;
1679                 int                     lodBase;
1680                 tcu::IVec3      expectedSize;
1681         };
1682
1683         void                                            initTexture                                             (void);
1684         bool                                            testTextureSize                                 (void);
1685
1686         TestSize                                        m_testSize;
1687         tcu::IVec3                                      m_expectedSize;
1688         int                                                     m_iterationCounter;
1689 };
1690
1691 TextureSizeInstance::TextureSizeInstance (Context&                                      context,
1692                                                                                   const bool                            isVertexCase,
1693                                                                                   const TextureSpec&            textureSpec)
1694         : TextureQueryInstance          (context, isVertexCase, textureSpec)
1695         , m_testSize                            ()
1696         , m_expectedSize                        ()
1697         , m_iterationCounter            (0)
1698 {
1699         deMemset(&m_testSize, 0, sizeof(TestSize));
1700
1701         m_renderSize = tcu::UVec2(1, 1);
1702 }
1703
1704 TextureSizeInstance::~TextureSizeInstance (void)
1705 {
1706 }
1707
1708 void TextureSizeInstance::setupUniforms (const tcu::Vec4& constCoords)
1709 {
1710         TextureQueryInstance::setupUniforms(constCoords);
1711         addUniform(1u, vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, sizeof(int), &m_testSize.lod);
1712 }
1713
1714 void TextureSizeInstance::initTexture (void)
1715 {
1716         tcu::TestLog&                   log                                     = m_context.getTestContext().getLog();
1717         const int                               numLevels                       = m_testSize.lod + m_testSize.lodBase + 1;
1718         TextureBindingSp                textureBinding;
1719
1720         log << tcu::TestLog::Message << "Testing image size " << getTextureSizeString(m_textureSpec.type, m_testSize.textureSize) << tcu::TestLog::EndMessage;
1721         log << tcu::TestLog::Message << "Lod: " << m_testSize.lod << ", base level: " << m_testSize.lodBase << tcu::TestLog::EndMessage;
1722
1723         switch (m_textureSpec.type)
1724         {
1725                 case TEXTURETYPE_3D:
1726                         log << tcu::TestLog::Message << "Expecting: " << m_testSize.expectedSize.x() << "x" << m_testSize.expectedSize.y() << "x" << m_testSize.expectedSize.z() << tcu::TestLog::EndMessage;
1727                         break;
1728
1729                 case TEXTURETYPE_2D:
1730                         log << tcu::TestLog::Message << "Expecting: " << m_testSize.expectedSize.x() << "x" << m_testSize.expectedSize.y() << tcu::TestLog::EndMessage;
1731                         break;
1732
1733                 case TEXTURETYPE_CUBE_MAP:
1734                         log << tcu::TestLog::Message << "Expecting: " << m_testSize.expectedSize.x() << "x" << m_testSize.expectedSize.y() << tcu::TestLog::EndMessage;
1735                         break;
1736
1737                 case TEXTURETYPE_2D_ARRAY:
1738                         log << tcu::TestLog::Message << "Expecting: " << m_testSize.expectedSize.x() << "x" << m_testSize.expectedSize.y() << " and " << m_testSize.textureSize.z() << " layer(s)" << tcu::TestLog::EndMessage;
1739                         break;
1740
1741                 case TEXTURETYPE_CUBE_ARRAY:
1742                         log << tcu::TestLog::Message << "Expecting: " << m_testSize.expectedSize.x() << "x" << m_testSize.expectedSize.y() << " and " << (m_testSize.textureSize.z() / 6) << " cube(s)" << tcu::TestLog::EndMessage;
1743                         break;
1744
1745                 case TEXTURETYPE_1D:
1746                         log << tcu::TestLog::Message << "Expecting: " << m_testSize.expectedSize.x() << tcu::TestLog::EndMessage;
1747                         break;
1748
1749                 case TEXTURETYPE_1D_ARRAY:
1750                         log << tcu::TestLog::Message << "Expecting: " << m_testSize.expectedSize.x() << " and " << m_testSize.textureSize.z() << " layer(s)" << tcu::TestLog::EndMessage;
1751                         break;
1752
1753                 default:
1754                         DE_ASSERT(false);
1755                         break;
1756         }
1757
1758         textureBinding = createEmptyTexture(m_textureSpec.format, m_textureSpec.type, m_testSize.textureSize, numLevels, m_testSize.lodBase, m_textureSpec.sampler);
1759
1760         m_textures.clear();
1761         m_textures.push_back(textureBinding);
1762 }
1763
1764 tcu::TestStatus TextureSizeInstance::iterate (void)
1765 {
1766         const TestSize testSizes[] =
1767         {
1768                 { tcu::IVec3(1, 2, 1),                  0,              0,      tcu::IVec3(1, 2, 1)                     },
1769                 { tcu::IVec3(1, 2, 1),                  1,              0,      tcu::IVec3(1, 1, 1)                     },
1770
1771                 { tcu::IVec3(1, 3, 2),                  0,              0,      tcu::IVec3(1, 3, 2)                     },
1772                 { tcu::IVec3(1, 3, 2),                  1,              0,      tcu::IVec3(1, 1, 1)                     },
1773
1774                 { tcu::IVec3(100, 31, 18),              0,              0,      tcu::IVec3(100, 31, 18)         },
1775                 { tcu::IVec3(100, 31, 18),              1,              0,      tcu::IVec3(50, 15, 9)           },
1776                 { tcu::IVec3(100, 31, 18),              2,              0,      tcu::IVec3(25, 7, 4)            },
1777                 { tcu::IVec3(100, 31, 18),              3,              0,      tcu::IVec3(12, 3, 2)            },
1778                 { tcu::IVec3(100, 31, 18),              4,              0,      tcu::IVec3(6, 1, 1)                     },
1779                 { tcu::IVec3(100, 31, 18),              5,              0,      tcu::IVec3(3, 1, 1)                     },
1780                 { tcu::IVec3(100, 31, 18),              6,              0,      tcu::IVec3(1, 1, 1)                     },
1781
1782                 { tcu::IVec3(100, 128, 32),             0,              0,      tcu::IVec3(100, 128, 32)        },
1783                 { tcu::IVec3(100, 128, 32),             1,              0,      tcu::IVec3(50, 64, 16)          },
1784                 { tcu::IVec3(100, 128, 32),             2,              0,      tcu::IVec3(25, 32, 8)           },
1785                 { tcu::IVec3(100, 128, 32),             3,              0,      tcu::IVec3(12, 16, 4)           },
1786                 { tcu::IVec3(100, 128, 32),             4,              0,      tcu::IVec3(6, 8, 2)                     },
1787                 { tcu::IVec3(100, 128, 32),             5,              0,      tcu::IVec3(3, 4, 1)                     },
1788                 { tcu::IVec3(100, 128, 32),             6,              0,      tcu::IVec3(1, 2, 1)                     },
1789                 { tcu::IVec3(100, 128, 32),             7,              0,      tcu::IVec3(1, 1, 1)                     },
1790
1791                 // pow 2
1792                 { tcu::IVec3(128, 64, 32),              0,              0,      tcu::IVec3(128, 64, 32)         },
1793                 { tcu::IVec3(128, 64, 32),              1,              0,      tcu::IVec3(64, 32, 16)          },
1794                 { tcu::IVec3(128, 64, 32),              2,              0,      tcu::IVec3(32, 16, 8)           },
1795                 { tcu::IVec3(128, 64, 32),              3,              0,      tcu::IVec3(16, 8, 4)            },
1796                 { tcu::IVec3(128, 64, 32),              4,              0,      tcu::IVec3(8, 4, 2)                     },
1797                 { tcu::IVec3(128, 64, 32),              5,              0,      tcu::IVec3(4, 2, 1)                     },
1798                 { tcu::IVec3(128, 64, 32),              6,              0,      tcu::IVec3(2, 1, 1)                     },
1799                 { tcu::IVec3(128, 64, 32),              7,              0,      tcu::IVec3(1, 1, 1)                     },
1800
1801                 // w == h
1802                 { tcu::IVec3(1, 1, 1),                  0,              0,      tcu::IVec3(1, 1, 1)                     },
1803                 { tcu::IVec3(64, 64, 64),               0,              0,      tcu::IVec3(64, 64, 64)          },
1804                 { tcu::IVec3(64, 64, 64),               1,              0,      tcu::IVec3(32, 32, 32)          },
1805                 { tcu::IVec3(64, 64, 64),               2,              0,      tcu::IVec3(16, 16, 16)          },
1806                 { tcu::IVec3(64, 64, 64),               3,              0,      tcu::IVec3(8, 8, 8)                     },
1807                 { tcu::IVec3(64, 64, 64),               4,              0,      tcu::IVec3(4, 4, 4)                     },
1808
1809                 // with lod base
1810                 { tcu::IVec3(100, 31, 18),              3,              1,      tcu::IVec3(6, 1, 1)                     },
1811                 { tcu::IVec3(128, 64, 32),              3,              1,      tcu::IVec3(8, 4, 2)                     },
1812                 { tcu::IVec3(64, 64, 64),               1,              1,      tcu::IVec3(16, 16, 16)          },
1813
1814                 // w == h and d % 6 == 0 (for cube array)
1815                 { tcu::IVec3(1, 1, 6),                  0,              0,      tcu::IVec3(1, 1, 6)                     },
1816                 { tcu::IVec3(32, 32, 12),               0,              0,      tcu::IVec3(32, 32, 12)          },
1817                 { tcu::IVec3(32, 32, 12),               0,              1,      tcu::IVec3(16, 16, 6)           },
1818                 { tcu::IVec3(32, 32, 12),               1,              0,      tcu::IVec3(16, 16, 6)           },
1819                 { tcu::IVec3(32, 32, 12),               2,              0,      tcu::IVec3(8, 8, 3)                     },
1820                 { tcu::IVec3(32, 32, 12),               3,              0,      tcu::IVec3(4, 4, 1)                     },
1821                 { tcu::IVec3(32, 32, 12),               4,              0,      tcu::IVec3(2, 2, 1)                     },
1822                 { tcu::IVec3(32, 32, 12),               5,              0,      tcu::IVec3(1, 1, 1)                     },
1823         };
1824         const int lastIterationIndex = DE_LENGTH_OF_ARRAY(testSizes) + 1;
1825
1826         m_iterationCounter++;
1827
1828         if (m_iterationCounter == lastIterationIndex)
1829                 return tcu::TestStatus::pass("Pass");
1830         else
1831         {
1832                 // set current test size
1833                 m_testSize = testSizes[m_iterationCounter - 1];
1834
1835                 if (!testTextureSize())
1836                         return tcu::TestStatus::fail("Got unexpected result");
1837
1838                 return tcu::TestStatus::incomplete();
1839         }
1840 }
1841
1842 bool TextureSizeInstance::testTextureSize (void)
1843 {
1844         tcu::TestLog&                   log                             = m_context.getTestContext().getLog();
1845         bool                                    success                 = true;
1846
1847         // skip incompatible cases
1848         if (!isValidCase(m_textureSpec.type, m_testSize.textureSize, m_testSize.lod, m_testSize.lodBase))
1849                 return true;
1850
1851         // setup texture
1852         initTexture();
1853
1854         // determine expected texture size
1855         switch (m_textureSpec.type)
1856         {
1857                 case TEXTURETYPE_1D:
1858                 case TEXTURETYPE_2D:
1859                 case TEXTURETYPE_3D:
1860                 case TEXTURETYPE_CUBE_MAP:
1861                         m_expectedSize = m_testSize.expectedSize;
1862                         break;
1863
1864                 case TEXTURETYPE_1D_ARRAY:
1865                         m_expectedSize = tcu::IVec3(m_testSize.expectedSize.x(), m_testSize.textureSize.z(), 0);
1866                         break;
1867
1868                 case TEXTURETYPE_2D_ARRAY:
1869                         m_expectedSize = tcu::IVec3(m_testSize.expectedSize.x(), m_testSize.expectedSize.y(), m_testSize.textureSize.z());
1870                         break;
1871
1872                 case TEXTURETYPE_CUBE_ARRAY:
1873                         m_expectedSize = tcu::IVec3(m_testSize.expectedSize.x(), m_testSize.expectedSize.y(), m_testSize.textureSize.z() / 6);
1874                         break;
1875
1876                 default:
1877                         DE_ASSERT(false);
1878                         break;
1879         }
1880
1881         // render
1882         TextureQueryInstance::render();
1883
1884         // test
1885         {
1886                 const tcu::TextureLevel&        result                          = getResultImage();
1887                 tcu::IVec4                                      output                          = result.getAccess().getPixelInt(0, 0);
1888                 const int                                       resultComponents        = glu::getDataTypeScalarSize(getTextureSizeFuncResultType(m_textureSpec.type));
1889
1890                 for (int ndx = 0; ndx < resultComponents; ndx++)
1891                 {
1892                         if (output[ndx] != m_expectedSize[ndx])
1893                         {
1894                                 success = false;
1895                                 break;
1896                         }
1897                 }
1898
1899                 if (success)
1900                 {
1901                         // success
1902                         log << tcu::TestLog::Message << "Passed" << tcu::TestLog::EndMessage;
1903                 }
1904                 else
1905                 {
1906                         // failure
1907                         std::stringstream       resultSizeStr;
1908                         switch (resultComponents)
1909                         {
1910                                 case 1:
1911                                         resultSizeStr << output[0];
1912                                         break;
1913                                 case 2:
1914                                         resultSizeStr << output.toWidth<2>();
1915                                         break;
1916                                 case 3:
1917                                         resultSizeStr << output.toWidth<3>();
1918                                         break;
1919                                 default:
1920                                         DE_ASSERT(false);
1921                                         break;
1922                         }
1923                         log << tcu::TestLog::Message << "Result: " << resultSizeStr.str() << tcu::TestLog::EndMessage;
1924                         log << tcu::TestLog::Message << "Failed" << tcu::TestLog::EndMessage;
1925                 }
1926         }
1927
1928         log << tcu::TestLog::Message << tcu::TestLog::EndMessage;
1929
1930         return success;
1931 }
1932
1933 static vk::VkImageType getVkImageType (TextureType type)
1934 {
1935         switch (type)
1936         {
1937                 case TEXTURETYPE_1D:
1938                 case TEXTURETYPE_1D_ARRAY:
1939                         return vk::VK_IMAGE_TYPE_1D;
1940
1941                 case TEXTURETYPE_2D:
1942                 case TEXTURETYPE_2D_ARRAY:
1943                 case TEXTURETYPE_CUBE_MAP:
1944                 case TEXTURETYPE_CUBE_ARRAY:
1945                         return vk::VK_IMAGE_TYPE_2D;
1946
1947                 case TEXTURETYPE_3D:
1948                         return vk::VK_IMAGE_TYPE_3D;
1949
1950                 default:
1951                         DE_ASSERT(false);
1952                         return (vk::VkImageType)0;
1953         }
1954 }
1955
1956 class TextureSamplesInstance : public TextureQueryInstance
1957 {
1958 public:
1959                                                                 TextureSamplesInstance                  (Context&                                       context,
1960                                                                                                                                  const bool                                     isVertexCase,
1961                                                                                                                                  const TextureSpec&                     textureSpec);
1962         virtual                                         ~TextureSamplesInstance                 (void);
1963
1964         virtual tcu::TestStatus         iterate                                                 (void);
1965
1966 private:
1967         void                                            initTexture                                             (void);
1968
1969         int                                                                             m_iterationCounter;
1970         vector<vk::VkSampleCountFlagBits>               m_iterations;
1971 };
1972
1973 TextureSamplesInstance::TextureSamplesInstance (Context&                                context,
1974                                                                                                 const bool                              isVertexCase,
1975                                                                                                 const TextureSpec&              textureSpec)
1976         : TextureQueryInstance          (context, isVertexCase, textureSpec)
1977         , m_iterationCounter            (0)
1978 {
1979         m_renderSize = tcu::UVec2(1, 1);
1980
1981         // determine available sample counts
1982         {
1983                 const vk::VkFormat                                              format                  = vk::mapTextureFormat(glu::mapGLInternalFormat(m_textureSpec.format));
1984                 const vk::VkImageType                                   imageType               = getVkImageType(m_textureSpec.type);
1985                 vk::VkImageFormatProperties                             properties;
1986
1987                 if (m_context.getInstanceInterface().getPhysicalDeviceImageFormatProperties(m_context.getPhysicalDevice(),
1988                                                                                                                                                                         format,
1989                                                                                                                                                                         imageType,
1990                                                                                                                                                                         vk::VK_IMAGE_TILING_OPTIMAL,
1991                                                                                                                                                                         vk::VK_IMAGE_USAGE_SAMPLED_BIT | vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT,
1992                                                                                                                                                                         (vk::VkImageCreateFlags)0,
1993                                                                                                                                                                         &properties) == vk::VK_ERROR_FORMAT_NOT_SUPPORTED)
1994                         TCU_THROW(NotSupportedError, "Format not supported");
1995
1996                 // NOTE: The test case initializes MS images (for all supported N of samples), runs a program
1997                 //       which invokes OpImageQuerySamples against the image and checks the result.
1998                 //
1999                 //       Now, in the SPIR-V spec for the very operation we have the following language:
2000                 //
2001                 //       OpImageQuerySamples
2002                 //       Query the number of samples available per texel fetch in a multisample image.
2003                 //       Result Type must be a scalar integer type.
2004                 //       The result is the number of samples.
2005                 //       Image must be an object whose type is OpTypeImage.
2006                 //       Its Dim operand must be one of 2D and **MS of 1(multisampled).
2007                 //
2008                 //       "MS of 1" implies the image must not be single-sample, meaning we must exclude
2009                 //       VK_SAMPLE_COUNT_1_BIT in the sampleFlags array below, and may have to skip further testing.
2010                 static const vk::VkSampleCountFlagBits  sampleFlags[]   =
2011                 {
2012                         vk::VK_SAMPLE_COUNT_2_BIT,
2013                         vk::VK_SAMPLE_COUNT_4_BIT,
2014                         vk::VK_SAMPLE_COUNT_8_BIT,
2015                         vk::VK_SAMPLE_COUNT_16_BIT,
2016                         vk::VK_SAMPLE_COUNT_32_BIT,
2017                         vk::VK_SAMPLE_COUNT_64_BIT
2018                 };
2019
2020                 for (int samplesNdx = 0; samplesNdx < DE_LENGTH_OF_ARRAY(sampleFlags); samplesNdx++)
2021                 {
2022                         const vk::VkSampleCountFlagBits&        flag                    = sampleFlags[samplesNdx];
2023
2024                         if ((properties.sampleCounts & flag) != 0)
2025                                 m_iterations.push_back(flag);
2026                 }
2027
2028                 if (m_iterations.empty())
2029                 {
2030                         // Sampled images of integer formats may support only 1 sample. Exit the test with "Not supported" in these cases.
2031                         if (tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER ||
2032                                 tcu::getTextureChannelClass(mapVkFormat(format).type) == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
2033                         {
2034                                 TCU_THROW(NotSupportedError, "Skipping validation of integer formats as only VK_SAMPLE_COUNT_1_BIT is supported.");
2035                         }
2036
2037                         DE_ASSERT(false);
2038                 }
2039         }
2040
2041         // setup texture
2042         initTexture();
2043 }
2044
2045 TextureSamplesInstance::~TextureSamplesInstance (void)
2046 {
2047 }
2048
2049 tcu::TestStatus TextureSamplesInstance::iterate (void)
2050 {
2051         tcu::TestLog&           log             = m_context.getTestContext().getLog();
2052
2053         // update samples count
2054         {
2055                 DE_ASSERT(m_textures.size() == 1);
2056
2057                 TextureBinding::Parameters      params  = m_textures[0]->getParameters();
2058
2059                 params.initialization   = TextureBinding::INIT_CLEAR;
2060                 params.samples                  = m_iterations[m_iterationCounter];
2061                 log << tcu::TestLog::Message << "Expected samples: " << m_iterations[m_iterationCounter] << tcu::TestLog::EndMessage;
2062
2063                 m_textures[0]->setParameters(params);
2064         }
2065
2066         // render
2067         TextureQueryInstance::render();
2068
2069         // test
2070         {
2071                 const tcu::TextureLevel&        result                          = getResultImage();
2072                 tcu::IVec4                                      output                          = result.getAccess().getPixelInt(0, 0);
2073
2074                 if (output.x() == (int)m_iterations[m_iterationCounter])
2075                 {
2076                         // success
2077                         log << tcu::TestLog::Message << "Passed" << tcu::TestLog::EndMessage;
2078                 }
2079                 else
2080                 {
2081                         // failure
2082                         log << tcu::TestLog::Message << "Result: " << output.x() << tcu::TestLog::EndMessage;
2083                         log << tcu::TestLog::Message << "Failed" << tcu::TestLog::EndMessage;
2084                         return tcu::TestStatus::fail("Got unexpected result");
2085                 }
2086
2087                 m_iterationCounter++;
2088                 if (m_iterationCounter == (int)m_iterations.size())
2089                         return tcu::TestStatus::pass("Pass");
2090                 else
2091                         return tcu::TestStatus::incomplete();
2092         }
2093 }
2094
2095 void TextureSamplesInstance::initTexture (void)
2096 {
2097         tcu::TestLog&                   log                                     = m_context.getTestContext().getLog();
2098         tcu::IVec3                              textureSize                     (m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth);
2099         TextureBindingSp                textureBinding;
2100
2101         DE_ASSERT(m_textures.empty());
2102         DE_ASSERT(m_textureSpec.type == TEXTURETYPE_2D || m_textureSpec.type == TEXTURETYPE_2D_ARRAY);
2103
2104         log << tcu::TestLog::Message << "Image size: " << getTextureSizeString(m_textureSpec.type, textureSize) << tcu::TestLog::EndMessage;
2105
2106         textureBinding = createEmptyTexture(m_textureSpec.format, m_textureSpec.type, textureSize, m_textureSpec.numLevels, 0 /* lodBase */, m_textureSpec.sampler);
2107
2108         m_textures.push_back(textureBinding);
2109 }
2110
2111 class TextureQueryLevelsInstance : public TextureQueryInstance
2112 {
2113 public:
2114                                                                 TextureQueryLevelsInstance              (Context&                                       context,
2115                                                                                                                                  const bool                                     isVertexCase,
2116                                                                                                                                  const TextureSpec&                     textureSpec);
2117         virtual                                         ~TextureQueryLevelsInstance             (void);
2118
2119         virtual tcu::TestStatus         iterate                                                 (void);
2120
2121 private:
2122         struct TestSize
2123         {
2124                 tcu::IVec3      textureSize;
2125                 int                     lodBase;
2126         };
2127
2128         void                                            initTexture                                             (void);
2129         bool                                            testTextureLevels                               (void);
2130
2131         TestSize                                        m_testSize;
2132         int                                                     m_levels;
2133         int                                                     m_iterationCounter;
2134 };
2135
2136 TextureQueryLevelsInstance::TextureQueryLevelsInstance (Context&                                context,
2137                                                                                                                 const bool                              isVertexCase,
2138                                                                                                                 const TextureSpec&              textureSpec)
2139         : TextureQueryInstance          (context, isVertexCase, textureSpec)
2140         , m_testSize                            ()
2141         , m_levels                                      (0)
2142         , m_iterationCounter            (0)
2143 {
2144         deMemset(&m_testSize, 0, sizeof(TestSize));
2145
2146         m_renderSize = tcu::UVec2(1, 1);
2147 }
2148
2149 TextureQueryLevelsInstance::~TextureQueryLevelsInstance (void)
2150 {
2151 }
2152
2153 tcu::TestStatus TextureQueryLevelsInstance::iterate (void)
2154 {
2155         const TestSize testSizes[] =
2156         {
2157                 { tcu::IVec3(1, 2, 1),                  0       },
2158                 { tcu::IVec3(1, 2, 1),                  1       },
2159
2160                 { tcu::IVec3(1, 3, 2),                  0       },
2161                 { tcu::IVec3(1, 3, 2),                  1       },
2162
2163                 { tcu::IVec3(100, 31, 18),              0       },
2164                 { tcu::IVec3(100, 31, 18),              1       },
2165                 { tcu::IVec3(100, 31, 18),              2       },
2166                 { tcu::IVec3(100, 31, 18),              3       },
2167                 { tcu::IVec3(100, 31, 18),              4       },
2168                 { tcu::IVec3(100, 31, 18),              5       },
2169                 { tcu::IVec3(100, 31, 18),              6       },
2170
2171                 { tcu::IVec3(100, 128, 32),             0       },
2172                 { tcu::IVec3(100, 128, 32),             1       },
2173                 { tcu::IVec3(100, 128, 32),             2       },
2174                 { tcu::IVec3(100, 128, 32),             3       },
2175                 { tcu::IVec3(100, 128, 32),             4       },
2176                 { tcu::IVec3(100, 128, 32),             5       },
2177                 { tcu::IVec3(100, 128, 32),             6       },
2178                 { tcu::IVec3(100, 128, 32),             7       },
2179
2180                 // pow 2
2181                 { tcu::IVec3(128, 64, 32),              0       },
2182                 { tcu::IVec3(128, 64, 32),              1       },
2183                 { tcu::IVec3(128, 64, 32),              2       },
2184                 { tcu::IVec3(128, 64, 32),              3       },
2185                 { tcu::IVec3(128, 64, 32),              4       },
2186                 { tcu::IVec3(128, 64, 32),              5       },
2187                 { tcu::IVec3(128, 64, 32),              6       },
2188                 { tcu::IVec3(128, 64, 32),              7       },
2189
2190                 // w == h
2191                 { tcu::IVec3(1, 1, 1),                  0       },
2192                 { tcu::IVec3(64, 64, 64),               0       },
2193                 { tcu::IVec3(64, 64, 64),               1       },
2194                 { tcu::IVec3(64, 64, 64),               2       },
2195                 { tcu::IVec3(64, 64, 64),               3       },
2196                 { tcu::IVec3(64, 64, 64),               4       },
2197                 { tcu::IVec3(64, 64, 64),               5       },
2198                 { tcu::IVec3(64, 64, 64),               6       },
2199
2200                 // w == h and d % 6 == 0 (for cube array)
2201                 { tcu::IVec3(1, 1, 6),                  0       },
2202                 { tcu::IVec3(32, 32, 12),               0       },
2203                 { tcu::IVec3(32, 32, 12),               1       },
2204                 { tcu::IVec3(32, 32, 12),               2       },
2205                 { tcu::IVec3(32, 32, 12),               3       },
2206                 { tcu::IVec3(32, 32, 12),               4       },
2207                 { tcu::IVec3(32, 32, 12),               5       },
2208         };
2209         const int lastIterationIndex = DE_LENGTH_OF_ARRAY(testSizes) + 1;
2210
2211         m_iterationCounter++;
2212
2213         if (m_iterationCounter == lastIterationIndex)
2214                 return tcu::TestStatus::pass("Pass");
2215         else
2216         {
2217                 // set current test size
2218                 m_testSize = testSizes[m_iterationCounter - 1];
2219
2220                 if (!testTextureLevels())
2221                         return tcu::TestStatus::fail("Got unexpected result");
2222
2223                 return tcu::TestStatus::incomplete();
2224         }
2225 }
2226
2227 bool TextureQueryLevelsInstance::testTextureLevels (void)
2228 {
2229         tcu::TestLog&                   log                             = m_context.getTestContext().getLog();
2230         bool                                    success                 = true;
2231
2232         // skip incompatible cases
2233         if (!isValidCase(m_textureSpec.type, m_testSize.textureSize, 0, m_testSize.lodBase))
2234                 return true;
2235
2236         // setup texture
2237         initTexture();
2238
2239         // calculate accessible levels
2240         {
2241                 const int       mipLevels       = deLog2Floor32(getMaxTextureSize(m_textureSpec.type, m_testSize.textureSize)) + 1;
2242
2243                 m_levels = mipLevels - m_testSize.lodBase;
2244                 DE_ASSERT(m_levels > 0);
2245
2246                 log << tcu::TestLog::Message << "Expected levels: " << m_levels << tcu::TestLog::EndMessage;
2247         }
2248
2249         // render
2250         TextureQueryInstance::render();
2251
2252         // test
2253         {
2254                 const tcu::TextureLevel&        result                          = getResultImage();
2255                 tcu::IVec4                                      output                          = result.getAccess().getPixelInt(0, 0);
2256
2257                 if (output.x() == m_levels)
2258                 {
2259                         // success
2260                         log << tcu::TestLog::Message << "Passed" << tcu::TestLog::EndMessage;
2261                 }
2262                 else
2263                 {
2264                         // failure
2265                         log << tcu::TestLog::Message << "Result: " << output.x() << tcu::TestLog::EndMessage;
2266                         log << tcu::TestLog::Message << "Failed" << tcu::TestLog::EndMessage;
2267                         success = false;
2268                 }
2269         }
2270
2271         log << tcu::TestLog::Message << tcu::TestLog::EndMessage;
2272
2273         return success;
2274 }
2275
2276 void TextureQueryLevelsInstance::initTexture (void)
2277 {
2278         tcu::TestLog&                   log                                     = m_context.getTestContext().getLog();
2279         int                                             numLevels                       = m_testSize.lodBase + 1;
2280         TextureBindingSp                textureBinding;
2281
2282         log << tcu::TestLog::Message << "Image size: " << getTextureSizeString(m_textureSpec.type, m_testSize.textureSize) << tcu::TestLog::EndMessage;
2283         log << tcu::TestLog::Message << "Base level: " << m_testSize.lodBase << tcu::TestLog::EndMessage;
2284
2285         textureBinding = createEmptyTexture(m_textureSpec.format, m_textureSpec.type, m_testSize.textureSize, numLevels, m_testSize.lodBase, m_textureSpec.sampler);
2286
2287         m_textures.clear();
2288         m_textures.push_back(textureBinding);
2289 }
2290
2291 static int getQueryLodFuncTextCoordComps (TextureType type)
2292 {
2293         switch (type)
2294         {
2295                 case TEXTURETYPE_1D:
2296                 case TEXTURETYPE_1D_ARRAY:
2297                         return 1;
2298
2299                 case TEXTURETYPE_2D:
2300                 case TEXTURETYPE_2D_ARRAY:
2301                         return 2;
2302
2303                 case TEXTURETYPE_3D:
2304                 case TEXTURETYPE_CUBE_MAP:
2305                 case TEXTURETYPE_CUBE_ARRAY:
2306                         return 3;
2307
2308                 default:
2309                         DE_ASSERT(false);
2310                         return 0;
2311         }
2312 }
2313
2314 class TextureQueryLodInstance : public TextureQueryInstance
2315 {
2316 public:
2317                                                                 TextureQueryLodInstance                 (Context&                                       context,
2318                                                                                                                                  const bool                                     isVertexCase,
2319                                                                                                                                  const TextureSpec&                     textureSpec);
2320         virtual                                         ~TextureQueryLodInstance                (void);
2321
2322         virtual tcu::TestStatus         iterate                                                 (void);
2323
2324 protected:
2325         virtual void                            setupDefaultInputs                              (void);
2326
2327 private:
2328         void                                            initTexture                                             (void);
2329         float                                           computeLevelFromLod                             (float computedLod) const;
2330         vector<float>                           computeQuadTexCoord                             (void) const;
2331
2332         tcu::Vec4                                       m_minCoord;
2333         tcu::Vec4                                       m_maxCoord;
2334         tcu::Vec2                                       m_lodBounds;
2335         tcu::Vec2                                       m_levelBounds;
2336 };
2337
2338 TextureQueryLodInstance::TextureQueryLodInstance (Context&                                      context,
2339                                                                                                   const bool                            isVertexCase,
2340                                                                                                   const TextureSpec&            textureSpec)
2341         : TextureQueryInstance          (context, isVertexCase, textureSpec)
2342         , m_minCoord                            ()
2343         , m_maxCoord                            ()
2344         , m_lodBounds                           ()
2345         , m_levelBounds                         ()
2346 {
2347         // setup texture
2348         initTexture();
2349
2350         // init min/max coords
2351         switch (m_textureSpec.type)
2352         {
2353                 case TEXTURETYPE_1D:
2354                 case TEXTURETYPE_1D_ARRAY:
2355                         m_minCoord              = Vec4(-0.2f,  0.0f,  0.0f,  0.0f);
2356                         m_maxCoord              = Vec4( 1.5f,  0.0f,  0.0f,  0.0f);
2357                         break;
2358
2359                 case TEXTURETYPE_2D:
2360                 case TEXTURETYPE_2D_ARRAY:
2361                         m_minCoord              = Vec4(-0.2f, -0.4f,  0.0f,  0.0f);
2362                         m_maxCoord              = Vec4( 1.5f,  2.3f,  0.0f,  0.0f);
2363                         break;
2364
2365                 case TEXTURETYPE_3D:
2366                         m_minCoord              = Vec4(-1.2f, -1.4f,  0.1f,  0.0f);
2367                         m_maxCoord              = Vec4( 1.5f,  2.3f,  2.3f,  0.0f);
2368                         break;
2369
2370                 case TEXTURETYPE_CUBE_MAP:
2371                 case TEXTURETYPE_CUBE_ARRAY:
2372                         m_minCoord              = Vec4(-1.0f, -1.0f,  1.01f,  0.0f);
2373                         m_maxCoord              = Vec4( 1.0f,  1.0f,  1.01f,  0.0f);
2374                         break;
2375
2376                 default:
2377                         DE_ASSERT(false);
2378                         break;
2379         }
2380
2381         // calculate lod and accessed level
2382         {
2383                 const tcu::UVec2&               viewportSize            = getViewportSize();
2384                 const float                             lodEps                          = (1.0f / float(1u << m_context.getDeviceProperties().limits.mipmapPrecisionBits)) + 0.008f;
2385
2386                 switch (m_textureSpec.type)
2387                 {
2388                         case TEXTURETYPE_1D:
2389                         case TEXTURETYPE_1D_ARRAY:
2390                         {
2391                                 const float     dudx    = (m_maxCoord[0]-m_minCoord[0])*(float)m_textureSpec.width      / (float)viewportSize[0];
2392
2393                                 m_lodBounds[0]          = computeLodFromDerivates(LODMODE_MIN_BOUND, dudx, 0.0f)-lodEps;
2394                                 m_lodBounds[1]          = computeLodFromDerivates(LODMODE_MAX_BOUND, dudx, 0.0f)+lodEps;
2395                                 break;
2396                         }
2397
2398                         case TEXTURETYPE_2D:
2399                         case TEXTURETYPE_2D_ARRAY:
2400                         {
2401                                 const float     dudx    = (m_maxCoord[0]-m_minCoord[0])*(float)m_textureSpec.width      / (float)viewportSize[0];
2402                                 const float     dvdy    = (m_maxCoord[1]-m_minCoord[1])*(float)m_textureSpec.height     / (float)viewportSize[1];
2403
2404                                 m_lodBounds[0]          = computeLodFromDerivates(LODMODE_MIN_BOUND, dudx, 0.0f, 0.0f, dvdy)-lodEps;
2405                                 m_lodBounds[1]          = computeLodFromDerivates(LODMODE_MAX_BOUND, dudx, 0.0f, 0.0f, dvdy)+lodEps;
2406                                 break;
2407                         }
2408
2409                         case TEXTURETYPE_CUBE_MAP:
2410                         case TEXTURETYPE_CUBE_ARRAY:
2411                         {
2412                                 // Compute LOD \note Assumes that only single side is accessed and R is constant major axis.
2413                                 DE_ASSERT(de::abs(m_minCoord[2] - m_maxCoord[2]) < 0.005);
2414                                 DE_ASSERT(de::abs(m_minCoord[0]) < de::abs(m_minCoord[2]) && de::abs(m_maxCoord[0]) < de::abs(m_minCoord[2]));
2415                                 DE_ASSERT(de::abs(m_minCoord[1]) < de::abs(m_minCoord[2]) && de::abs(m_maxCoord[1]) < de::abs(m_minCoord[2]));
2416
2417                                 tcu::CubeFaceFloatCoords        c00             = tcu::getCubeFaceCoords(Vec3(m_minCoord[0], m_minCoord[1], m_minCoord[2]));
2418                                 tcu::CubeFaceFloatCoords        c10             = tcu::getCubeFaceCoords(Vec3(m_maxCoord[0], m_minCoord[1], m_minCoord[2]));
2419                                 tcu::CubeFaceFloatCoords        c01             = tcu::getCubeFaceCoords(Vec3(m_minCoord[0], m_maxCoord[1], m_minCoord[2]));
2420                                 float                                           dudx    = (c10.s - c00.s)*(float)m_textureSpec.width    / (float)viewportSize[0];
2421                                 float                                           dvdy    = (c01.t - c00.t)*(float)m_textureSpec.height   / (float)viewportSize[1];
2422
2423                                 m_lodBounds[0]          = computeLodFromDerivates(LODMODE_MIN_BOUND, dudx, 0.0f, 0.0f, dvdy)-lodEps;
2424                                 m_lodBounds[1]          = computeLodFromDerivates(LODMODE_MAX_BOUND, dudx, 0.0f, 0.0f, dvdy)+lodEps;
2425                                 break;
2426                         }
2427
2428                         case TEXTURETYPE_3D:
2429                         {
2430                                 const float     dudx    = (m_maxCoord[0]-m_minCoord[0])*(float)m_textureSpec.width              / (float)viewportSize[0];
2431                                 const float     dvdy    = (m_maxCoord[1]-m_minCoord[1])*(float)m_textureSpec.height             / (float)viewportSize[1];
2432                                 const float     dwdx    = (m_maxCoord[2]-m_minCoord[2])*0.5f*(float)m_textureSpec.depth / (float)viewportSize[0];
2433                                 const float     dwdy    = (m_maxCoord[2]-m_minCoord[2])*0.5f*(float)m_textureSpec.depth / (float)viewportSize[1];
2434
2435                                 m_lodBounds[0]          = computeLodFromDerivates(LODMODE_MIN_BOUND, dudx, 0.0f, dwdx, 0.0f, dvdy, dwdy)-lodEps;
2436                                 m_lodBounds[1]          = computeLodFromDerivates(LODMODE_MAX_BOUND, dudx, 0.0f, dwdx, 0.0f, dvdy, dwdy)+lodEps;
2437                                 break;
2438                         }
2439
2440                         default:
2441                                 DE_ASSERT(false);
2442                                 break;
2443                 }
2444
2445                 m_levelBounds[0] = computeLevelFromLod(m_lodBounds[0]);
2446                 m_levelBounds[1] = computeLevelFromLod(m_lodBounds[1]);
2447         }
2448 }
2449
2450 TextureQueryLodInstance::~TextureQueryLodInstance (void)
2451 {
2452 }
2453
2454 tcu::TestStatus TextureQueryLodInstance::iterate (void)
2455 {
2456         tcu::TestLog&           log             = m_context.getTestContext().getLog();
2457
2458         log << tcu::TestLog::Message << "Expected: level in range " << m_levelBounds << ", lod in range " << m_lodBounds << tcu::TestLog::EndMessage;
2459
2460         // render
2461         TextureQueryInstance::render();
2462
2463         // test
2464         {
2465                 const tcu::TextureLevel&        result          = getResultImage();
2466                 const tcu::Vec4                         output          = result.getAccess().getPixel(0, 0);
2467                 const float                                     resLevel        = output.x();
2468                 const float                                     resLod          = output.y();
2469
2470                 if (de::inRange(resLevel, m_levelBounds[0], m_levelBounds[1]) && de::inRange(resLod, m_lodBounds[0], m_lodBounds[1]))
2471                 {
2472                         // success
2473                         log << tcu::TestLog::Message << "Passed" << tcu::TestLog::EndMessage;
2474                         return tcu::TestStatus::pass("Pass");
2475                 }
2476                 else
2477                 {
2478                         // failure
2479                         log << tcu::TestLog::Message << "Result: level: " << resLevel << ", lod: " << resLod << tcu::TestLog::EndMessage;
2480                         log << tcu::TestLog::Message << "Failed" << tcu::TestLog::EndMessage;
2481                         return tcu::TestStatus::fail("Got unexpected result");
2482                 }
2483         }
2484 }
2485
2486 void TextureQueryLodInstance::setupDefaultInputs (void)
2487 {
2488         TextureQueryInstance::setupDefaultInputs();
2489
2490         const deUint32                  numVertices                     = 4;
2491         const vector<float>             texCoord                        = computeQuadTexCoord();
2492         const int                               texCoordComps           = getQueryLodFuncTextCoordComps(m_textureSpec.type);
2493         const vk::VkFormat              coordFormats[]          =
2494         {
2495                 vk::VK_FORMAT_R32_SFLOAT,
2496                 vk::VK_FORMAT_R32G32_SFLOAT,
2497                 vk::VK_FORMAT_R32G32B32_SFLOAT
2498         };
2499
2500         DE_ASSERT(de::inRange(texCoordComps, 1, 3));
2501         DE_ASSERT((int)texCoord.size() == texCoordComps * 4);
2502
2503         addAttribute(1u, coordFormats[texCoordComps - 1], (deUint32)(texCoordComps * sizeof(float)), numVertices, texCoord.data());
2504 }
2505
2506 void TextureQueryLodInstance::initTexture (void)
2507 {
2508         tcu::TestLog&                   log                                     = m_context.getTestContext().getLog();
2509         tcu::IVec3                              textureSize                     (m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth);
2510         TextureBindingSp                textureBinding;
2511
2512         DE_ASSERT(m_textures.empty());
2513
2514         log << tcu::TestLog::Message << "Image size: " << getTextureSizeString(m_textureSpec.type, textureSize) << tcu::TestLog::EndMessage;
2515
2516         textureBinding = createEmptyTexture(m_textureSpec.format, m_textureSpec.type, textureSize, m_textureSpec.numLevels, 0 /* lodBase */, m_textureSpec.sampler);
2517
2518         m_textures.push_back(textureBinding);
2519 }
2520
2521 float TextureQueryLodInstance::computeLevelFromLod (float computedLod) const
2522 {
2523         const int       maxAccessibleLevel      = m_textureSpec.numLevels - 1;
2524
2525         // Clamp the computed LOD to the range of accessible levels.
2526         computedLod = deFloatClamp(computedLod, 0.0f, (float)maxAccessibleLevel);
2527
2528         // Return a value according to the min filter.
2529         switch (m_textureSpec.sampler.minFilter)
2530         {
2531                 case tcu::Sampler::LINEAR:
2532                 case tcu::Sampler::NEAREST:
2533                         return 0.0f;
2534
2535                 case tcu::Sampler::NEAREST_MIPMAP_NEAREST:
2536                 case tcu::Sampler::LINEAR_MIPMAP_NEAREST:
2537                         return deFloatClamp(deFloatCeil(computedLod + 0.5f) - 1.0f, 0.0f, (float)maxAccessibleLevel);
2538
2539                 case tcu::Sampler::NEAREST_MIPMAP_LINEAR:
2540                 case tcu::Sampler::LINEAR_MIPMAP_LINEAR:
2541                         return computedLod;
2542
2543                 default:
2544                         DE_ASSERT(false);
2545                         return 0.0f;
2546         }
2547 }
2548
2549 vector<float> TextureQueryLodInstance::computeQuadTexCoord (void) const
2550 {
2551         vector<float>   res;
2552         tcu::Mat4               coordTransMat;
2553
2554         {
2555                 Vec4 s = m_maxCoord - m_minCoord;
2556                 Vec4 b = m_minCoord;
2557
2558                 float baseCoordTrans[] =
2559                 {
2560                         s.x(),          0.0f,           0.f,    b.x(),
2561                         0.f,            s.y(),          0.f,    b.y(),
2562                         s.z()/2.f,      -s.z()/2.f,     0.f,    s.z()/2.f + b.z(),
2563                         -s.w()/2.f,     s.w()/2.f,      0.f,    s.w()/2.f + b.w()
2564                 };
2565
2566                 coordTransMat = tcu::Mat4(baseCoordTrans);
2567         }
2568
2569         const int               texCoordComps   = getQueryLodFuncTextCoordComps(m_textureSpec.type);
2570         Vec4                    coords[4]               =
2571         {
2572                 coordTransMat * tcu::Vec4(0, 0, 0, 1),
2573                 coordTransMat * tcu::Vec4(0, 1, 0, 1),
2574                 coordTransMat * tcu::Vec4(1, 0, 0, 1),
2575                 coordTransMat * tcu::Vec4(1, 1, 0, 1)
2576         };
2577
2578         res.resize(4 * texCoordComps);
2579
2580         for (int ndx = 0; ndx < 4; ndx++)
2581                 deMemcpy(&res[ndx * texCoordComps], coords[ndx].getPtr(), texCoordComps * sizeof(float));
2582
2583         return res;
2584 }
2585
2586 class TextureQueryCase : public ShaderRenderCase
2587 {
2588 public:
2589                                                                 TextureQueryCase                                (tcu::TestContext&                      testCtx,
2590                                                                                                                                  const std::string&                     name,
2591                                                                                                                                  const std::string&                     desc,
2592                                                                                                                                  const std::string&                     samplerType,
2593                                                                                                                                  const TextureSpec&                     texture,
2594                                                                                                                                  bool                                           isVertexCase,
2595                                                                                                                                  QueryFunction                          function);
2596         virtual                                         ~TextureQueryCase                               (void);
2597
2598         virtual TestInstance*           createInstance                                  (Context& context) const;
2599
2600 protected:
2601         void                                            initShaderSources                               (void);
2602
2603         const std::string                       m_samplerTypeStr;
2604         const TextureSpec                       m_textureSpec;
2605         const QueryFunction                     m_function;
2606 };
2607
2608 TextureQueryCase::TextureQueryCase (tcu::TestContext&           testCtx,
2609                                                                         const std::string&              name,
2610                                                                         const std::string&              desc,
2611                                                                         const std::string&              samplerType,
2612                                                                         const TextureSpec&              texture,
2613                                                                         bool                                    isVertexCase,
2614                                                                         QueryFunction                   function)
2615         : ShaderRenderCase      (testCtx, name, desc, isVertexCase, (ShaderEvaluator*)DE_NULL, DE_NULL, DE_NULL)
2616         , m_samplerTypeStr      (samplerType)
2617         , m_textureSpec         (texture)
2618         , m_function            (function)
2619 {
2620         initShaderSources();
2621 }
2622
2623 TextureQueryCase::~TextureQueryCase (void)
2624 {
2625 }
2626
2627 TestInstance* TextureQueryCase::createInstance (Context& context) const
2628 {
2629         switch (m_function)
2630         {
2631                 case QUERYFUNCTION_TEXTURESIZE:                         return new TextureSizeInstance(context, m_isVertexCase, m_textureSpec);
2632                 case QUERYFUNCTION_TEXTUREQUERYLOD:                     return new TextureQueryLodInstance(context, m_isVertexCase, m_textureSpec);
2633                 case QUERYFUNCTION_TEXTUREQUERYLEVELS:          return new TextureQueryLevelsInstance(context, m_isVertexCase, m_textureSpec);
2634                 case QUERYFUNCTION_TEXTURESAMPLES:                      return new TextureSamplesInstance(context, m_isVertexCase, m_textureSpec);
2635                 default:
2636                         DE_ASSERT(false);
2637                         return DE_NULL;
2638         }
2639 }
2640
2641 void TextureQueryCase::initShaderSources (void)
2642 {
2643         std::ostringstream              vert;
2644         std::ostringstream              frag;
2645         std::ostringstream&             op                      = m_isVertexCase ? vert : frag;
2646         glu::GLSLVersion                version         = glu::GLSL_VERSION_LAST;
2647
2648         DE_ASSERT(m_function != QUERYFUNCTION_TEXTUREQUERYLOD || !m_isVertexCase);
2649
2650         switch (m_function)
2651         {
2652                 case QUERYFUNCTION_TEXTURESIZE:
2653                         if (m_textureSpec.type == TEXTURETYPE_1D || m_textureSpec.type == TEXTURETYPE_1D_ARRAY || m_textureSpec.type == TEXTURETYPE_CUBE_ARRAY)
2654                                 version = glu::GLSL_VERSION_420;
2655                         else
2656                                 version = glu::GLSL_VERSION_310_ES;
2657                         break;
2658
2659                 case QUERYFUNCTION_TEXTUREQUERYLOD:
2660                         version = glu::GLSL_VERSION_420;
2661                         break;
2662
2663                 case QUERYFUNCTION_TEXTUREQUERYLEVELS:
2664                         version = glu::GLSL_VERSION_430;
2665                         break;
2666
2667                 case QUERYFUNCTION_TEXTURESAMPLES:
2668                         version = glu::GLSL_VERSION_450;
2669                         break;
2670
2671                 default:
2672                         DE_ASSERT(false);
2673                         break;
2674         }
2675
2676         vert << glu::getGLSLVersionDeclaration(version) << "\n"
2677                  << "layout(location = 0) in highp vec4 a_position;\n";
2678
2679         frag << glu::getGLSLVersionDeclaration(version) << "\n"
2680                  << "layout(location = 0) out mediump vec4 o_color;\n";
2681
2682         if (m_isVertexCase)
2683         {
2684                 vert << "layout(location = 0) out mediump vec4 v_color;\n";
2685                 frag << "layout(location = 0) in mediump vec4 v_color;\n";
2686         }
2687
2688         if (m_function == QUERYFUNCTION_TEXTUREQUERYLOD)
2689         {
2690                 const int               texCoordComps   = getQueryLodFuncTextCoordComps(m_textureSpec.type);
2691                 const char*             coordTypeName   = glu::getDataTypeName(glu::getDataTypeFloatVec(texCoordComps));
2692
2693                 vert << "layout (location = 1) in highp " << coordTypeName << " a_texCoord;\n";
2694                 vert << "layout (location = 0) out highp " << coordTypeName << " v_texCoord;\n";
2695                 frag << "layout (location = 0) in highp " << coordTypeName << " v_texCoord;\n";
2696         }
2697
2698         // uniforms
2699         op << "layout(set = 0, binding = 0) uniform highp " << m_samplerTypeStr << " u_sampler;\n";
2700         if (m_function == QUERYFUNCTION_TEXTURESIZE)
2701                 op << "layout(set = 0, binding = 1) uniform buf0 { highp int u_lod; };\n";
2702
2703         if (version != glu::GLSL_VERSION_310_ES)
2704                 vert << "out gl_PerVertex {\n"
2705                          << "\tvec4 gl_Position;\n"
2706                          << "};\n";
2707
2708         vert << "\nvoid main()\n{\n"
2709                  << "\tgl_Position = a_position;\n";
2710         frag << "\nvoid main()\n{\n";
2711
2712         if (m_isVertexCase)
2713                 vert << "\tv_color = ";
2714         else
2715                 frag << "\to_color = ";
2716
2717         // op
2718         {
2719                 op << "vec4(";
2720
2721                 switch (m_function)
2722                 {
2723                         case QUERYFUNCTION_TEXTURESIZE:
2724                         {
2725                                 const int               resultComponents        = glu::getDataTypeScalarSize(getTextureSizeFuncResultType(m_textureSpec.type));
2726
2727                                 op << "textureSize(u_sampler, u_lod)";
2728                                 for (int ndx = 0; ndx < 3 - resultComponents; ndx++)
2729                                         op << ", 0.0";
2730                                 op << ", 1.0";
2731
2732                                 break;
2733                         }
2734
2735                         case QUERYFUNCTION_TEXTUREQUERYLOD:
2736                                 op << "textureQueryLod(u_sampler, v_texCoord), 0.0, 1.0";
2737                                 break;
2738
2739                         case QUERYFUNCTION_TEXTUREQUERYLEVELS:
2740                                 op << "textureQueryLevels(u_sampler), 0.0, 0.0, 1.0";
2741                                 break;
2742
2743                         case QUERYFUNCTION_TEXTURESAMPLES:
2744                                 op << "textureSamples(u_sampler), 0.0, 0.0, 1.0";
2745                                 break;
2746
2747                         default:
2748                                 DE_ASSERT(false);
2749                                 break;
2750                 }
2751
2752                 op << ");\n";
2753         }
2754
2755         if (m_isVertexCase)
2756                 frag << "\to_color = v_color;\n";
2757
2758         if (m_function == QUERYFUNCTION_TEXTUREQUERYLOD)
2759                 vert << "\tv_texCoord = a_texCoord;\n";
2760
2761         vert << "}\n";
2762         frag << "}\n";
2763
2764         m_vertShaderSource = vert.str();
2765         m_fragShaderSource = frag.str();
2766 }
2767
2768 class ShaderTextureFunctionTests : public tcu::TestCaseGroup
2769 {
2770 public:
2771                                                                         ShaderTextureFunctionTests              (tcu::TestContext& context);
2772         virtual                                                 ~ShaderTextureFunctionTests             (void);
2773         virtual void                                    init                                                    (void);
2774
2775 private:
2776                                                                         ShaderTextureFunctionTests              (const ShaderTextureFunctionTests&);            // not allowed!
2777         ShaderTextureFunctionTests&             operator=                                               (const ShaderTextureFunctionTests&);            // not allowed!
2778 };
2779
2780 ShaderTextureFunctionTests::ShaderTextureFunctionTests (tcu::TestContext& context)
2781         : TestCaseGroup(context, "texture_functions", "Texture Access Function Tests")
2782 {
2783 }
2784
2785 ShaderTextureFunctionTests::~ShaderTextureFunctionTests (void)
2786 {
2787 }
2788
2789 enum CaseFlags
2790 {
2791         VERTEX          = (1<<0),
2792         FRAGMENT        = (1<<1),
2793         BOTH            = VERTEX|FRAGMENT
2794 };
2795
2796 struct TexFuncCaseSpec
2797 {
2798         const char*                     name;
2799         TextureLookupSpec       lookupSpec;
2800         TextureSpec                     texSpec;
2801         TexEvalFunc                     evalFunc;
2802         deUint32                        flags;
2803 };
2804
2805 #define CASE_SPEC(NAME, FUNC, MINCOORD, MAXCOORD, USEBIAS, MINLOD, MAXLOD, USEOFFSET, OFFSET, TEXSPEC, EVALFUNC, FLAGS) \
2806         { #NAME, TextureLookupSpec(FUNC, MINCOORD, MAXCOORD, USEBIAS, MINLOD, MAXLOD, tcu::Vec3(0.0f), tcu::Vec3(0.0f), tcu::Vec3(0.0f), tcu::Vec3(0.0f), USEOFFSET, OFFSET), TEXSPEC, EVALFUNC, FLAGS }
2807 #define GRAD_CASE_SPEC(NAME, FUNC, MINCOORD, MAXCOORD, MINDX, MAXDX, MINDY, MAXDY, USEOFFSET, OFFSET, TEXSPEC, EVALFUNC, FLAGS) \
2808         { #NAME, TextureLookupSpec(FUNC, MINCOORD, MAXCOORD, false, 0.0f, 0.0f, MINDX, MAXDX, MINDY, MAXDY, USEOFFSET, OFFSET), TEXSPEC, EVALFUNC, FLAGS }
2809
2810 class SparseShaderTextureFunctionInstance : public ShaderTextureFunctionInstance
2811 {
2812 public:
2813                                 SparseShaderTextureFunctionInstance             (Context&                                       context,
2814                                                                                                                 const bool                                      isVertexCase,
2815                                                                                                                 const ShaderEvaluator&          evaluator,
2816                                                                                                                 const UniformSetup&                     uniformSetup,
2817                                                                                                                 const TextureLookupSpec&        lookupSpec,
2818                                                                                                                 const TextureSpec&                      textureSpec,
2819                                                                                                                 const TexLookupParams&          lookupParams,
2820                                                                                                                 const ImageBackingMode          imageBackingMode = IMAGE_BACKING_MODE_SPARSE);
2821         virtual         ~SparseShaderTextureFunctionInstance    (void);
2822 };
2823
2824 SparseShaderTextureFunctionInstance::SparseShaderTextureFunctionInstance (Context&                                      context,
2825                                                                                                                                                  const bool                                     isVertexCase,
2826                                                                                                                                                  const ShaderEvaluator&         evaluator,
2827                                                                                                                                                  const UniformSetup&            uniformSetup,
2828                                                                                                                                                  const TextureLookupSpec&       lookupSpec,
2829                                                                                                                                                  const TextureSpec&                     textureSpec,
2830                                                                                                                                                  const TexLookupParams&         lookupParams,
2831                                                                                                                                                  const ImageBackingMode         imageBackingMode)
2832         : ShaderTextureFunctionInstance (context, isVertexCase, evaluator, uniformSetup, lookupSpec, textureSpec, lookupParams, imageBackingMode)
2833 {
2834 }
2835
2836 SparseShaderTextureFunctionInstance::~SparseShaderTextureFunctionInstance (void)
2837 {
2838 }
2839
2840 class SparseShaderTextureFunctionCase : public ShaderTextureFunctionCase
2841 {
2842 public:
2843                                                         SparseShaderTextureFunctionCase         (tcu::TestContext&                      testCtx,
2844                                                                                                                                 const std::string&                      name,
2845                                                                                                                                 const std::string&                      desc,
2846                                                                                                                                 const TextureLookupSpec&        lookup,
2847                                                                                                                                 const TextureSpec&                      texture,
2848                                                                                                                                 TexEvalFunc                                     evalFunc,
2849                                                                                                                                 bool                                            isVertexCase);
2850
2851         virtual                                 ~SparseShaderTextureFunctionCase        (void);
2852
2853         virtual TestInstance*   createInstance                                          (Context& context) const;
2854 protected:
2855         void                                    initShaderSources                                       (void);
2856 };
2857
2858 SparseShaderTextureFunctionCase::SparseShaderTextureFunctionCase (tcu::TestContext&                             testCtx,
2859                                                                                                                                   const std::string&                    name,
2860                                                                                                                                   const std::string&                    desc,
2861                                                                                                                                   const TextureLookupSpec&              lookup,
2862                                                                                                                                   const TextureSpec&                    texture,
2863                                                                                                                                   TexEvalFunc                                   evalFunc,
2864                                                                                                                                   bool                                                  isVertexCase)
2865         : ShaderTextureFunctionCase             (testCtx, name, desc, lookup, texture, evalFunc, isVertexCase)
2866 {
2867         initShaderSources();
2868 }
2869
2870 void SparseShaderTextureFunctionCase::initShaderSources (void)
2871 {
2872         const Function                          function                        = m_lookupSpec.function;
2873         const bool                                      isVtxCase                       = m_isVertexCase;
2874         const bool                                      isProj                          = functionHasProj(function);
2875         const bool                                      isGrad                          = functionHasGrad(function);
2876         const bool                                      isShadow                        = m_textureSpec.sampler.compare != tcu::Sampler::COMPAREMODE_NONE;
2877         const bool                                      is2DProj4                       = !isShadow && m_textureSpec.type == TEXTURETYPE_2D && (function == FUNCTION_TEXTUREPROJ || function == FUNCTION_TEXTUREPROJLOD || function == FUNCTION_TEXTUREPROJGRAD);
2878         const bool                                      isIntCoord                      = function == FUNCTION_TEXELFETCH;
2879         const bool                                      hasLodBias                      = functionHasLod(m_lookupSpec.function) || m_lookupSpec.useBias;
2880         const int                                       texCoordComps           = m_textureSpec.type == TEXTURETYPE_2D ? 2 : 3;
2881         const int                                       extraCoordComps         = (isProj ? (is2DProj4 ? 2 : 1) : 0) + (isShadow ? 1 : 0);
2882         const glu::DataType                     coordType                       = glu::getDataTypeFloatVec(texCoordComps+extraCoordComps);
2883         const glu::Precision            coordPrec                       = glu::PRECISION_HIGHP;
2884         const char*                                     coordTypeName           = glu::getDataTypeName(coordType);
2885         const char*                                     coordPrecName           = glu::getPrecisionName(coordPrec);
2886         const tcu::TextureFormat        texFmt                          = glu::mapGLInternalFormat(m_textureSpec.format);
2887         glu::DataType                           samplerType                     = glu::TYPE_LAST;
2888         const glu::DataType                     gradType                        = (m_textureSpec.type == TEXTURETYPE_CUBE_MAP || m_textureSpec.type == TEXTURETYPE_3D) ? glu::TYPE_FLOAT_VEC3 : glu::TYPE_FLOAT_VEC2;
2889         const char*                                     gradTypeName            = glu::getDataTypeName(gradType);
2890         const char*                                     baseFuncName            = DE_NULL;
2891
2892         DE_ASSERT(!isGrad || !hasLodBias);
2893
2894         switch (m_textureSpec.type)
2895         {
2896                 case TEXTURETYPE_2D:            samplerType = isShadow ? glu::TYPE_SAMPLER_2D_SHADOW            : glu::getSampler2DType(texFmt);                break;
2897                 case TEXTURETYPE_CUBE_MAP:      samplerType = isShadow ? glu::TYPE_SAMPLER_CUBE_SHADOW          : glu::getSamplerCubeType(texFmt);              break;
2898                 case TEXTURETYPE_2D_ARRAY:      samplerType = isShadow ? glu::TYPE_SAMPLER_2D_ARRAY_SHADOW      : glu::getSampler2DArrayType(texFmt);   break;
2899                 case TEXTURETYPE_3D:            DE_ASSERT(!isShadow); samplerType = glu::getSampler3DType(texFmt);                                                                      break;
2900                 default:
2901                         DE_ASSERT(DE_FALSE);
2902         }
2903
2904         // Not supported cases
2905         switch (m_lookupSpec.function)
2906         {
2907                 case FUNCTION_TEXTURE:                  baseFuncName = "sparseTexture";                 break;
2908                 case FUNCTION_TEXTURELOD:               baseFuncName = "sparseTextureLod";              break;
2909                 case FUNCTION_TEXTUREGRAD:              baseFuncName = "sparseTextureGrad";             break;
2910                 case FUNCTION_TEXELFETCH:               baseFuncName = "sparseTexelFetch";              break;
2911                 default:
2912                         DE_ASSERT(DE_FALSE);
2913         }
2914
2915         std::ostringstream      vert;
2916         std::ostringstream      frag;
2917         std::ostringstream&     op              = isVtxCase ? vert : frag;
2918
2919         vert << "#version 450\n"
2920                  << "#extension GL_ARB_sparse_texture2 : require\n"
2921                  << "layout(location = 0) in highp vec4 a_position;\n"
2922                  << "layout(location = 4) in " << coordPrecName << " " << coordTypeName << " a_in0;\n";
2923
2924         if (isGrad)
2925         {
2926                 vert << "layout(location = 5) in " << coordPrecName << " " << gradTypeName << " a_in1;\n";
2927                 vert << "layout(location = 6) in " << coordPrecName << " " << gradTypeName << " a_in2;\n";
2928         }
2929         else if (hasLodBias)
2930                 vert << "layout(location = 5) in " << coordPrecName << " float a_in1;\n";
2931
2932         frag << "#version 450\n"
2933                  << "#extension GL_ARB_sparse_texture2 : require\n"
2934                  << "layout(location = 0) out mediump vec4 o_color;\n";
2935
2936         if (isVtxCase)
2937         {
2938                 vert << "layout(location = 0) out mediump vec4 v_color;\n";
2939                 frag << "layout(location = 0) in mediump vec4 v_color;\n";
2940         }
2941         else
2942         {
2943                 vert << "layout(location = 0) out " << coordPrecName << " " << coordTypeName << " v_texCoord;\n";
2944                 frag << "layout(location = 0) in " << coordPrecName << " " << coordTypeName << " v_texCoord;\n";
2945
2946                 if (isGrad)
2947                 {
2948                         vert << "layout(location = 1) out " << coordPrecName << " " << gradTypeName << " v_gradX;\n";
2949                         vert << "layout(location = 2) out " << coordPrecName << " " << gradTypeName << " v_gradY;\n";
2950                         frag << "layout(location = 1) in " << coordPrecName << " " << gradTypeName << " v_gradX;\n";
2951                         frag << "layout(location = 2) in " << coordPrecName << " " << gradTypeName << " v_gradY;\n";
2952                 }
2953                 else if (hasLodBias)
2954                 {
2955                         vert << "layout(location = 1) out " << coordPrecName << " float v_lodBias;\n";
2956                         frag << "layout(location = 1) in " << coordPrecName << " float v_lodBias;\n";
2957                 }
2958         }
2959
2960         // Uniforms
2961         op << "layout(set = 0, binding = 0) uniform highp " << glu::getDataTypeName(samplerType) << " u_sampler;\n"
2962            << "layout(set = 0, binding = 1) uniform buf0 { highp vec4 u_scale; };\n"
2963            << "layout(set = 0, binding = 2) uniform buf1 { highp vec4 u_bias; };\n";
2964
2965         vert << "out gl_PerVertex {\n"
2966                  << "   vec4 gl_Position;\n"
2967                  << "};\n";
2968         vert << "\nvoid main()\n{\n"
2969                  << "\tgl_Position = a_position;\n";
2970         frag << "\nvoid main()\n{\n";
2971
2972         // Op.
2973         {
2974                 // Texel declaration
2975                 if (isShadow)
2976                         op << "\tfloat texel;\n";
2977                 else
2978                         op << "\tvec4 texel;\n";
2979
2980                 const char*     const texCoord  = isVtxCase ? "a_in0" : "v_texCoord";
2981                 const char* const gradX         = isVtxCase ? "a_in1" : "v_gradX";
2982                 const char* const gradY         = isVtxCase ? "a_in2" : "v_gradY";
2983                 const char*     const lodBias   = isVtxCase ? "a_in1" : "v_lodBias";
2984
2985                 op << "\tint success = " << baseFuncName;
2986
2987                 if (m_lookupSpec.useOffset)
2988                         op << "Offset";
2989
2990                 op << "ARB(u_sampler, ";
2991
2992                 if (isIntCoord)
2993                         op << "ivec" << (texCoordComps+extraCoordComps) << "(";
2994
2995                 op << texCoord;
2996
2997                 if (isIntCoord)
2998                         op << ")";
2999
3000                 if (isGrad)
3001                         op << ", " << gradX << ", " << gradY;
3002
3003                 if (functionHasLod(function))
3004                 {
3005                         if (isIntCoord)
3006                                 op << ", int(" << lodBias << ")";
3007                         else
3008                                 op << ", " << lodBias;
3009                 }
3010
3011                 if (m_lookupSpec.useOffset)
3012                 {
3013                         int offsetComps = m_textureSpec.type == TEXTURETYPE_3D ? 3 : 2;
3014
3015                         op << ", ivec" << offsetComps << "(";
3016                         for (int ndx = 0; ndx < offsetComps; ndx++)
3017                         {
3018                                 if (ndx != 0)
3019                                         op << ", ";
3020                                 op << m_lookupSpec.offset[ndx];
3021                         }
3022                         op << ")";
3023                 }
3024
3025                 op << ", texel";
3026
3027                 if (m_lookupSpec.useBias)
3028                         op << ", " << lodBias;
3029
3030                 op << ");\n";
3031
3032                 // Check sparse validity, and handle each case
3033                 op << "\tif (sparseTexelsResidentARB(success))\n";
3034
3035                 if (isVtxCase)
3036                         vert << "\t\tv_color = ";
3037                 else
3038                         frag << "\t\to_color = ";
3039
3040                 if (isShadow)
3041                         op << "vec4(texel, 0.0, 0.0, 1.0);\n";
3042                 else
3043                         op << "vec4(texel * u_scale + u_bias);\n";
3044
3045                 op << "\telse\n";
3046
3047                 // This color differs from the used colors
3048                 if (isVtxCase)
3049                         vert << "\t\tv_color = vec4(0.54117647058, 0.16862745098, 0.8862745098, 1.0);\n";
3050                 else
3051                         frag << "\t\to_color = vec4(0.54117647058, 0.16862745098, 0.8862745098, 1.0);\n";
3052         }
3053
3054         if (isVtxCase)
3055                 frag << "\to_color = v_color;\n";
3056         else
3057         {
3058                 vert << "\tv_texCoord = a_in0;\n";
3059
3060                 if (isGrad)
3061                 {
3062                         vert << "\tv_gradX = a_in1;\n";
3063                         vert << "\tv_gradY = a_in2;\n";
3064                 }
3065                 else if (hasLodBias)
3066                         vert << "\tv_lodBias = a_in1;\n";
3067         }
3068
3069         vert << "}\n";
3070         frag << "}\n";
3071
3072         m_vertShaderSource = vert.str();
3073         m_fragShaderSource = frag.str();
3074 }
3075
3076 SparseShaderTextureFunctionCase::~SparseShaderTextureFunctionCase ()
3077 {
3078 }
3079
3080 TestInstance* SparseShaderTextureFunctionCase::createInstance (Context& context) const
3081 {
3082         DE_ASSERT(m_evaluator != DE_NULL);
3083         DE_ASSERT(m_uniformSetup != DE_NULL);
3084         return new SparseShaderTextureFunctionInstance(context, m_isVertexCase, *m_evaluator, *m_uniformSetup, m_lookupSpec, m_textureSpec, m_lookupParams);
3085 }
3086
3087 static void createCaseGroup (tcu::TestCaseGroup* parent, const char* groupName, const char* groupDesc, const TexFuncCaseSpec* cases, int numCases)
3088 {
3089         de::MovePtr<tcu::TestCaseGroup> group   (new tcu::TestCaseGroup(parent->getTestContext(), groupName, groupDesc));
3090
3091         for (int ndx = 0; ndx < numCases; ndx++)
3092         {
3093                 std::string     name                    = cases[ndx].name;
3094                 bool            sparseSupported = !functionHasProj(cases[ndx].lookupSpec.function)              &&
3095                                                                           TEXTURETYPE_1D                        != cases[ndx].texSpec.type      &&
3096                                                                           TEXTURETYPE_1D_ARRAY          != cases[ndx].texSpec.type      &&
3097                                                                           TEXTURETYPE_CUBE_ARRAY        != cases[ndx].texSpec.type;
3098
3099                 if (cases[ndx].flags & VERTEX)
3100                 {
3101                         if (sparseSupported)
3102                                 group->addChild(new SparseShaderTextureFunctionCase(parent->getTestContext(), ("sparse_" + name + "_vertex"),   "", cases[ndx].lookupSpec, cases[ndx].texSpec, cases[ndx].evalFunc, true ));
3103
3104                         group->addChild(new ShaderTextureFunctionCase(parent->getTestContext(), (name + "_vertex"),   "", cases[ndx].lookupSpec, cases[ndx].texSpec, cases[ndx].evalFunc, true ));
3105                 }
3106
3107                 if (cases[ndx].flags & FRAGMENT)
3108                 {
3109                         if (sparseSupported)
3110                                 group->addChild(new SparseShaderTextureFunctionCase(parent->getTestContext(), ("sparse_" + name + "_fragment"), "", cases[ndx].lookupSpec, cases[ndx].texSpec, cases[ndx].evalFunc, false));
3111
3112                         group->addChild(new ShaderTextureFunctionCase(parent->getTestContext(), (name + "_fragment"), "", cases[ndx].lookupSpec, cases[ndx].texSpec, cases[ndx].evalFunc, false));
3113                 }
3114         }
3115
3116         parent->addChild(group.release());
3117 }
3118
3119 void ShaderTextureFunctionTests::init (void)
3120 {
3121         // Samplers
3122         static const tcu::Sampler       samplerNearestNoMipmap  (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL,
3123                                                                                                                  tcu::Sampler::NEAREST, tcu::Sampler::NEAREST,
3124                                                                                                                  0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE,
3125                                                                                                                  0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */);
3126         static const tcu::Sampler       samplerLinearNoMipmap   (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL,
3127                                                                                                                  tcu::Sampler::LINEAR, tcu::Sampler::LINEAR,
3128                                                                                                                  0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE,
3129                                                                                                                  0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */);
3130         static const tcu::Sampler       samplerNearestMipmap    (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL,
3131                                                                                                                  tcu::Sampler::NEAREST_MIPMAP_NEAREST, tcu::Sampler::NEAREST,
3132                                                                                                                  0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE,
3133                                                                                                                  0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */);
3134         static const tcu::Sampler       samplerLinearMipmap             (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL,
3135                                                                                                                  tcu::Sampler::LINEAR_MIPMAP_NEAREST, tcu::Sampler::LINEAR,
3136                                                                                                                  0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE,
3137                                                                                                                  0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */);
3138
3139         static const tcu::Sampler       samplerShadowNoMipmap   (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL,
3140                                                                                                                  tcu::Sampler::NEAREST, tcu::Sampler::NEAREST,
3141                                                                                                                  0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_LESS,
3142                                                                                                                  0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */);
3143         static const tcu::Sampler       samplerShadowMipmap             (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL,
3144                                                                                                                  tcu::Sampler::NEAREST_MIPMAP_NEAREST, tcu::Sampler::NEAREST,
3145                                                                                                                  0.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_LESS,
3146                                                                                                                  0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */);
3147
3148         static const tcu::Sampler       samplerTexelFetch               (tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL,
3149                                                                                                                  tcu::Sampler::NEAREST_MIPMAP_NEAREST, tcu::Sampler::NEAREST,
3150                                                                                                                  00.0f /* LOD threshold */, true /* normalized coords */, tcu::Sampler::COMPAREMODE_NONE,
3151                                                                                                                  0 /* cmp channel */, tcu::Vec4(0.0f) /* border color */, true /* seamless cube map */);
3152
3153         // Default textures.
3154         //                                                                                              Type                                    Format                                  W               H               D       L       Sampler
3155         static const TextureSpec tex2DFixed                             (TEXTURETYPE_2D,                GL_RGBA8,                               256,    256,    1,      1,      samplerLinearNoMipmap);
3156         static const TextureSpec tex2DFloat                             (TEXTURETYPE_2D,                GL_RGBA16F,                             256,    256,    1,      1,      samplerLinearNoMipmap);
3157         static const TextureSpec tex2DInt                               (TEXTURETYPE_2D,                GL_RGBA8I,                              256,    256,    1,      1,      samplerNearestNoMipmap);
3158         static const TextureSpec tex2DUint                              (TEXTURETYPE_2D,                GL_RGBA8UI,                             256,    256,    1,      1,      samplerNearestNoMipmap);
3159         static const TextureSpec tex2DMipmapFixed               (TEXTURETYPE_2D,                GL_RGBA8,                               256,    256,    1,      9,      samplerLinearMipmap);
3160         static const TextureSpec tex2DMipmapFloat               (TEXTURETYPE_2D,                GL_RGBA16F,                             256,    256,    1,      9,      samplerLinearMipmap);
3161         static const TextureSpec tex2DMipmapInt                 (TEXTURETYPE_2D,                GL_RGBA8I,                              256,    256,    1,      9,      samplerNearestMipmap);
3162         static const TextureSpec tex2DMipmapUint                (TEXTURETYPE_2D,                GL_RGBA8UI,                             256,    256,    1,      9,      samplerNearestMipmap);
3163
3164         static const TextureSpec tex2DShadow                    (TEXTURETYPE_2D,                GL_DEPTH_COMPONENT16,   256,    256,    1,      1,      samplerShadowNoMipmap);
3165         static const TextureSpec tex2DMipmapShadow              (TEXTURETYPE_2D,                GL_DEPTH_COMPONENT16,   256,    256,    1,      9,      samplerShadowMipmap);
3166
3167         static const TextureSpec tex2DTexelFetchFixed   (TEXTURETYPE_2D,                GL_RGBA8,                               256,    256,    1,      9,      samplerTexelFetch);
3168         static const TextureSpec tex2DTexelFetchFloat   (TEXTURETYPE_2D,                GL_RGBA16F,                             256,    256,    1,      9,      samplerTexelFetch);
3169         static const TextureSpec tex2DTexelFetchInt             (TEXTURETYPE_2D,                GL_RGBA8I,                              256,    256,    1,      9,      samplerTexelFetch);
3170         static const TextureSpec tex2DTexelFetchUint    (TEXTURETYPE_2D,                GL_RGBA8UI,                             256,    256,    1,      9,      samplerTexelFetch);
3171
3172         static const TextureSpec texCubeFixed                   (TEXTURETYPE_CUBE_MAP,  GL_RGBA8,       256,    256,    1,      1,      samplerLinearNoMipmap);
3173         static const TextureSpec texCubeFloat                   (TEXTURETYPE_CUBE_MAP,  GL_RGBA16F,     256,    256,    1,      1,      samplerLinearNoMipmap);
3174         static const TextureSpec texCubeInt                             (TEXTURETYPE_CUBE_MAP,  GL_RGBA8I,      256,    256,    1,      1,      samplerNearestNoMipmap);
3175         static const TextureSpec texCubeUint                    (TEXTURETYPE_CUBE_MAP,  GL_RGBA8UI,     256,    256,    1,      1,      samplerNearestNoMipmap);
3176         static const TextureSpec texCubeMipmapFixed             (TEXTURETYPE_CUBE_MAP,  GL_RGBA8,       256,    256,    1,      9,      samplerLinearMipmap);
3177         static const TextureSpec texCubeMipmapFloat             (TEXTURETYPE_CUBE_MAP,  GL_RGBA16F,     128,    128,    1,      8,      samplerLinearMipmap);
3178         static const TextureSpec texCubeMipmapInt               (TEXTURETYPE_CUBE_MAP,  GL_RGBA8I,      256,    256,    1,      9,      samplerNearestMipmap);
3179         static const TextureSpec texCubeMipmapUint              (TEXTURETYPE_CUBE_MAP,  GL_RGBA8UI,     256,    256,    1,      9,      samplerNearestMipmap);
3180
3181         static const TextureSpec texCubeShadow                  (TEXTURETYPE_CUBE_MAP,  GL_DEPTH_COMPONENT16,   256,    256,    1,      1,      samplerShadowNoMipmap);
3182         static const TextureSpec texCubeMipmapShadow    (TEXTURETYPE_CUBE_MAP,  GL_DEPTH_COMPONENT16,   256,    256,    1,      9,      samplerShadowMipmap);
3183
3184         static const TextureSpec tex2DArrayFixed                (TEXTURETYPE_2D_ARRAY,  GL_RGBA8,       128,    128,    4,      1,      samplerLinearNoMipmap);
3185         static const TextureSpec tex2DArrayFloat                (TEXTURETYPE_2D_ARRAY,  GL_RGBA16F,     128,    128,    4,      1,      samplerLinearNoMipmap);
3186         static const TextureSpec tex2DArrayInt                  (TEXTURETYPE_2D_ARRAY,  GL_RGBA8I,      128,    128,    4,      1,      samplerNearestNoMipmap);
3187         static const TextureSpec tex2DArrayUint                 (TEXTURETYPE_2D_ARRAY,  GL_RGBA8UI,     128,    128,    4,      1,      samplerNearestNoMipmap);
3188         static const TextureSpec tex2DArrayMipmapFixed  (TEXTURETYPE_2D_ARRAY,  GL_RGBA8,       128,    128,    4,      8,      samplerLinearMipmap);
3189         static const TextureSpec tex2DArrayMipmapFloat  (TEXTURETYPE_2D_ARRAY,  GL_RGBA16F,     128,    128,    4,      8,      samplerLinearMipmap);
3190         static const TextureSpec tex2DArrayMipmapInt    (TEXTURETYPE_2D_ARRAY,  GL_RGBA8I,      128,    128,    4,      8,      samplerNearestMipmap);
3191         static const TextureSpec tex2DArrayMipmapUint   (TEXTURETYPE_2D_ARRAY,  GL_RGBA8UI,     128,    128,    4,      8,      samplerNearestMipmap);
3192
3193         static const TextureSpec tex2DArrayShadow               (TEXTURETYPE_2D_ARRAY,  GL_DEPTH_COMPONENT16,   128,    128,    4,      1,      samplerShadowNoMipmap);
3194         static const TextureSpec tex2DArrayMipmapShadow (TEXTURETYPE_2D_ARRAY,  GL_DEPTH_COMPONENT16,   128,    128,    4,      8,      samplerShadowMipmap);
3195
3196         static const TextureSpec tex2DArrayTexelFetchFixed      (TEXTURETYPE_2D_ARRAY,  GL_RGBA8,       128,    128,    4,      8,      samplerTexelFetch);
3197         static const TextureSpec tex2DArrayTexelFetchFloat      (TEXTURETYPE_2D_ARRAY,  GL_RGBA16F,     128,    128,    4,      8,      samplerTexelFetch);
3198         static const TextureSpec tex2DArrayTexelFetchInt        (TEXTURETYPE_2D_ARRAY,  GL_RGBA8I,      128,    128,    4,      8,      samplerTexelFetch);
3199         static const TextureSpec tex2DArrayTexelFetchUint       (TEXTURETYPE_2D_ARRAY,  GL_RGBA8UI,     128,    128,    4,      8,      samplerTexelFetch);
3200
3201         static const TextureSpec tex3DFixed                             (TEXTURETYPE_3D,                GL_RGBA8,       64,             32,             32,     1,      samplerLinearNoMipmap);
3202         static const TextureSpec tex3DFloat                             (TEXTURETYPE_3D,                GL_RGBA16F,     64,             32,             32,     1,      samplerLinearNoMipmap);
3203         static const TextureSpec tex3DInt                               (TEXTURETYPE_3D,                GL_RGBA8I,      64,             32,             32,     1,      samplerNearestNoMipmap);
3204         static const TextureSpec tex3DUint                              (TEXTURETYPE_3D,                GL_RGBA8UI,     64,             32,             32,     1,      samplerNearestNoMipmap);
3205         static const TextureSpec tex3DMipmapFixed               (TEXTURETYPE_3D,                GL_RGBA8,       64,             32,             32,     7,      samplerLinearMipmap);
3206         static const TextureSpec tex3DMipmapFloat               (TEXTURETYPE_3D,                GL_RGBA16F,     64,             32,             32,     7,      samplerLinearMipmap);
3207         static const TextureSpec tex3DMipmapInt                 (TEXTURETYPE_3D,                GL_RGBA8I,      64,             32,             32,     7,      samplerNearestMipmap);
3208         static const TextureSpec tex3DMipmapUint                (TEXTURETYPE_3D,                GL_RGBA8UI,     64,             32,             32,     7,      samplerNearestMipmap);
3209
3210         static const TextureSpec tex3DTexelFetchFixed   (TEXTURETYPE_3D,                GL_RGBA8,       64,             32,             32,     7,      samplerTexelFetch);
3211         static const TextureSpec tex3DTexelFetchFloat   (TEXTURETYPE_3D,                GL_RGBA16F,     64,             32,             32,     7,      samplerTexelFetch);
3212         static const TextureSpec tex3DTexelFetchInt             (TEXTURETYPE_3D,                GL_RGBA8I,      64,             32,             32,     7,      samplerTexelFetch);
3213         static const TextureSpec tex3DTexelFetchUint    (TEXTURETYPE_3D,                GL_RGBA8UI,     64,             32,             32,     7,      samplerTexelFetch);
3214
3215         static const TextureSpec tex1DFixed                             (TEXTURETYPE_1D,                GL_RGBA8,                               256,    1,      1,      1,      samplerLinearNoMipmap);
3216         static const TextureSpec tex1DFloat                             (TEXTURETYPE_1D,                GL_RGBA16F,                             256,    1,      1,      1,      samplerLinearNoMipmap);
3217         static const TextureSpec tex1DInt                               (TEXTURETYPE_1D,                GL_RGBA8I,                              256,    1,      1,      1,      samplerNearestNoMipmap);
3218         static const TextureSpec tex1DUint                              (TEXTURETYPE_1D,                GL_RGBA8UI,                             256,    1,      1,      1,      samplerNearestNoMipmap);
3219         static const TextureSpec tex1DMipmapFixed               (TEXTURETYPE_1D,                GL_RGBA8,                               256,    1,      1,      9,      samplerLinearMipmap);
3220         static const TextureSpec tex1DMipmapFloat               (TEXTURETYPE_1D,                GL_RGBA16F,                             256,    1,      1,      9,      samplerLinearMipmap);
3221         static const TextureSpec tex1DMipmapInt                 (TEXTURETYPE_1D,                GL_RGBA8I,                              256,    1,      1,      9,      samplerNearestMipmap);
3222         static const TextureSpec tex1DMipmapUint                (TEXTURETYPE_1D,                GL_RGBA8UI,                             256,    1,      1,      9,      samplerNearestMipmap);
3223
3224         static const TextureSpec tex1DShadow                    (TEXTURETYPE_1D,                GL_DEPTH_COMPONENT16,   256,    1,      1,      1,      samplerShadowNoMipmap);
3225         static const TextureSpec tex1DMipmapShadow              (TEXTURETYPE_1D,                GL_DEPTH_COMPONENT16,   256,    1,      1,      9,      samplerShadowMipmap);
3226
3227         static const TextureSpec tex1DTexelFetchFixed   (TEXTURETYPE_1D,                GL_RGBA8,                               256,    1,      1,      9,      samplerTexelFetch);
3228         static const TextureSpec tex1DTexelFetchFloat   (TEXTURETYPE_1D,                GL_RGBA16F,                             256,    1,      1,      9,      samplerTexelFetch);
3229         static const TextureSpec tex1DTexelFetchInt             (TEXTURETYPE_1D,                GL_RGBA8I,                              256,    1,      1,      9,      samplerTexelFetch);
3230         static const TextureSpec tex1DTexelFetchUint    (TEXTURETYPE_1D,                GL_RGBA8UI,                             256,    1,      1,      9,      samplerTexelFetch);
3231
3232         static const TextureSpec tex1DArrayFixed                (TEXTURETYPE_1D_ARRAY,  GL_RGBA8,       256,    1,      4,      1,      samplerLinearNoMipmap);
3233         static const TextureSpec tex1DArrayFloat                (TEXTURETYPE_1D_ARRAY,  GL_RGBA16F,     256,    1,      4,      1,      samplerLinearNoMipmap);
3234         static const TextureSpec tex1DArrayInt                  (TEXTURETYPE_1D_ARRAY,  GL_RGBA8I,      256,    1,      4,      1,      samplerNearestNoMipmap);
3235         static const TextureSpec tex1DArrayUint                 (TEXTURETYPE_1D_ARRAY,  GL_RGBA8UI,     256,    1,      4,      1,      samplerNearestNoMipmap);
3236         static const TextureSpec tex1DArrayMipmapFixed  (TEXTURETYPE_1D_ARRAY,  GL_RGBA8,       256,    1,      4,      9,      samplerLinearMipmap);
3237         static const TextureSpec tex1DArrayMipmapFloat  (TEXTURETYPE_1D_ARRAY,  GL_RGBA16F,     256,    1,      4,      9,      samplerLinearMipmap);
3238         static const TextureSpec tex1DArrayMipmapInt    (TEXTURETYPE_1D_ARRAY,  GL_RGBA8I,      256,    1,      4,      9,      samplerNearestMipmap);
3239         static const TextureSpec tex1DArrayMipmapUint   (TEXTURETYPE_1D_ARRAY,  GL_RGBA8UI,     256,    1,      4,      9,      samplerNearestMipmap);
3240
3241         static const TextureSpec tex1DArrayShadow               (TEXTURETYPE_1D_ARRAY,  GL_DEPTH_COMPONENT16,   256,    1,      4,      1,      samplerShadowNoMipmap);
3242         static const TextureSpec tex1DArrayMipmapShadow (TEXTURETYPE_1D_ARRAY,  GL_DEPTH_COMPONENT16,   256,    1,      4,      9,      samplerShadowMipmap);
3243
3244         static const TextureSpec tex1DArrayTexelFetchFixed      (TEXTURETYPE_1D_ARRAY,  GL_RGBA8,       256,    1,      4,      9,      samplerTexelFetch);
3245         static const TextureSpec tex1DArrayTexelFetchFloat      (TEXTURETYPE_1D_ARRAY,  GL_RGBA16F,     256,    1,      4,      9,      samplerTexelFetch);
3246         static const TextureSpec tex1DArrayTexelFetchInt        (TEXTURETYPE_1D_ARRAY,  GL_RGBA8I,      256,    1,      4,      9,      samplerTexelFetch);
3247         static const TextureSpec tex1DArrayTexelFetchUint       (TEXTURETYPE_1D_ARRAY,  GL_RGBA8UI,     256,    1,      4,      9,      samplerTexelFetch);
3248
3249         static const TextureSpec texCubeArrayFixed                      (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA8,       64,             64,             12,     1,      samplerLinearNoMipmap);
3250         static const TextureSpec texCubeArrayFloat                      (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA16F,     64,             64,             12,     1,      samplerLinearNoMipmap);
3251         static const TextureSpec texCubeArrayInt                        (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA8I,      64,             64,             12,     1,      samplerNearestNoMipmap);
3252         static const TextureSpec texCubeArrayUint                       (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA8UI,     64,             64,             12,     1,      samplerNearestNoMipmap);
3253         static const TextureSpec texCubeArrayMipmapFixed        (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA8,       64,             64,             12,     7,      samplerLinearMipmap);
3254         static const TextureSpec texCubeArrayMipmapFloat        (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA16F,     64,             64,             12,     7,      samplerLinearMipmap);
3255         static const TextureSpec texCubeArrayMipmapInt          (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA8I,      64,             64,             12,     7,      samplerNearestMipmap);
3256         static const TextureSpec texCubeArrayMipmapUint         (TEXTURETYPE_CUBE_ARRAY,        GL_RGBA8UI,     64,             64,             12,     7,      samplerNearestMipmap);
3257
3258         static const TextureSpec texCubeArrayShadow                     (TEXTURETYPE_CUBE_ARRAY,        GL_DEPTH_COMPONENT16,   64,             64,             12,     1,      samplerShadowNoMipmap);
3259         static const TextureSpec texCubeArrayMipmapShadow       (TEXTURETYPE_CUBE_ARRAY,        GL_DEPTH_COMPONENT16,   64,             64,             12,     7,      samplerShadowMipmap);
3260
3261         // texture() cases
3262         static const TexFuncCaseSpec textureCases[] =
3263         {
3264                 //                Name                                                  Function                        MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset          Format                                  EvalFunc                                Flags
3265                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DFixed,                             evalTexture2D,                  VERTEX),
3266                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2D,                  FRAGMENT),
3267                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DFloat,                             evalTexture2D,                  VERTEX),
3268                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2D,                  FRAGMENT),
3269                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DInt,                               evalTexture2D,                  VERTEX),
3270                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2D,                  FRAGMENT),
3271                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DUint,                              evalTexture2D,                  VERTEX),
3272                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2D,                  FRAGMENT),
3273
3274                 CASE_SPEC(sampler2d_bias_fixed,                 FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DBias,              FRAGMENT),
3275                 CASE_SPEC(sampler2d_bias_float,                 FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DBias,              FRAGMENT),
3276                 CASE_SPEC(isampler2d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DBias,              FRAGMENT),
3277                 CASE_SPEC(usampler2d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DBias,              FRAGMENT),
3278
3279                 CASE_SPEC(samplercube_fixed,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeFixed,                   evalTextureCube,                VERTEX),
3280                 CASE_SPEC(samplercube_fixed,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeMipmapFixed,             evalTextureCube,                FRAGMENT),
3281                 CASE_SPEC(samplercube_float,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeFloat,                   evalTextureCube,                VERTEX),
3282                 CASE_SPEC(samplercube_float,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeMipmapFloat,             evalTextureCube,                FRAGMENT),
3283                 CASE_SPEC(isamplercube,                                 FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeInt,                             evalTextureCube,                VERTEX),
3284                 CASE_SPEC(isamplercube,                                 FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeMipmapInt,               evalTextureCube,                FRAGMENT),
3285                 CASE_SPEC(usamplercube,                                 FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeUint,                    evalTextureCube,                VERTEX),
3286                 CASE_SPEC(usamplercube,                                 FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeMipmapUint,              evalTextureCube,                FRAGMENT),
3287
3288                 CASE_SPEC(samplercube_bias_fixed,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeMipmapFixed,             evalTextureCubeBias,    FRAGMENT),
3289                 CASE_SPEC(samplercube_bias_float,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeMipmapFloat,             evalTextureCubeBias,    FRAGMENT),
3290                 CASE_SPEC(isamplercube_bias,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeMipmapInt,               evalTextureCubeBias,    FRAGMENT),
3291                 CASE_SPEC(usamplercube_bias,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeMipmapUint,              evalTextureCubeBias,    FRAGMENT),
3292
3293                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayFixed,                evalTexture2DArray,             VERTEX),
3294                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayMipmapFixed,  evalTexture2DArray,             FRAGMENT),
3295                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayFloat,                evalTexture2DArray,             VERTEX),
3296                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayMipmapFloat,  evalTexture2DArray,             FRAGMENT),
3297                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayInt,                  evalTexture2DArray,             VERTEX),
3298                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayMipmapInt,    evalTexture2DArray,             FRAGMENT),
3299                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayUint,                 evalTexture2DArray,             VERTEX),
3300                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayMipmapUint,   evalTexture2DArray,             FRAGMENT),
3301
3302                 CASE_SPEC(sampler2darray_bias_fixed,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DArrayMipmapFixed,  evalTexture2DArrayBias, FRAGMENT),
3303                 CASE_SPEC(sampler2darray_bias_float,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DArrayMipmapFloat,  evalTexture2DArrayBias, FRAGMENT),
3304                 CASE_SPEC(isampler2darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DArrayMipmapInt,    evalTexture2DArrayBias, FRAGMENT),
3305                 CASE_SPEC(usampler2darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DArrayMipmapUint,   evalTexture2DArrayBias, FRAGMENT),
3306
3307                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DFixed,                             evalTexture3D,                  VERTEX),
3308                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3D,                  FRAGMENT),
3309                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DFloat,                             evalTexture3D,                  VERTEX),
3310                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3D,                  FRAGMENT),
3311                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DInt,                               evalTexture3D,                  VERTEX),
3312                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3D,                  FRAGMENT),
3313                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DUint,                              evalTexture3D,                  VERTEX),
3314                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapUint,                evalTexture3D,                  FRAGMENT),
3315
3316                 CASE_SPEC(sampler3d_bias_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  1.0f,   false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3DBias,              FRAGMENT),
3317                 CASE_SPEC(sampler3d_bias_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  1.0f,   false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DBias,              FRAGMENT),
3318                 CASE_SPEC(isampler3d_bias,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3DBias,              FRAGMENT),
3319                 CASE_SPEC(usampler3d_bias,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DBias,              FRAGMENT),
3320
3321                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DFixed,                             evalTexture1D,                  VERTEX),
3322                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1D,                  FRAGMENT),
3323                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DFloat,                             evalTexture1D,                  VERTEX),
3324                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1D,                  FRAGMENT),
3325                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DInt,                               evalTexture1D,                  VERTEX),
3326                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1D,                  FRAGMENT),
3327                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DUint,                              evalTexture1D,                  VERTEX),
3328                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1D,                  FRAGMENT),
3329
3330                 CASE_SPEC(sampler1d_bias_fixed,                 FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DBias,              FRAGMENT),
3331                 CASE_SPEC(sampler1d_bias_float,                 FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DBias,              FRAGMENT),
3332                 CASE_SPEC(isampler1d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DBias,              FRAGMENT),
3333                 CASE_SPEC(usampler1d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DBias,              FRAGMENT),
3334
3335                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayFixed,                evalTexture1DArray,             VERTEX),
3336                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayMipmapFixed,  evalTexture1DArray,             FRAGMENT),
3337                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayFloat,                evalTexture1DArray,             VERTEX),
3338                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayMipmapFloat,  evalTexture1DArray,             FRAGMENT),
3339                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayInt,                  evalTexture1DArray,             VERTEX),
3340                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayMipmapInt,    evalTexture1DArray,             FRAGMENT),
3341                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayUint,                 evalTexture1DArray,             VERTEX),
3342                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayMipmapUint,   evalTexture1DArray,             FRAGMENT),
3343
3344                 CASE_SPEC(sampler1darray_bias_fixed,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DArrayMipmapFixed,  evalTexture1DArrayBias, FRAGMENT),
3345                 CASE_SPEC(sampler1darray_bias_float,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DArrayMipmapFloat,  evalTexture1DArrayBias, FRAGMENT),
3346                 CASE_SPEC(isampler1darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DArrayMipmapInt,    evalTexture1DArrayBias, FRAGMENT),
3347                 CASE_SPEC(usampler1darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DArrayMipmapUint,   evalTexture1DArrayBias, FRAGMENT),
3348
3349                 CASE_SPEC(samplercubearray_fixed,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayFixed,                      evalTextureCubeArray,           VERTEX),
3350                 CASE_SPEC(samplercubearray_fixed,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayMipmapFixed,        evalTextureCubeArray,           FRAGMENT),
3351                 CASE_SPEC(samplercubearray_float,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayFloat,                      evalTextureCubeArray,           VERTEX),
3352                 CASE_SPEC(samplercubearray_float,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayMipmapFloat,        evalTextureCubeArray,           FRAGMENT),
3353                 CASE_SPEC(isamplercubearray,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayInt,                        evalTextureCubeArray,           VERTEX),
3354                 CASE_SPEC(isamplercubearray,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayMipmapInt,          evalTextureCubeArray,           FRAGMENT),
3355                 CASE_SPEC(usamplercubearray,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayUint,                       evalTextureCubeArray,           VERTEX),
3356                 CASE_SPEC(usamplercubearray,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayMipmapUint,         evalTextureCubeArray,           FRAGMENT),
3357
3358                 CASE_SPEC(samplercubearray_bias_fixed,  FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeArrayMipmapFixed,        evalTextureCubeArrayBias,       FRAGMENT),
3359                 CASE_SPEC(samplercubearray_bias_float,  FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeArrayMipmapFloat,        evalTextureCubeArrayBias,       FRAGMENT),
3360                 CASE_SPEC(isamplercubearray_bias,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeArrayMipmapInt,          evalTextureCubeArrayBias,       FRAGMENT),
3361                 CASE_SPEC(usamplercubearray_bias,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeArrayMipmapUint,         evalTextureCubeArrayBias,       FRAGMENT),
3362
3363                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DShadow,                    evalTexture2DShadow,                    VERTEX),
3364                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadow,                    FRAGMENT),
3365                 CASE_SPEC(sampler2dshadow_bias,                 FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowBias,                FRAGMENT),
3366
3367                 CASE_SPEC(samplercubeshadow,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  1.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeShadow,                  evalTextureCubeShadow,                  VERTEX),
3368                 CASE_SPEC(samplercubeshadow,                    FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  1.0f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeMipmapShadow,    evalTextureCubeShadow,                  FRAGMENT),
3369                 CASE_SPEC(samplercubeshadow_bias,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  1.0f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       texCubeMipmapShadow,    evalTextureCubeShadowBias,              FRAGMENT),
3370
3371                 CASE_SPEC(sampler2darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayShadow,               evalTexture2DArrayShadow,               VERTEX),
3372                 CASE_SPEC(sampler2darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayMipmapShadow, evalTexture2DArrayShadow,               FRAGMENT),
3373
3374                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DShadow,                    evalTexture1DShadow,                    VERTEX),
3375                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadow,                    FRAGMENT),
3376                 CASE_SPEC(sampler1dshadow_bias,                 FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowBias,                FRAGMENT),
3377
3378                 CASE_SPEC(sampler1darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayShadow,               evalTexture1DArrayShadow,               VERTEX),
3379                 CASE_SPEC(sampler1darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayMipmapShadow, evalTexture1DArrayShadow,               FRAGMENT),
3380                 CASE_SPEC(sampler1darrayshadow_bias,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DArrayMipmapShadow, evalTexture1DArrayShadowBias,   FRAGMENT),
3381
3382                 CASE_SPEC(samplercubearrayshadow,               FUNCTION_TEXTURE,       Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       texCubeArrayMipmapShadow,       evalTextureCubeArrayShadow,             FRAGMENT),
3383         };
3384         createCaseGroup(this, "texture", "texture() Tests", textureCases, DE_LENGTH_OF_ARRAY(textureCases));
3385
3386         // textureOffset() cases
3387         // \note _bias variants are not using mipmap thanks to wide allowed range for LOD computation
3388         static const TexFuncCaseSpec textureOffsetCases[] =
3389         {
3390                 //                Name                                                  Function                        MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset                          Format                                  EvalFunc                                                Flags
3391                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DFixed,                             evalTexture2DOffset,                    VERTEX),
3392                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFixed,               evalTexture2DOffset,                    FRAGMENT),
3393                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DFloat,                             evalTexture2DOffset,                    VERTEX),
3394                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DOffset,                    FRAGMENT),
3395                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DInt,                               evalTexture2DOffset,                    VERTEX),
3396                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapInt,                 evalTexture2DOffset,                    FRAGMENT),
3397                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DUint,                              evalTexture2DOffset,                    VERTEX),
3398                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DOffset,                    FRAGMENT),
3399
3400                 CASE_SPEC(sampler2d_bias_fixed,                 FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DFixed,                             evalTexture2DOffsetBias,                FRAGMENT),
3401                 CASE_SPEC(sampler2d_bias_float,                 FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DFloat,                             evalTexture2DOffsetBias,                FRAGMENT),
3402                 CASE_SPEC(isampler2d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DInt,                               evalTexture2DOffsetBias,                FRAGMENT),
3403                 CASE_SPEC(usampler2d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DUint,                              evalTexture2DOffsetBias,                FRAGMENT),
3404
3405                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayFixed,                evalTexture2DArrayOffset,               VERTEX),
3406                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DArrayMipmapFixed,  evalTexture2DArrayOffset,               FRAGMENT),
3407                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayFloat,                evalTexture2DArrayOffset,               VERTEX),
3408                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DArrayMipmapFloat,  evalTexture2DArrayOffset,               FRAGMENT),
3409                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayInt,                  evalTexture2DArrayOffset,               VERTEX),
3410                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DArrayMipmapInt,    evalTexture2DArrayOffset,               FRAGMENT),
3411                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayUint,                 evalTexture2DArrayOffset,               VERTEX),
3412                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DArrayMipmapUint,   evalTexture2DArrayOffset,               FRAGMENT),
3413
3414                 CASE_SPEC(sampler2darray_bias_fixed,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayFixed,                evalTexture2DArrayOffsetBias,   FRAGMENT),
3415                 CASE_SPEC(sampler2darray_bias_float,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DArrayFloat,                evalTexture2DArrayOffsetBias,   FRAGMENT),
3416                 CASE_SPEC(isampler2darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayInt,                  evalTexture2DArrayOffsetBias,   FRAGMENT),
3417                 CASE_SPEC(usampler2darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DArrayUint,                 evalTexture2DArrayOffsetBias,   FRAGMENT),
3418
3419                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DFixed,                             evalTexture3DOffset,                    VERTEX),
3420                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, 3, -8),        tex3DMipmapFixed,               evalTexture3DOffset,                    FRAGMENT),
3421                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(3, -8, 7),        tex3DFloat,                             evalTexture3DOffset,                    VERTEX),
3422                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DMipmapFloat,               evalTexture3DOffset,                    FRAGMENT),
3423                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, 3, -8),        tex3DInt,                               evalTexture3DOffset,                    VERTEX),
3424                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(3, -8, 7),        tex3DMipmapInt,                 evalTexture3DOffset,                    FRAGMENT),
3425                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DUint,                              evalTexture3DOffset,                    VERTEX),
3426                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, 3, -8),        tex3DMipmapUint,                evalTexture3DOffset,                    FRAGMENT),
3427
3428                 CASE_SPEC(sampler3d_bias_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  1.0f,   true,   IVec3(-8, 7, 3),        tex3DFixed,                             evalTexture3DOffsetBias,                FRAGMENT),
3429                 CASE_SPEC(sampler3d_bias_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  1.0f,   true,   IVec3(7, 3, -8),        tex3DFloat,                             evalTexture3DOffsetBias,                FRAGMENT),
3430                 CASE_SPEC(isampler3d_bias,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(3, -8, 7),        tex3DInt,                               evalTexture3DOffsetBias,                FRAGMENT),
3431                 CASE_SPEC(usampler3d_bias,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 3),        tex3DUint,                              evalTexture3DOffsetBias,                FRAGMENT),
3432
3433                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DFixed,                             evalTexture1DOffset,                    VERTEX),
3434                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DMipmapFixed,               evalTexture1DOffset,                    FRAGMENT),
3435                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DFloat,                             evalTexture1DOffset,                    VERTEX),
3436                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DMipmapFloat,               evalTexture1DOffset,                    FRAGMENT),
3437                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DInt,                               evalTexture1DOffset,                    VERTEX),
3438                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DMipmapInt,                 evalTexture1DOffset,                    FRAGMENT),
3439                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DUint,                              evalTexture1DOffset,                    VERTEX),
3440                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DMipmapUint,                evalTexture1DOffset,                    FRAGMENT),
3441
3442                 CASE_SPEC(sampler1d_bias_fixed,                 FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DFixed,                             evalTexture1DOffsetBias,                FRAGMENT),
3443                 CASE_SPEC(sampler1d_bias_float,                 FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3( 7, 0, 0),        tex1DFloat,                             evalTexture1DOffsetBias,                FRAGMENT),
3444                 CASE_SPEC(isampler1d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DInt,                               evalTexture1DOffsetBias,                FRAGMENT),
3445                 CASE_SPEC(usampler1d_bias,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3( 7, 0, 0),        tex1DUint,                              evalTexture1DOffsetBias,                FRAGMENT),
3446
3447                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayFixed,                evalTexture1DArrayOffset,               VERTEX),
3448                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DArrayMipmapFixed,  evalTexture1DArrayOffset,               FRAGMENT),
3449                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayFloat,                evalTexture1DArrayOffset,               VERTEX),
3450                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DArrayMipmapFloat,  evalTexture1DArrayOffset,               FRAGMENT),
3451                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayInt,                  evalTexture1DArrayOffset,               VERTEX),
3452                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DArrayMipmapInt,    evalTexture1DArrayOffset,               FRAGMENT),
3453                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayUint,                 evalTexture1DArrayOffset,               VERTEX),
3454                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DArrayMipmapUint,   evalTexture1DArrayOffset,               FRAGMENT),
3455
3456                 CASE_SPEC(sampler1darray_bias_fixed,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f, -0.5f,  0.0f),       Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayFixed,                evalTexture1DArrayOffsetBias,   FRAGMENT),
3457                 CASE_SPEC(sampler1darray_bias_float,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3( 7, 0, 0),        tex1DArrayFloat,                evalTexture1DArrayOffsetBias,   FRAGMENT),
3458                 CASE_SPEC(isampler1darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayInt,                  evalTexture1DArrayOffsetBias,   FRAGMENT),
3459                 CASE_SPEC(usampler1darray_bias,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3( 7, 0, 0),        tex1DArrayUint,                 evalTexture1DArrayOffsetBias,   FRAGMENT),
3460
3461                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DShadow,                    evalTexture2DShadowOffset,                      VERTEX),
3462                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapShadow,              evalTexture2DShadowOffset,                      FRAGMENT),
3463                 CASE_SPEC(sampler2dshadow_bias,                 FUNCTION_TEXTURE,       Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DShadow,                    evalTexture2DShadowOffsetBias,          FRAGMENT),
3464                 CASE_SPEC(sampler2darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayShadow,               evalTexture2DArrayShadowOffset,         VERTEX),
3465                 CASE_SPEC(sampler2darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DArrayMipmapShadow, evalTexture2DArrayShadowOffset,         FRAGMENT),
3466                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DShadow,                    evalTexture1DShadowOffset,                      VERTEX),
3467                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DMipmapShadow,              evalTexture1DShadowOffset,                      FRAGMENT),
3468                 CASE_SPEC(sampler1dshadow_bias,                 FUNCTION_TEXTURE,       Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DShadow,                    evalTexture1DShadowOffsetBias,          FRAGMENT),
3469                 CASE_SPEC(sampler1darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayShadow,               evalTexture1DArrayShadowOffset,         VERTEX),
3470                 CASE_SPEC(sampler1darrayshadow,                 FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3( 7, 0, 0),        tex1DArrayMipmapShadow, evalTexture1DArrayShadowOffset,         FRAGMENT),
3471                 CASE_SPEC(sampler1darrayshadow_bias,    FUNCTION_TEXTURE,       Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayShadow,               evalTexture1DArrayShadowOffsetBias,     FRAGMENT),
3472         };
3473         createCaseGroup(this, "textureoffset", "textureOffset() Tests", textureOffsetCases, DE_LENGTH_OF_ARRAY(textureOffsetCases));
3474
3475         // textureProj() cases
3476         // \note Currently uses constant divider!
3477         static const TexFuncCaseSpec textureProjCases[] =
3478         {
3479                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset          Format                                  EvalFunc                                Flags
3480                 CASE_SPEC(sampler2d_vec3_fixed,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DFixed,                             evalTexture2DProj3,             VERTEX),
3481                 CASE_SPEC(sampler2d_vec3_fixed,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProj3,             FRAGMENT),
3482                 CASE_SPEC(sampler2d_vec3_float,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DFloat,                             evalTexture2DProj3,             VERTEX),
3483                 CASE_SPEC(sampler2d_vec3_float,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProj3,             FRAGMENT),
3484                 CASE_SPEC(isampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DInt,                               evalTexture2DProj3,             VERTEX),
3485                 CASE_SPEC(isampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProj3,             FRAGMENT),
3486                 CASE_SPEC(usampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DUint,                              evalTexture2DProj3,             VERTEX),
3487                 CASE_SPEC(usampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProj3,             FRAGMENT),
3488
3489                 CASE_SPEC(sampler2d_vec3_bias_fixed,    FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProj3Bias, FRAGMENT),
3490                 CASE_SPEC(sampler2d_vec3_bias_float,    FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProj3Bias, FRAGMENT),
3491                 CASE_SPEC(isampler2d_vec3_bias,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProj3Bias, FRAGMENT),
3492                 CASE_SPEC(usampler2d_vec3_bias,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProj3Bias, FRAGMENT),
3493
3494                 CASE_SPEC(sampler2d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DFixed,                             evalTexture2DProj,              VERTEX),
3495                 CASE_SPEC(sampler2d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProj,              FRAGMENT),
3496                 CASE_SPEC(sampler2d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DFloat,                             evalTexture2DProj,              VERTEX),
3497                 CASE_SPEC(sampler2d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProj,              FRAGMENT),
3498                 CASE_SPEC(isampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DInt,                               evalTexture2DProj,              VERTEX),
3499                 CASE_SPEC(isampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProj,              FRAGMENT),
3500                 CASE_SPEC(usampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DUint,                              evalTexture2DProj,              VERTEX),
3501                 CASE_SPEC(usampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProj,              FRAGMENT),
3502
3503                 CASE_SPEC(sampler2d_vec4_bias_fixed,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProjBias,  FRAGMENT),
3504                 CASE_SPEC(sampler2d_vec4_bias_float,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProjBias,  FRAGMENT),
3505                 CASE_SPEC(isampler2d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProjBias,  FRAGMENT),
3506                 CASE_SPEC(usampler2d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProjBias,  FRAGMENT),
3507
3508                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DFixed,                             evalTexture3DProj,              VERTEX),
3509                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3DProj,              FRAGMENT),
3510                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DFloat,                             evalTexture3DProj,              VERTEX),
3511                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DProj,              FRAGMENT),
3512                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DInt,                               evalTexture3DProj,              VERTEX),
3513                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3DProj,              FRAGMENT),
3514                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DUint,                              evalTexture3DProj,              VERTEX),
3515                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DProj,              FRAGMENT),
3516
3517                 CASE_SPEC(sampler3d_bias_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  1.0f,   false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3DProjBias,  FRAGMENT),
3518                 CASE_SPEC(sampler3d_bias_float,                 FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  1.0f,   false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DProjBias,  FRAGMENT),
3519                 CASE_SPEC(isampler3d_bias,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  2.0f,   false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3DProjBias,  FRAGMENT),
3520                 CASE_SPEC(usampler3d_bias,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  2.0f,   false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DProjBias,  FRAGMENT),
3521
3522                 CASE_SPEC(sampler1d_vec2_fixed,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DFixed,                             evalTexture1DProj2,             VERTEX),
3523                 CASE_SPEC(sampler1d_vec2_fixed,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProj2,             FRAGMENT),
3524                 CASE_SPEC(sampler1d_vec2_float,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DFloat,                             evalTexture1DProj2,             VERTEX),
3525                 CASE_SPEC(sampler1d_vec2_float,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProj2,             FRAGMENT),
3526                 CASE_SPEC(isampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DInt,                               evalTexture1DProj2,             VERTEX),
3527                 CASE_SPEC(isampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProj2,             FRAGMENT),
3528                 CASE_SPEC(usampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DUint,                              evalTexture1DProj2,             VERTEX),
3529                 CASE_SPEC(usampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProj2,             FRAGMENT),
3530
3531                 CASE_SPEC(sampler1d_vec2_bias_fixed,    FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProj2Bias, FRAGMENT),
3532                 CASE_SPEC(sampler1d_vec2_bias_float,    FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProj2Bias, FRAGMENT),
3533                 CASE_SPEC(isampler1d_vec2_bias,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProj2Bias, FRAGMENT),
3534                 CASE_SPEC(usampler1d_vec2_bias,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProj2Bias, FRAGMENT),
3535
3536                 CASE_SPEC(sampler1d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DFixed,                             evalTexture1DProj,              VERTEX),
3537                 CASE_SPEC(sampler1d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProj,              FRAGMENT),
3538                 CASE_SPEC(sampler1d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DFloat,                             evalTexture1DProj,              VERTEX),
3539                 CASE_SPEC(sampler1d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProj,              FRAGMENT),
3540                 CASE_SPEC(isampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DInt,                               evalTexture1DProj,              VERTEX),
3541                 CASE_SPEC(isampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProj,              FRAGMENT),
3542                 CASE_SPEC(usampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DUint,                              evalTexture1DProj,              VERTEX),
3543                 CASE_SPEC(usampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProj,              FRAGMENT),
3544
3545                 CASE_SPEC(sampler1d_vec4_bias_fixed,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProjBias,  FRAGMENT),
3546                 CASE_SPEC(sampler1d_vec4_bias_float,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProjBias,  FRAGMENT),
3547                 CASE_SPEC(isampler1d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProjBias,  FRAGMENT),
3548                 CASE_SPEC(usampler1d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProjBias,  FRAGMENT),
3549
3550                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DShadow,                    evalTexture2DShadowProj,                VERTEX),
3551                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowProj,                FRAGMENT),
3552                 CASE_SPEC(sampler2dshadow_bias,                 FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowProjBias,    FRAGMENT),
3553                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,   0.0f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DShadow,                    evalTexture1DShadowProj,                VERTEX),
3554                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,   0.0f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowProj,                FRAGMENT),
3555                 CASE_SPEC(sampler1dshadow_bias,                 FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,   0.0f, 1.5f,  1.5f),      true,   -2.0f,  2.0f,   false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowProjBias,    FRAGMENT),
3556         };
3557         createCaseGroup(this, "textureproj", "textureProj() Tests", textureProjCases, DE_LENGTH_OF_ARRAY(textureProjCases));
3558
3559         // textureProjOffset() cases
3560         // \note Currently uses constant divider!
3561         static const TexFuncCaseSpec textureProjOffsetCases[] =
3562         {
3563                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset                          Format                                  EvalFunc                                                Flags
3564                 CASE_SPEC(sampler2d_vec3_fixed,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DFixed,                             evalTexture2DProj3Offset,               VERTEX),
3565                 CASE_SPEC(sampler2d_vec3_fixed,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFixed,               evalTexture2DProj3Offset,               FRAGMENT),
3566                 CASE_SPEC(sampler2d_vec3_float,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DFloat,                             evalTexture2DProj3Offset,               VERTEX),
3567                 CASE_SPEC(sampler2d_vec3_float,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DProj3Offset,               FRAGMENT),
3568                 CASE_SPEC(isampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DInt,                               evalTexture2DProj3Offset,               VERTEX),
3569                 CASE_SPEC(isampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapInt,                 evalTexture2DProj3Offset,               FRAGMENT),
3570                 CASE_SPEC(usampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DUint,                              evalTexture2DProj3Offset,               VERTEX),
3571                 CASE_SPEC(usampler2d_vec3,                              FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DProj3Offset,               FRAGMENT),
3572
3573                 CASE_SPEC(sampler2d_vec3_bias_fixed,    FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DFixed,                             evalTexture2DProj3OffsetBias,   FRAGMENT),
3574                 CASE_SPEC(sampler2d_vec3_bias_float,    FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DFloat,                             evalTexture2DProj3OffsetBias,   FRAGMENT),
3575                 CASE_SPEC(isampler2d_vec3_bias,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DInt,                               evalTexture2DProj3OffsetBias,   FRAGMENT),
3576                 CASE_SPEC(usampler2d_vec3_bias,                 FUNCTION_TEXTUREPROJ3,  Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DUint,                              evalTexture2DProj3OffsetBias,   FRAGMENT),
3577
3578                 CASE_SPEC(sampler2d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DFixed,                             evalTexture2DProjOffset,                VERTEX),
3579                 CASE_SPEC(sampler2d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFixed,               evalTexture2DProjOffset,                FRAGMENT),
3580                 CASE_SPEC(sampler2d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DFloat,                             evalTexture2DProjOffset,                VERTEX),
3581                 CASE_SPEC(sampler2d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DProjOffset,                FRAGMENT),
3582                 CASE_SPEC(isampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DInt,                               evalTexture2DProjOffset,                VERTEX),
3583                 CASE_SPEC(isampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapInt,                 evalTexture2DProjOffset,                FRAGMENT),
3584                 CASE_SPEC(usampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DUint,                              evalTexture2DProjOffset,                VERTEX),
3585                 CASE_SPEC(usampler2d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DProjOffset,                FRAGMENT),
3586
3587                 CASE_SPEC(sampler2d_vec4_bias_fixed,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DFixed,                             evalTexture2DProjOffsetBias,    FRAGMENT),
3588                 CASE_SPEC(sampler2d_vec4_bias_float,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DFloat,                             evalTexture2DProjOffsetBias,    FRAGMENT),
3589                 CASE_SPEC(isampler2d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DInt,                               evalTexture2DProjOffsetBias,    FRAGMENT),
3590                 CASE_SPEC(usampler2d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(7, -8, 0),        tex2DUint,                              evalTexture2DProjOffsetBias,    FRAGMENT),
3591
3592                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DFixed,                             evalTexture3DProjOffset,                VERTEX),
3593                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7, 3, -8),        tex3DMipmapFixed,               evalTexture3DProjOffset,                FRAGMENT),
3594                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(3, -8, 7),        tex3DFloat,                             evalTexture3DProjOffset,                VERTEX),
3595                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DMipmapFloat,               evalTexture3DProjOffset,                FRAGMENT),
3596                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7, 3, -8),        tex3DInt,                               evalTexture3DProjOffset,                VERTEX),
3597                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(3, -8, 7),        tex3DMipmapInt,                 evalTexture3DProjOffset,                FRAGMENT),
3598                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DUint,                              evalTexture3DProjOffset,                VERTEX),
3599                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTUREPROJ,   Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  2.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7, 3, -8),        tex3DMipmapUint,                evalTexture3DProjOffset,                FRAGMENT),
3600
3601                 CASE_SPEC(sampler3d_bias_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 3),        tex3DFixed,                             evalTexture3DProjOffsetBias,    FRAGMENT),
3602                 CASE_SPEC(sampler3d_bias_float,                 FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  2.0f,   true,   IVec3(7, 3, -8),        tex3DFloat,                             evalTexture3DProjOffsetBias,    FRAGMENT),
3603                 CASE_SPEC(isampler3d_bias,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  2.0f,   true,   IVec3(3, -8, 7),        tex3DInt,                               evalTexture3DProjOffsetBias,    FRAGMENT),
3604                 CASE_SPEC(usampler3d_bias,                              FUNCTION_TEXTUREPROJ,   Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 3),        tex3DUint,                              evalTexture3DProjOffsetBias,    FRAGMENT),
3605
3606                 CASE_SPEC(sampler1d_vec2_fixed,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DFixed,                             evalTexture1DProj2Offset,               VERTEX),
3607                 CASE_SPEC(sampler1d_vec2_fixed,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapFixed,               evalTexture1DProj2Offset,               FRAGMENT),
3608                 CASE_SPEC(sampler1d_vec2_float,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DFloat,                             evalTexture1DProj2Offset,               VERTEX),
3609                 CASE_SPEC(sampler1d_vec2_float,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapFloat,               evalTexture1DProj2Offset,               FRAGMENT),
3610                 CASE_SPEC(isampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DInt,                               evalTexture1DProj2Offset,               VERTEX),
3611                 CASE_SPEC(isampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapInt,                 evalTexture1DProj2Offset,               FRAGMENT),
3612                 CASE_SPEC(usampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DUint,                              evalTexture1DProj2Offset,               VERTEX),
3613                 CASE_SPEC(usampler1d_vec2,                              FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapUint,                evalTexture1DProj2Offset,               FRAGMENT),
3614
3615                 CASE_SPEC(sampler1d_vec2_bias_fixed,    FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DFixed,                             evalTexture1DProj2OffsetBias,   FRAGMENT),
3616                 CASE_SPEC(sampler1d_vec2_bias_float,    FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7,  0, 0),        tex1DFloat,                             evalTexture1DProj2OffsetBias,   FRAGMENT),
3617                 CASE_SPEC(isampler1d_vec2_bias,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DInt,                               evalTexture1DProj2OffsetBias,   FRAGMENT),
3618                 CASE_SPEC(usampler1d_vec2_bias,                 FUNCTION_TEXTUREPROJ2,  Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       true,   -2.0f,  2.0f,   true,   IVec3(7,  0, 0),        tex1DUint,                              evalTexture1DProj2OffsetBias,   FRAGMENT),
3619
3620                 CASE_SPEC(sampler1d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DFixed,                             evalTexture1DProjOffset,                VERTEX),
3621                 CASE_SPEC(sampler1d_vec4_fixed,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapFixed,               evalTexture1DProjOffset,                FRAGMENT),
3622                 CASE_SPEC(sampler1d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DFloat,                             evalTexture1DProjOffset,                VERTEX),
3623                 CASE_SPEC(sampler1d_vec4_float,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapFloat,               evalTexture1DProjOffset,                FRAGMENT),
3624                 CASE_SPEC(isampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DInt,                               evalTexture1DProjOffset,                VERTEX),
3625                 CASE_SPEC(isampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapInt,                 evalTexture1DProjOffset,                FRAGMENT),
3626                 CASE_SPEC(usampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DUint,                              evalTexture1DProjOffset,                VERTEX),
3627                 CASE_SPEC(usampler1d_vec4,                              FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapUint,                evalTexture1DProjOffset,                FRAGMENT),
3628
3629                 CASE_SPEC(sampler1d_vec4_bias_fixed,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DFixed,                             evalTexture1DProjOffsetBias,    FRAGMENT),
3630                 CASE_SPEC(sampler1d_vec4_bias_float,    FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(7,  0, 0),        tex1DFloat,                             evalTexture1DProjOffsetBias,    FRAGMENT),
3631                 CASE_SPEC(isampler1d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DInt,                               evalTexture1DProjOffsetBias,    FRAGMENT),
3632                 CASE_SPEC(usampler1d_vec4_bias,                 FUNCTION_TEXTUREPROJ,   Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       true,   -2.0f,  2.0f,   true,   IVec3(7,  0, 0),        tex1DUint,                              evalTexture1DProjOffsetBias,    FRAGMENT),
3633
3634                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DShadow,                    evalTexture2DShadowProjOffset,          VERTEX),
3635                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapShadow,              evalTexture2DShadowProjOffset,          FRAGMENT),
3636                 CASE_SPEC(sampler2dshadow_bias,                 FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      true,   -2.0f,  2.0f,   true,   IVec3(-8, 7, 0),        tex2DShadow,                    evalTexture2DShadowProjOffsetBias,      FRAGMENT),
3637                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,   0.0f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DShadow,                    evalTexture1DShadowProjOffset,          VERTEX),
3638                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,   0.0f, 1.5f,  1.5f),      false,  0.0f,   0.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapShadow,              evalTexture1DShadowProjOffset,          FRAGMENT),
3639                 CASE_SPEC(sampler1dshadow_bias,                 FUNCTION_TEXTUREPROJ,   Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,   0.0f, 1.5f,  1.5f),      true,   -2.0f,  2.0f,   true,   IVec3(-8, 0, 0),        tex1DShadow,                    evalTexture1DShadowProjOffsetBias,      FRAGMENT),
3640         };
3641         createCaseGroup(this, "textureprojoffset", "textureOffsetProj() Tests", textureProjOffsetCases, DE_LENGTH_OF_ARRAY(textureProjOffsetCases));
3642
3643         // textureLod() cases
3644         static const TexFuncCaseSpec textureLodCases[] =
3645         {
3646                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset          Format                                  EvalFunc                                Flags
3647                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DLod,               BOTH),
3648                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DLod,               BOTH),
3649                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DLod,               BOTH),
3650                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DLod,               BOTH),
3651
3652                 CASE_SPEC(samplercube_fixed,                    FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      false,  -1.0f,  9.0f,   false,  IVec3(0),       texCubeMipmapFixed,             evalTextureCubeLod,             BOTH),
3653                 CASE_SPEC(samplercube_float,                    FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      false,  -1.0f,  9.0f,   false,  IVec3(0),       texCubeMipmapFloat,             evalTextureCubeLod,             BOTH),
3654                 CASE_SPEC(isamplercube,                                 FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      false,  -1.0f,  9.0f,   false,  IVec3(0),       texCubeMipmapInt,               evalTextureCubeLod,             BOTH),
3655                 CASE_SPEC(usamplercube,                                 FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      false,  -1.0f,  9.0f,   false,  IVec3(0),       texCubeMipmapUint,              evalTextureCubeLod,             BOTH),
3656
3657                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   false,  IVec3(0),       tex2DArrayMipmapFixed,  evalTexture2DArrayLod,  BOTH),
3658                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   false,  IVec3(0),       tex2DArrayMipmapFloat,  evalTexture2DArrayLod,  BOTH),
3659                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   false,  IVec3(0),       tex2DArrayMipmapInt,    evalTexture2DArrayLod,  BOTH),
3660                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   false,  IVec3(0),       tex2DArrayMipmapUint,   evalTexture2DArrayLod,  BOTH),
3661
3662                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3DLod,               BOTH),
3663                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DLod,               BOTH),
3664                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3DLod,               BOTH),
3665                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DLod,               BOTH),
3666
3667                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DLod,               BOTH),
3668                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DLod,               BOTH),
3669                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DLod,               BOTH),
3670                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DLod,               BOTH),
3671
3672                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DArrayMipmapFixed,  evalTexture1DArrayLod,  BOTH),
3673                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DArrayMipmapFloat,  evalTexture1DArrayLod,  BOTH),
3674                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DArrayMipmapInt,    evalTexture1DArrayLod,  BOTH),
3675                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DArrayMipmapUint,   evalTexture1DArrayLod,  BOTH),
3676
3677                 CASE_SPEC(samplercubearray_fixed,               FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      false,  -1.0f,  7.0f,   false,  IVec3(0),       texCubeArrayMipmapFixed,        evalTextureCubeArrayLod,        BOTH),
3678                 CASE_SPEC(samplercubearray_float,               FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      false,  -1.0f,  7.0f,   false,  IVec3(0),       texCubeArrayMipmapFloat,        evalTextureCubeArrayLod,        BOTH),
3679                 CASE_SPEC(isamplercubearray,                    FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      false,  -1.0f,  7.0f,   false,  IVec3(0),       texCubeArrayMipmapInt,          evalTextureCubeArrayLod,        BOTH),
3680                 CASE_SPEC(usamplercubearray,                    FUNCTION_TEXTURELOD,    Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      false,  -1.0f,  7.0f,   false,  IVec3(0),       texCubeArrayMipmapUint,         evalTextureCubeArrayLod,        BOTH),
3681
3682                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowLod,                 BOTH),
3683                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowLod,                 BOTH),
3684                 CASE_SPEC(sampler1darrayshadow,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DArrayMipmapShadow, evalTexture1DArrayShadowLod,    BOTH),
3685         };
3686         createCaseGroup(this, "texturelod", "textureLod() Tests", textureLodCases, DE_LENGTH_OF_ARRAY(textureLodCases));
3687
3688         // textureLodOffset() cases
3689         static const TexFuncCaseSpec textureLodOffsetCases[] =
3690         {
3691                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset                          Format                                  EvalFunc                                                Flags
3692                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapFixed,               evalTexture2DLodOffset,                 BOTH),
3693                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DLodOffset,                 BOTH),
3694                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapInt,                 evalTexture2DLodOffset,                 BOTH),
3695                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DLodOffset,                 BOTH),
3696
3697                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayMipmapFixed,  evalTexture2DArrayLodOffset,    BOTH),
3698                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   true,   IVec3(7, -8, 0),        tex2DArrayMipmapFloat,  evalTexture2DArrayLodOffset,    BOTH),
3699                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayMipmapInt,    evalTexture2DArrayLodOffset,    BOTH),
3700                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       false,  -1.0f,  8.0f,   true,   IVec3(7, -8, 0),        tex2DArrayMipmapUint,   evalTexture2DArrayLodOffset,    BOTH),
3701
3702                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   true,   IVec3(-8, 7, 3),        tex3DMipmapFixed,               evalTexture3DLodOffset,                 BOTH),
3703                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   true,   IVec3(7, 3, -8),        tex3DMipmapFloat,               evalTexture3DLodOffset,                 BOTH),
3704                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   true,   IVec3(3, -8, 7),        tex3DMipmapInt,                 evalTexture3DLodOffset,                 BOTH),
3705                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTURELOD,    Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       false,  -1.0f,  7.0f,   true,   IVec3(-8, 7, 3),        tex3DMipmapUint,                evalTexture3DLodOffset,                 BOTH),
3706
3707                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DMipmapFixed,               evalTexture1DLodOffset,                 BOTH),
3708                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapFloat,               evalTexture1DLodOffset,                 BOTH),
3709                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DMipmapInt,                 evalTexture1DLodOffset,                 BOTH),
3710                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapUint,                evalTexture1DLodOffset,                 BOTH),
3711
3712                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayMipmapFixed,  evalTexture1DArrayLodOffset,    BOTH),
3713                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DArrayMipmapFloat,  evalTexture1DArrayLodOffset,    BOTH),
3714                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayMipmapInt,    evalTexture1DArrayLodOffset,    BOTH),
3715                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DArrayMipmapUint,   evalTexture1DArrayLodOffset,    BOTH),
3716
3717                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapShadow,              evalTexture2DShadowLodOffset,           BOTH),
3718                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTURELOD,    Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DMipmapShadow,              evalTexture1DShadowLodOffset,           BOTH),
3719                 CASE_SPEC(sampler1darrayshadow,                 FUNCTION_TEXTURELOD,    Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DArrayMipmapShadow, evalTexture1DArrayShadowLodOffset,      BOTH),
3720         };
3721         createCaseGroup(this, "texturelodoffset", "textureLodOffset() Tests", textureLodOffsetCases, DE_LENGTH_OF_ARRAY(textureLodOffsetCases));
3722
3723         // textureProjLod() cases
3724         static const TexFuncCaseSpec textureProjLodCases[] =
3725         {
3726                 //                Name                                                  Function                                        MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset          Format                                  EvalFunc                                        Flags
3727                 CASE_SPEC(sampler2d_vec3_fixed,                 FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProjLod3,          BOTH),
3728                 CASE_SPEC(sampler2d_vec3_float,                 FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProjLod3,          BOTH),
3729                 CASE_SPEC(isampler2d_vec3,                              FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProjLod3,          BOTH),
3730                 CASE_SPEC(usampler2d_vec3,                              FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProjLod3,          BOTH),
3731
3732                 CASE_SPEC(sampler2d_vec4_fixed,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProjLod,           BOTH),
3733                 CASE_SPEC(sampler2d_vec4_float,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProjLod,           BOTH),
3734                 CASE_SPEC(isampler2d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProjLod,           BOTH),
3735                 CASE_SPEC(usampler2d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProjLod,           BOTH),
3736
3737                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3DProjLod,           BOTH),
3738                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DProjLod,           BOTH),
3739                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3DProjLod,           BOTH),
3740                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DProjLod,           BOTH),
3741
3742                 CASE_SPEC(sampler1d_vec2_fixed,                 FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProjLod2,          BOTH),
3743                 CASE_SPEC(sampler1d_vec2_float,                 FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProjLod2,          BOTH),
3744                 CASE_SPEC(isampler1d_vec2,                              FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProjLod2,          BOTH),
3745                 CASE_SPEC(usampler1d_vec2,                              FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProjLod2,          BOTH),
3746
3747                 CASE_SPEC(sampler1d_vec4_fixed,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProjLod,           BOTH),
3748                 CASE_SPEC(sampler1d_vec4_float,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProjLod,           BOTH),
3749                 CASE_SPEC(isampler1d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProjLod,           BOTH),
3750                 CASE_SPEC(usampler1d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProjLod,           BOTH),
3751
3752                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTUREPROJLOD,        Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      false,  -1.0f,  9.0f,   false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowProjLod,     BOTH),
3753                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTUREPROJLOD,        Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,  0.0f,  0.0f,  1.5f),      false,  -1.0f,  9.0f,   false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowProjLod,     BOTH),
3754         };
3755         createCaseGroup(this, "textureprojlod", "textureProjLod() Tests", textureProjLodCases, DE_LENGTH_OF_ARRAY(textureProjLodCases));
3756
3757         // textureProjLodOffset() cases
3758         static const TexFuncCaseSpec textureProjLodOffsetCases[] =
3759         {
3760                 //                Name                                                  Function                                        MinCoord                                                        MaxCoord                                                        Bias?   MinLod  MaxLod  Offset? Offset                          Format                                  EvalFunc                                                                Flags
3761                 CASE_SPEC(sampler2d_vec3_fixed,                 FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapFixed,               evalTexture2DProjLod3Offset,    BOTH),
3762                 CASE_SPEC(sampler2d_vec3_float,                 FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DProjLod3Offset,    BOTH),
3763                 CASE_SPEC(isampler2d_vec3,                              FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapInt,                 evalTexture2DProjLod3Offset,    BOTH),
3764                 CASE_SPEC(usampler2d_vec3,                              FUNCTION_TEXTUREPROJLOD3,       Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DProjLod3Offset,    BOTH),
3765
3766                 CASE_SPEC(sampler2d_vec4_fixed,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapFixed,               evalTexture2DProjLodOffset,             BOTH),
3767                 CASE_SPEC(sampler2d_vec4_float,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DProjLodOffset,             BOTH),
3768                 CASE_SPEC(isampler2d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapInt,                 evalTexture2DProjLodOffset,             BOTH),
3769                 CASE_SPEC(usampler2d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DProjLodOffset,             BOTH),
3770
3771                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   true,   IVec3(-8, 7, 3),        tex3DMipmapFixed,               evalTexture3DProjLodOffset,             BOTH),
3772                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   true,   IVec3(7, 3, -8),        tex3DMipmapFloat,               evalTexture3DProjLodOffset,             BOTH),
3773                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   true,   IVec3(3, -8, 7),        tex3DMipmapInt,                 evalTexture3DProjLodOffset,             BOTH),
3774                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXTUREPROJLOD,        Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     false,  -1.0f,  7.0f,   true,   IVec3(-8, 7, 3),        tex3DMipmapUint,                evalTexture3DProjLodOffset,             BOTH),
3775
3776                 CASE_SPEC(sampler1d_vec2_fixed,                 FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DMipmapFixed,               evalTexture1DProjLod2Offset,    BOTH),
3777                 CASE_SPEC(sampler1d_vec2_float,                 FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapFloat,               evalTexture1DProjLod2Offset,    BOTH),
3778                 CASE_SPEC(isampler1d_vec2,                              FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DMipmapInt,                 evalTexture1DProjLod2Offset,    BOTH),
3779                 CASE_SPEC(usampler1d_vec2,                              FUNCTION_TEXTUREPROJLOD2,       Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapUint,                evalTexture1DProjLod2Offset,    BOTH),
3780
3781                 CASE_SPEC(sampler1d_vec4_fixed,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DMipmapFixed,               evalTexture1DProjLodOffset,             BOTH),
3782                 CASE_SPEC(sampler1d_vec4_float,                 FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapFloat,               evalTexture1DProjLodOffset,             BOTH),
3783                 CASE_SPEC(isampler1d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(-8, 0, 0),        tex1DMipmapInt,                 evalTexture1DProjLodOffset,             BOTH),
3784                 CASE_SPEC(usampler1d_vec4,                              FUNCTION_TEXTUREPROJLOD,        Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapUint,                evalTexture1DProjLodOffset,             BOTH),
3785
3786                 CASE_SPEC(sampler2dshadow,                              FUNCTION_TEXTUREPROJLOD,        Vec4( 0.2f, 0.6f,  0.0f,  1.5f),        Vec4(-2.25f, -3.45f, 1.5f,  1.5f),      false,  -1.0f,  9.0f,   true,   IVec3(-8, 7, 0),        tex2DMipmapShadow,              evalTexture2DShadowProjLodOffset,       BOTH),
3787                 CASE_SPEC(sampler1dshadow,                              FUNCTION_TEXTUREPROJLOD,        Vec4( 0.2f, 0.0f,  0.0f,  1.5f),        Vec4(-2.25f,  0.0f,  1.5f,  1.5f),      false,  -1.0f,  9.0f,   true,   IVec3(7,  0, 0),        tex1DMipmapShadow,              evalTexture1DShadowProjLodOffset,       BOTH),
3788         };
3789         createCaseGroup(this, "textureprojlodoffset", "textureProjLodOffset() Tests", textureProjLodOffsetCases, DE_LENGTH_OF_ARRAY(textureProjLodOffsetCases));
3790
3791         // textureGrad() cases
3792         // \note Only one of dudx, dudy, dvdx, dvdy is non-zero since spec allows approximating p from derivates by various methods.
3793         static const TexFuncCaseSpec textureGradCases[] =
3794         {
3795                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                        MinDx                                           MaxDx                                           MinDy                                           MaxDy                                           Offset? Offset          Format                                  EvalFunc                                Flags
3796                 GRAD_CASE_SPEC(sampler2d_fixed,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DGrad,              BOTH),
3797                 GRAD_CASE_SPEC(sampler2d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DGrad,              BOTH),
3798                 GRAD_CASE_SPEC(isampler2d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DGrad,              BOTH),
3799                 GRAD_CASE_SPEC(usampler2d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DGrad,              BOTH),
3800
3801                 GRAD_CASE_SPEC(samplercube_fixed,               FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       texCubeMipmapFixed,             evalTextureCubeGrad,    BOTH),
3802                 GRAD_CASE_SPEC(samplercube_float,               FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       texCubeMipmapFloat,             evalTextureCubeGrad,    BOTH),
3803                 GRAD_CASE_SPEC(isamplercube,                    FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       texCubeMipmapInt,               evalTextureCubeGrad,    BOTH),
3804                 GRAD_CASE_SPEC(usamplercube,                    FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f, -1.01f,  0.0f),      Vec4( 1.0f,  1.0f, -1.01f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       texCubeMipmapUint,              evalTextureCubeGrad,    BOTH),
3805
3806                 GRAD_CASE_SPEC(sampler2darray_fixed,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DArrayMipmapFixed,  evalTexture2DArrayGrad, BOTH),
3807                 GRAD_CASE_SPEC(sampler2darray_float,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DArrayMipmapFloat,  evalTexture2DArrayGrad, BOTH),
3808                 GRAD_CASE_SPEC(isampler2darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DArrayMipmapInt,    evalTexture2DArrayGrad, BOTH),
3809                 GRAD_CASE_SPEC(usampler2darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       tex2DArrayMipmapUint,   evalTexture2DArrayGrad, BOTH),
3810
3811                 GRAD_CASE_SPEC(sampler3d_fixed,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3DGrad,              BOTH),
3812                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DGrad,              VERTEX),
3813                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.2f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DGrad,              FRAGMENT),
3814                 GRAD_CASE_SPEC(isampler3d,                              FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3DGrad,              BOTH),
3815                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DGrad,              VERTEX),
3816                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f, -0.2f),      false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DGrad,              FRAGMENT),
3817
3818                 GRAD_CASE_SPEC(sampler1d_fixed,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DGrad,              BOTH),
3819                 GRAD_CASE_SPEC(sampler1d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DGrad,              BOTH),
3820                 GRAD_CASE_SPEC(isampler1d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DGrad,              BOTH),
3821                 GRAD_CASE_SPEC(usampler1d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DGrad,              BOTH),
3822
3823                 GRAD_CASE_SPEC(sampler1darray_fixed,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DArrayMipmapFixed,  evalTexture1DArrayGrad, BOTH),
3824                 GRAD_CASE_SPEC(sampler1darray_float,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DArrayMipmapFloat,  evalTexture1DArrayGrad, BOTH),
3825                 GRAD_CASE_SPEC(isampler1darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DArrayMipmapInt,    evalTexture1DArrayGrad, BOTH),
3826                 GRAD_CASE_SPEC(usampler1darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DArrayMipmapUint,   evalTexture1DArrayGrad, BOTH),
3827
3828                 GRAD_CASE_SPEC(samplercubearray_fixed,  FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       texCubeArrayMipmapFixed,        evalTextureCubeArrayGrad,       BOTH),
3829                 GRAD_CASE_SPEC(samplercubearray_float,  FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       texCubeArrayMipmapFloat,        evalTextureCubeArrayGrad,       BOTH),
3830                 GRAD_CASE_SPEC(isamplercubearray,               FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f,  1.01f, -0.5f),      Vec4( 1.0f,  1.0f,  1.01f,  1.5f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       texCubeArrayMipmapInt,          evalTextureCubeArrayGrad,       BOTH),
3831                 GRAD_CASE_SPEC(usamplercubearray,               FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f, -1.01f, -0.5f),      Vec4( 1.0f,  1.0f, -1.01f,  1.5f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       texCubeArrayMipmapUint,         evalTextureCubeArrayGrad,       BOTH),
3832
3833                 GRAD_CASE_SPEC(sampler2dshadow,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowGrad,                BOTH),
3834                 GRAD_CASE_SPEC(samplercubeshadow,               FUNCTION_TEXTUREGRAD,   Vec4(-1.0f, -1.0f,  1.01f,  0.0f),      Vec4( 1.0f,  1.0f,  1.01f,  1.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       texCubeMipmapShadow,    evalTextureCubeShadowGrad,              BOTH),
3835                 GRAD_CASE_SPEC(sampler2darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DArrayMipmapShadow, evalTexture2DArrayShadowGrad,   VERTEX),
3836                 GRAD_CASE_SPEC(sampler2darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      false,  IVec3(0),       tex2DArrayMipmapShadow, evalTexture2DArrayShadowGrad,   FRAGMENT),
3837                 GRAD_CASE_SPEC(sampler1dshadow,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowGrad,                BOTH),
3838                 GRAD_CASE_SPEC(sampler1darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DArrayMipmapShadow, evalTexture1DArrayShadowGrad,   VERTEX),
3839                 GRAD_CASE_SPEC(sampler1darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DArrayMipmapShadow, evalTexture1DArrayShadowGrad,   FRAGMENT),
3840         };
3841         createCaseGroup(this, "texturegrad", "textureGrad() Tests", textureGradCases, DE_LENGTH_OF_ARRAY(textureGradCases));
3842
3843         // textureGradOffset() cases
3844         static const TexFuncCaseSpec textureGradOffsetCases[] =
3845         {
3846                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                        MinDx                                           MaxDx                                           MinDy                                           MaxDy                                           Offset? Offset                          Format                                  EvalFunc                                                        Flags
3847                 GRAD_CASE_SPEC(sampler2d_fixed,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapFixed,               evalTexture2DGradOffset,                        BOTH),
3848                 GRAD_CASE_SPEC(sampler2d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DGradOffset,                        BOTH),
3849                 GRAD_CASE_SPEC(isampler2d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapInt,                 evalTexture2DGradOffset,                        BOTH),
3850                 GRAD_CASE_SPEC(usampler2d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DGradOffset,                        BOTH),
3851
3852                 GRAD_CASE_SPEC(sampler2darray_fixed,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DArrayMipmapFixed,  evalTexture2DArrayGradOffset,           BOTH),
3853                 GRAD_CASE_SPEC(sampler2darray_float,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DArrayMipmapFloat,  evalTexture2DArrayGradOffset,           BOTH),
3854                 GRAD_CASE_SPEC(isampler2darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DArrayMipmapInt,    evalTexture2DArrayGradOffset,           BOTH),
3855                 GRAD_CASE_SPEC(usampler2darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DArrayMipmapUint,   evalTexture2DArrayGradOffset,           BOTH),
3856
3857                 GRAD_CASE_SPEC(sampler3d_fixed,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 3),        tex3DMipmapFixed,               evalTexture3DGradOffset,                        BOTH),
3858                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, 3, -8),        tex3DMipmapFloat,               evalTexture3DGradOffset,                        VERTEX),
3859                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.2f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(3, -8, 7),        tex3DMipmapFloat,               evalTexture3DGradOffset,                        FRAGMENT),
3860                 GRAD_CASE_SPEC(isampler3d,                              FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 3),        tex3DMipmapInt,                 evalTexture3DGradOffset,                        BOTH),
3861                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      true,   IVec3(7, 3, -8),        tex3DMipmapUint,                evalTexture3DGradOffset,                        VERTEX),
3862                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -1.4f,  0.1f,  0.0f),       Vec4( 1.5f,  2.3f,  2.3f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f, -0.2f),      true,   IVec3(3, -8, 7),        tex3DMipmapUint,                evalTexture3DGradOffset,                        FRAGMENT),
3863
3864                 GRAD_CASE_SPEC(sampler1d_fixed,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 0, 0),        tex1DMipmapFixed,               evalTexture1DGradOffset,                        BOTH),
3865                 GRAD_CASE_SPEC(sampler1d_float,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7,  0, 0),        tex1DMipmapFloat,               evalTexture1DGradOffset,                        BOTH),
3866                 GRAD_CASE_SPEC(isampler1d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 0, 0),        tex1DMipmapInt,                 evalTexture1DGradOffset,                        BOTH),
3867                 GRAD_CASE_SPEC(usampler1d,                              FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      true,   IVec3(7,  0, 0),        tex1DMipmapUint,                evalTexture1DGradOffset,                        BOTH),
3868
3869                 GRAD_CASE_SPEC(sampler1darray_fixed,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 0, 0),        tex1DArrayMipmapFixed,  evalTexture1DArrayGradOffset,           BOTH),
3870                 GRAD_CASE_SPEC(sampler1darray_float,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7,  0, 0),        tex1DArrayMipmapFloat,  evalTexture1DArrayGradOffset,           BOTH),
3871                 GRAD_CASE_SPEC(isampler1darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 0, 0),        tex1DArrayMipmapInt,    evalTexture1DArrayGradOffset,           BOTH),
3872                 GRAD_CASE_SPEC(usampler1darray,                 FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,   0.0f,  0.0f),      Vec4( 1.5f,  3.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      true,   IVec3(7,  0, 0),        tex1DArrayMipmapUint,   evalTexture1DArrayGradOffset,           BOTH),
3873
3874                 GRAD_CASE_SPEC(sampler2dshadow,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapShadow,              evalTexture2DShadowGradOffset,          VERTEX),
3875                 GRAD_CASE_SPEC(sampler2dshadow,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f, -0.4f,  0.0f,  0.0f),       Vec4( 1.5f,  2.3f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapShadow,              evalTexture2DShadowGradOffset,          FRAGMENT),
3876                 GRAD_CASE_SPEC(sampler2darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DArrayMipmapShadow, evalTexture2DArrayShadowGradOffset,     VERTEX),
3877                 GRAD_CASE_SPEC(sampler2darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.4f,  -0.5f,  0.0f),      Vec4( 1.5f,  2.3f,  3.5f,  1.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DArrayMipmapShadow, evalTexture2DArrayShadowGradOffset,     FRAGMENT),
3878                 GRAD_CASE_SPEC(sampler1dshadow,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 0, 0),        tex1DMipmapShadow,              evalTexture1DShadowGradOffset,          VERTEX),
3879                 GRAD_CASE_SPEC(sampler1dshadow,                 FUNCTION_TEXTUREGRAD,   Vec4(-0.2f,  0.0f,  0.0f,  0.0f),       Vec4( 1.5f,  0.0f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7,  0, 0),        tex1DMipmapShadow,              evalTexture1DShadowGradOffset,          FRAGMENT),
3880                 GRAD_CASE_SPEC(sampler1darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 0, 0),        tex1DArrayMipmapShadow, evalTexture1DArrayShadowGradOffset,     VERTEX),
3881                 GRAD_CASE_SPEC(sampler1darrayshadow,    FUNCTION_TEXTUREGRAD,   Vec4(-1.2f, -0.5f,  0.0f,  0.0f),       Vec4( 1.5f,  3.5f,  1.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(7,  0, 0),        tex1DArrayMipmapShadow, evalTexture1DArrayShadowGradOffset,     FRAGMENT),
3882         };
3883         createCaseGroup(this, "texturegradoffset", "textureGradOffset() Tests", textureGradOffsetCases, DE_LENGTH_OF_ARRAY(textureGradOffsetCases));
3884
3885         // textureProjGrad() cases
3886         static const TexFuncCaseSpec textureProjGradCases[] =
3887         {
3888                 //                Name                                                  Function                                        MinCoord                                                        MaxCoord                                                        MinDx                                           MaxDx                                           MinDy                                           MaxDy                                           Offset? Offset          Format                                  EvalFunc                                        Flags
3889                 GRAD_CASE_SPEC(sampler2d_vec3_fixed,    FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProjGrad3,         BOTH),
3890                 GRAD_CASE_SPEC(sampler2d_vec3_float,    FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProjGrad3,         BOTH),
3891                 GRAD_CASE_SPEC(isampler2d_vec3,                 FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProjGrad3,         BOTH),
3892                 GRAD_CASE_SPEC(usampler2d_vec3,                 FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProjGrad3,         BOTH),
3893
3894                 GRAD_CASE_SPEC(sampler2d_vec4_fixed,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapFixed,               evalTexture2DProjGrad,          BOTH),
3895                 GRAD_CASE_SPEC(sampler2d_vec4_float,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapFloat,               evalTexture2DProjGrad,          BOTH),
3896                 GRAD_CASE_SPEC(isampler2d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapInt,                 evalTexture2DProjGrad,          BOTH),
3897                 GRAD_CASE_SPEC(usampler2d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       tex2DMipmapUint,                evalTexture2DProjGrad,          BOTH),
3898
3899                 GRAD_CASE_SPEC(sampler3d_fixed,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapFixed,               evalTexture3DProjGrad,          BOTH),
3900                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DProjGrad,          VERTEX),
3901                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.2f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapFloat,               evalTexture3DProjGrad,          FRAGMENT),
3902                 GRAD_CASE_SPEC(isampler3d,                              FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex3DMipmapInt,                 evalTexture3DProjGrad,          BOTH),
3903                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DProjGrad,          VERTEX),
3904                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f, -0.2f),      false,  IVec3(0),       tex3DMipmapUint,                evalTexture3DProjGrad,          FRAGMENT),
3905
3906                 GRAD_CASE_SPEC(sampler1d_vec2_fixed,    FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProjGrad2,         BOTH),
3907                 GRAD_CASE_SPEC(sampler1d_vec2_float,    FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProjGrad2,         BOTH),
3908                 GRAD_CASE_SPEC(isampler1d_vec2,                 FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProjGrad2,         BOTH),
3909                 GRAD_CASE_SPEC(usampler1d_vec2,                 FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProjGrad2,         BOTH),
3910
3911                 GRAD_CASE_SPEC(sampler1d_vec4_fixed,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapFixed,               evalTexture1DProjGrad,          BOTH),
3912                 GRAD_CASE_SPEC(sampler1d_vec4_float,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapFloat,               evalTexture1DProjGrad,          BOTH),
3913                 GRAD_CASE_SPEC(isampler1d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapInt,                 evalTexture1DProjGrad,          BOTH),
3914                 GRAD_CASE_SPEC(usampler1d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapUint,                evalTexture1DProjGrad,          BOTH),
3915
3916                 GRAD_CASE_SPEC(sampler2dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.6f,  0.0f,  -1.5f),       Vec4(-2.25f, -3.45f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowProjGrad,    VERTEX),
3917                 GRAD_CASE_SPEC(sampler2dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.6f,  0.0f,  -1.5f),       Vec4(-2.25f, -3.45f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      false,  IVec3(0),       tex2DMipmapShadow,              evalTexture2DShadowProjGrad,    FRAGMENT),
3918                 GRAD_CASE_SPEC(sampler1dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.0f,  0.0f,  -1.5f),       Vec4(-2.25f,   0.0f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowProjGrad,    VERTEX),
3919                 GRAD_CASE_SPEC(sampler1dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.0f,  0.0f,  -1.5f),       Vec4(-2.25f,   0.0f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      false,  IVec3(0),       tex1DMipmapShadow,              evalTexture1DShadowProjGrad,    FRAGMENT),
3920         };
3921         createCaseGroup(this, "textureprojgrad", "textureProjGrad() Tests", textureProjGradCases, DE_LENGTH_OF_ARRAY(textureProjGradCases));
3922
3923         // textureProjGradOffset() cases
3924         static const TexFuncCaseSpec textureProjGradOffsetCases[] =
3925         {
3926                 //                Name                                                  Function                                        MinCoord                                                        MaxCoord                                                        MinDx                                           MaxDx                                           MinDy                                           MaxDy                                           Offset? Offset                          Format                                  EvalFunc                                                        Flags
3927                 GRAD_CASE_SPEC(sampler2d_vec3_fixed,    FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapFixed,               evalTexture2DProjGrad3Offset,           BOTH),
3928                 GRAD_CASE_SPEC(sampler2d_vec3_float,    FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DProjGrad3Offset,           BOTH),
3929                 GRAD_CASE_SPEC(isampler2d_vec3,                 FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapInt,                 evalTexture2DProjGrad3Offset,           BOTH),
3930                 GRAD_CASE_SPEC(usampler2d_vec3,                 FUNCTION_TEXTUREPROJGRAD3,      Vec4(-0.3f, -0.6f,  1.5f,  0.0f),       Vec4(2.25f, 3.45f,  1.5f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DProjGrad3Offset,           BOTH),
3931
3932                 GRAD_CASE_SPEC(sampler2d_vec4_fixed,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapFixed,               evalTexture2DProjGradOffset,            BOTH),
3933                 GRAD_CASE_SPEC(sampler2d_vec4_float,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapFloat,               evalTexture2DProjGradOffset,            BOTH),
3934                 GRAD_CASE_SPEC(isampler2d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapInt,                 evalTexture2DProjGradOffset,            BOTH),
3935                 GRAD_CASE_SPEC(usampler2d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f, -0.6f,  0.0f,  1.5f),       Vec4(2.25f, 3.45f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapUint,                evalTexture2DProjGradOffset,            BOTH),
3936
3937                 GRAD_CASE_SPEC(sampler3d_fixed,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 3),        tex3DMipmapFixed,               evalTexture3DProjGradOffset,            BOTH),
3938                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, 3, -8),        tex3DMipmapFloat,               evalTexture3DProjGradOffset,            VERTEX),
3939                 GRAD_CASE_SPEC(sampler3d_float,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.2f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(3, -8, 7),        tex3DMipmapFloat,               evalTexture3DProjGradOffset,            FRAGMENT),
3940                 GRAD_CASE_SPEC(isampler3d,                              FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 3),        tex3DMipmapInt,                 evalTexture3DProjGradOffset,            BOTH),
3941                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.2f,  0.0f),      true,   IVec3(7, 3, -8),        tex3DMipmapUint,                evalTexture3DProjGradOffset,            VERTEX),
3942                 GRAD_CASE_SPEC(usampler3d,                              FUNCTION_TEXTUREPROJGRAD,       Vec4(0.9f, 1.05f, -0.08f, -0.75f),      Vec4(-1.13f, -1.7f, -1.7f, -0.75f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f, -0.2f),      true,   IVec3(3, -8, 7),        tex3DMipmapUint,                evalTexture3DProjGradOffset,            FRAGMENT),
3943
3944                 GRAD_CASE_SPEC(sampler1d_vec2_fixed,    FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex1DMipmapFixed,               evalTexture1DProjGrad2Offset,           BOTH),
3945                 GRAD_CASE_SPEC(sampler1d_vec2_float,    FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex1DMipmapFloat,               evalTexture1DProjGrad2Offset,           BOTH),
3946                 GRAD_CASE_SPEC(isampler1d_vec2,                 FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex1DMipmapInt,                 evalTexture1DProjGrad2Offset,           BOTH),
3947                 GRAD_CASE_SPEC(usampler1d_vec2,                 FUNCTION_TEXTUREPROJGRAD2,      Vec4(-0.3f,  1.5f,  0.0f,  0.0f),       Vec4(2.25f,  1.5f,  0.0f,  0.0f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex1DMipmapUint,                evalTexture1DProjGrad2Offset,           BOTH),
3948
3949                 GRAD_CASE_SPEC(sampler1d_vec4_fixed,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex1DMipmapFixed,               evalTexture1DProjGradOffset,            BOTH),
3950                 GRAD_CASE_SPEC(sampler1d_vec4_float,    FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex1DMipmapFloat,               evalTexture1DProjGradOffset,            BOTH),
3951                 GRAD_CASE_SPEC(isampler1d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex1DMipmapInt,                 evalTexture1DProjGradOffset,            BOTH),
3952                 GRAD_CASE_SPEC(usampler1d_vec4,                 FUNCTION_TEXTUREPROJGRAD,       Vec4(-0.3f,  0.0f,  0.0f,  1.5f),       Vec4(2.25f,  0.0f,  0.0f,  1.5f),       Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex1DMipmapUint,                evalTexture1DProjGradOffset,            BOTH),
3953
3954                 GRAD_CASE_SPEC(sampler2dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.6f,  0.0f,  -1.5f),       Vec4(-2.25f, -3.45f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex2DMipmapShadow,              evalTexture2DShadowProjGradOffset,      VERTEX),
3955                 GRAD_CASE_SPEC(sampler2dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.6f,  0.0f,  -1.5f),       Vec4(-2.25f, -3.45f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f, -0.2f,  0.0f),      true,   IVec3(7, -8, 0),        tex2DMipmapShadow,              evalTexture2DShadowProjGradOffset,      FRAGMENT),
3956                 GRAD_CASE_SPEC(sampler1dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.0f,  0.0f,  -1.5f),       Vec4(-2.25f,   0.0f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.2f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      true,   IVec3(-8, 7, 0),        tex1DMipmapShadow,              evalTexture1DShadowProjGradOffset,      VERTEX),
3957                 GRAD_CASE_SPEC(sampler1dshadow,                 FUNCTION_TEXTUREPROJGRAD,       Vec4( 0.2f, 0.0f,  0.0f,  -1.5f),       Vec4(-2.25f,   0.0f, -1.5f, -1.5f),     Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3( 0.0f,  0.0f,  0.0f),      Vec3(-0.2f,  0.0f,  0.0f),      true,   IVec3(7, -8, 0),        tex1DMipmapShadow,              evalTexture1DShadowProjGradOffset,      FRAGMENT),
3958         };
3959         createCaseGroup(this, "textureprojgradoffset", "textureProjGradOffset() Tests", textureProjGradOffsetCases, DE_LENGTH_OF_ARRAY(textureProjGradOffsetCases));
3960
3961         // texelFetch() cases
3962         // \note Level is constant across quad
3963         static const TexFuncCaseSpec texelFetchCases[] =
3964         {
3965                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                Bias?   MinLod  MaxLod  Offset? Offset          Format                                          EvalFunc                                Flags
3966                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(255.9f, 255.9f,  0.0f,  0.0f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DTexelFetchFixed,           evalTexelFetch2D,               BOTH),
3967                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(127.9f, 127.9f,  0.0f,  0.0f),     false,  1.0f,   1.0f,   false,  IVec3(0),       tex2DTexelFetchFloat,           evalTexelFetch2D,               BOTH),
3968                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 63.9f,  63.9f,  0.0f,  0.0f),     false,  2.0f,   2.0f,   false,  IVec3(0),       tex2DTexelFetchInt,                     evalTexelFetch2D,               BOTH),
3969                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 15.9f,  15.9f,  0.0f,  0.0f),     false,  4.0f,   4.0f,   false,  IVec3(0),       tex2DTexelFetchUint,            evalTexelFetch2D,               BOTH),
3970
3971                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(127.9f, 127.9f,  3.9f,  0.0f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex2DArrayTexelFetchFixed,      evalTexelFetch2DArray,  BOTH),
3972                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 63.9f,  63.9f,  3.9f,  0.0f),     false,  1.0f,   1.0f,   false,  IVec3(0),       tex2DArrayTexelFetchFloat,      evalTexelFetch2DArray,  BOTH),
3973                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 31.9f,  31.9f,  3.9f,  0.0f),     false,  2.0f,   2.0f,   false,  IVec3(0),       tex2DArrayTexelFetchInt,        evalTexelFetch2DArray,  BOTH),
3974                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 15.9f,  15.9f,  3.9f,  0.0f),     false,  3.0f,   3.0f,   false,  IVec3(0),       tex2DArrayTexelFetchUint,       evalTexelFetch2DArray,  BOTH),
3975
3976                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(63.9f,  31.9f,  31.9f,  0.0f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DTexelFetchFixed,           evalTexelFetch3D,               BOTH),
3977                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(31.9f,  15.9f,  15.9f,  0.0f),     false,  1.0f,   1.0f,   false,  IVec3(0),       tex3DTexelFetchFloat,           evalTexelFetch3D,               BOTH),
3978                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(15.9f,   7.9f,   7.9f,  0.0f),     false,  2.0f,   2.0f,   false,  IVec3(0),       tex3DTexelFetchInt,                     evalTexelFetch3D,               BOTH),
3979                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(63.9f,  31.9f,  31.9f,  0.0f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex3DTexelFetchUint,            evalTexelFetch3D,               BOTH),
3980
3981                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(255.9f,   0.0f,  0.0f,  0.0f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DTexelFetchFixed,           evalTexelFetch1D,               BOTH),
3982                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(127.9f,   0.0f,  0.0f,  0.0f),     false,  1.0f,   1.0f,   false,  IVec3(0),       tex1DTexelFetchFloat,           evalTexelFetch1D,               BOTH),
3983                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 63.9f,   0.0f,  0.0f,  0.0f),     false,  2.0f,   2.0f,   false,  IVec3(0),       tex1DTexelFetchInt,                     evalTexelFetch1D,               BOTH),
3984                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 15.9f,   0.0f,  0.0f,  0.0f),     false,  4.0f,   4.0f,   false,  IVec3(0),       tex1DTexelFetchUint,            evalTexelFetch1D,               BOTH),
3985
3986                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(255.9f,   3.9f,  0.0f,  0.0f),     false,  0.0f,   0.0f,   false,  IVec3(0),       tex1DArrayTexelFetchFixed,      evalTexelFetch1DArray,  BOTH),
3987                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4(127.9f,   3.9f,  0.0f,  0.0f),     false,  1.0f,   1.0f,   false,  IVec3(0),       tex1DArrayTexelFetchFloat,      evalTexelFetch1DArray,  BOTH),
3988                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 63.9f,   3.9f,  0.0f,  0.0f),     false,  2.0f,   2.0f,   false,  IVec3(0),       tex1DArrayTexelFetchInt,        evalTexelFetch1DArray,  BOTH),
3989                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXELFETCH,    Vec4(0.0f, 0.0f, 0.0f, 0.0f),   Vec4( 15.9f,   3.9f,  0.0f,  0.0f),     false,  4.0f,   4.0f,   false,  IVec3(0),       tex1DArrayTexelFetchUint,       evalTexelFetch1DArray,  BOTH),
3990         };
3991         createCaseGroup(this, "texelfetch", "texelFetch() Tests", texelFetchCases, DE_LENGTH_OF_ARRAY(texelFetchCases));
3992
3993         // texelFetchOffset() cases
3994         static const TexFuncCaseSpec texelFetchOffsetCases[] =
3995         {
3996                 //                Name                                                  Function                                MinCoord                                                        MaxCoord                                                Bias?   MinLod  MaxLod  Offset? Offset          Format                                          EvalFunc                                Flags
3997                 CASE_SPEC(sampler2d_fixed,                              FUNCTION_TEXELFETCH,    Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4(263.9f, 248.9f,  0.0f,  0.0f),     false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DTexelFetchFixed,           evalTexelFetch2D,               BOTH),
3998                 CASE_SPEC(sampler2d_float,                              FUNCTION_TEXELFETCH,    Vec4(-7.0f,  8.0f, 0.0f, 0.0f), Vec4(120.9f, 135.9f,  0.0f,  0.0f),     false,  1.0f,   1.0f,   true,   IVec3(7, -8, 0),        tex2DTexelFetchFloat,           evalTexelFetch2D,               BOTH),
3999                 CASE_SPEC(isampler2d,                                   FUNCTION_TEXELFETCH,    Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4( 71.9f,  56.9f,  0.0f,  0.0f),     false,  2.0f,   2.0f,   true,   IVec3(-8, 7, 0),        tex2DTexelFetchInt,                     evalTexelFetch2D,               BOTH),
4000                 CASE_SPEC(usampler2d,                                   FUNCTION_TEXELFETCH,    Vec4(-7.0f,  8.0f, 0.0f, 0.0f), Vec4(  8.9f,  23.9f,  0.0f,  0.0f),     false,  4.0f,   4.0f,   true,   IVec3(7, -8, 0),        tex2DTexelFetchUint,            evalTexelFetch2D,               BOTH),
4001
4002                 CASE_SPEC(sampler2darray_fixed,                 FUNCTION_TEXELFETCH,    Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4(135.9f, 120.9f,  3.9f,  0.0f),     false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayTexelFetchFixed,      evalTexelFetch2DArray,  BOTH),
4003                 CASE_SPEC(sampler2darray_float,                 FUNCTION_TEXELFETCH,    Vec4(-7.0f,  8.0f, 0.0f, 0.0f), Vec4( 56.9f,  71.9f,  3.9f,  0.0f),     false,  1.0f,   1.0f,   true,   IVec3(7, -8, 0),        tex2DArrayTexelFetchFloat,      evalTexelFetch2DArray,  BOTH),
4004                 CASE_SPEC(isampler2darray,                              FUNCTION_TEXELFETCH,    Vec4( 8.0f, -7.0f, 0.0f, 0.0f), Vec4( 39.9f,  24.9f,  3.9f,  0.0f),     false,  2.0f,   2.0f,   true,   IVec3(-8, 7, 0),        tex2DArrayTexelFetchInt,        evalTexelFetch2DArray,  BOTH),
4005                 CASE_SPEC(usampler2darray,                              FUNCTION_TEXELFETCH,    Vec4(-7.0f,  8.0f, 0.0f, 0.0f), Vec4(  8.9f,  23.9f,  3.9f,  0.0f),     false,  3.0f,   3.0f,   true,   IVec3(7, -8, 0),        tex2DArrayTexelFetchUint,       evalTexelFetch2DArray,  BOTH),
4006
4007                 CASE_SPEC(sampler3d_fixed,                              FUNCTION_TEXELFETCH,    Vec4( 8.0f, -7.0f, -3.0f, 0.0f),Vec4(71.9f,  24.9f,  28.9f,  0.0f),     false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DTexelFetchFixed,           evalTexelFetch3D,               BOTH),
4008                 CASE_SPEC(sampler3d_float,                              FUNCTION_TEXELFETCH,    Vec4(-7.0f, -3.0f,  8.0f, 0.0f),Vec4(24.9f,  12.9f,  23.9f,  0.0f),     false,  1.0f,   1.0f,   true,   IVec3(7, 3, -8),        tex3DTexelFetchFloat,           evalTexelFetch3D,               BOTH),
4009                 CASE_SPEC(isampler3d,                                   FUNCTION_TEXELFETCH,    Vec4(-3.0f,  8.0f, -7.0f, 0.0f),Vec4(12.9f,  15.9f,   0.9f,  0.0f),     false,  2.0f,   2.0f,   true,   IVec3(3, -8, 7),        tex3DTexelFetchInt,                     evalTexelFetch3D,               BOTH),
4010                 CASE_SPEC(usampler3d,                                   FUNCTION_TEXELFETCH,    Vec4( 8.0f, -7.0f, -3.0f, 0.0f),Vec4(71.9f,  24.9f,  28.9f,  0.0f),     false,  0.0f,   0.0f,   true,   IVec3(-8, 7, 3),        tex3DTexelFetchUint,            evalTexelFetch3D,               BOTH),
4011
4012                 CASE_SPEC(sampler1d_fixed,                              FUNCTION_TEXELFETCH,    Vec4( 8.0f,  0.0f, 0.0f, 0.0f), Vec4(263.9f,   0.0f,  0.0f,  0.0f),     false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DTexelFetchFixed,           evalTexelFetch1D,               BOTH),
4013                 CASE_SPEC(sampler1d_float,                              FUNCTION_TEXELFETCH,    Vec4(-7.0f,  0.0f, 0.0f, 0.0f), Vec4(120.9f,   0.0f,  0.0f,  0.0f),     false,  1.0f,   1.0f,   true,   IVec3(7,  0, 0),        tex1DTexelFetchFloat,           evalTexelFetch1D,               BOTH),
4014                 CASE_SPEC(isampler1d,                                   FUNCTION_TEXELFETCH,    Vec4( 8.0f,  0.0f, 0.0f, 0.0f), Vec4( 71.9f,   0.0f,  0.0f,  0.0f),     false,  2.0f,   2.0f,   true,   IVec3(-8, 0, 0),        tex1DTexelFetchInt,                     evalTexelFetch1D,               BOTH),
4015                 CASE_SPEC(usampler1d,                                   FUNCTION_TEXELFETCH,    Vec4(-7.0f,  0.0f, 0.0f, 0.0f), Vec4(  8.9f,   0.0f,  0.0f,  0.0f),     false,  4.0f,   4.0f,   true,   IVec3(7,  0, 0),        tex1DTexelFetchUint,            evalTexelFetch1D,               BOTH),
4016
4017                 CASE_SPEC(sampler1darray_fixed,                 FUNCTION_TEXELFETCH,    Vec4( 8.0f,  0.0f, 0.0f, 0.0f), Vec4(135.9f,   3.9f,  0.0f,  0.0f),     false,  0.0f,   0.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayTexelFetchFixed,      evalTexelFetch1DArray,  BOTH),
4018                 CASE_SPEC(sampler1darray_float,                 FUNCTION_TEXELFETCH,    Vec4(-7.0f,  0.0f, 0.0f, 0.0f), Vec4( 56.9f,   3.9f,  0.0f,  0.0f),     false,  1.0f,   1.0f,   true,   IVec3(7,  0, 0),        tex1DArrayTexelFetchFloat,      evalTexelFetch1DArray,  BOTH),
4019                 CASE_SPEC(isampler1darray,                              FUNCTION_TEXELFETCH,    Vec4( 8.0f,  0.0f, 0.0f, 0.0f), Vec4( 39.9f,   3.9f,  0.0f,  0.0f),     false,  2.0f,   2.0f,   true,   IVec3(-8, 0, 0),        tex1DArrayTexelFetchInt,        evalTexelFetch1DArray,  BOTH),
4020                 CASE_SPEC(usampler1darray,                              FUNCTION_TEXELFETCH,    Vec4(-7.0f,  0.0f, 0.0f, 0.0f), Vec4(  8.9f,   3.9f,  0.0f,  0.0f),     false,  3.0f,   3.0f,   true,   IVec3(7,  0, 0),        tex1DArrayTexelFetchUint,       evalTexelFetch1DArray,  BOTH),
4021         };
4022         createCaseGroup(this, "texelfetchoffset", "texelFetchOffset() Tests", texelFetchOffsetCases, DE_LENGTH_OF_ARRAY(texelFetchOffsetCases));
4023
4024         // texture query functions
4025         {
4026                 struct TexQueryFuncCaseSpec
4027                 {
4028                         const char*             name;
4029                         const char*             samplerName;
4030                         TextureSpec             textureSpec;
4031                 };
4032
4033                 de::MovePtr<tcu::TestCaseGroup>                 queryGroup      (new tcu::TestCaseGroup(m_testCtx, "query", "Texture query function tests"));
4034
4035                 // textureSize() cases
4036                 {
4037                         const TexQueryFuncCaseSpec textureSizeCases[] =
4038                         {
4039                                 { "sampler2d_fixed",                    "sampler2D",                            tex2DFixed                      },
4040                                 { "sampler2d_float",                    "sampler2D",                            tex2DFloat                      },
4041                                 { "isampler2d",                                 "isampler2D",                           tex2DInt                        },
4042                                 { "usampler2d",                                 "usampler2D",                           tex2DUint                       },
4043                                 { "sampler2dshadow",                    "sampler2DShadow",                      tex2DShadow                     },
4044                                 { "sampler3d_fixed",                    "sampler3D",                            tex3DFixed                      },
4045                                 { "sampler3d_float",                    "sampler3D",                            tex3DFloat                      },
4046                                 { "isampler3d",                                 "isampler3D",                           tex3DInt                        },
4047                                 { "usampler3d",                                 "usampler3D",                           tex3DUint                       },
4048                                 { "samplercube_fixed",                  "samplerCube",                          texCubeFixed            },
4049                                 { "samplercube_float",                  "samplerCube",                          texCubeFloat            },
4050                                 { "isamplercube",                               "isamplerCube",                         texCubeInt                      },
4051                                 { "usamplercube",                               "usamplerCube",                         texCubeUint                     },
4052                                 { "samplercubeshadow",                  "samplerCubeShadow",            texCubeShadow           },
4053                                 { "sampler2darray_fixed",               "sampler2DArray",                       tex2DArrayFixed         },
4054                                 { "sampler2darray_float",               "sampler2DArray",                       tex2DArrayFloat         },
4055                                 { "isampler2darray",                    "isampler2DArray",                      tex2DArrayInt           },
4056                                 { "usampler2darray",                    "usampler2DArray",                      tex2DArrayUint          },
4057                                 { "sampler2darrayshadow",               "sampler2DArrayShadow",         tex2DArrayShadow        },
4058                                 { "samplercubearray_fixed",             "samplerCubeArray",                     texCubeArrayFixed       },
4059                                 { "samplercubearray_float",             "samplerCubeArray",                     texCubeArrayFloat       },
4060                                 { "isamplercubearray",                  "isamplerCubeArray",            texCubeArrayInt         },
4061                                 { "usamplercubearray",                  "usamplerCubeArray",            texCubeArrayUint        },
4062                                 { "samplercubearrayshadow",             "samplerCubeArrayShadow",       texCubeArrayShadow      },
4063                                 { "sampler1d_fixed",                    "sampler1D",                            tex1DFixed                      },
4064                                 { "sampler1d_float",                    "sampler1D",                            tex1DFloat                      },
4065                                 { "isampler1d",                                 "isampler1D",                           tex1DInt                        },
4066                                 { "usampler1d",                                 "usampler1D",                           tex1DUint                       },
4067                                 { "sampler1dshadow",                    "sampler1DShadow",                      tex1DShadow                     },
4068                                 { "sampler1darray_fixed",               "sampler1DArray",                       tex1DArrayFixed         },
4069                                 { "sampler1darray_float",               "sampler1DArray",                       tex1DArrayFloat         },
4070                                 { "isampler1darray",                    "isampler1DArray",                      tex1DArrayInt           },
4071                                 { "usampler1darray",                    "usampler1DArray",                      tex1DArrayUint          },
4072                                 { "sampler1darrayshadow",               "sampler1DArrayShadow",         tex1DArrayShadow        },
4073                         };
4074
4075                         de::MovePtr<tcu::TestCaseGroup>         group           (new tcu::TestCaseGroup(m_testCtx, "texturesize", "textureSize() Tests"));
4076
4077                         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(textureSizeCases); ++ndx)
4078                         {
4079                                 const TexQueryFuncCaseSpec&             caseSpec        = textureSizeCases[ndx];
4080
4081                                 group->addChild(new TextureQueryCase(m_testCtx, (std::string(caseSpec.name) + "_vertex"),   "", caseSpec.samplerName, caseSpec.textureSpec, true,  QUERYFUNCTION_TEXTURESIZE));
4082                                 group->addChild(new TextureQueryCase(m_testCtx, (std::string(caseSpec.name) + "_fragment"), "", caseSpec.samplerName, caseSpec.textureSpec, false, QUERYFUNCTION_TEXTURESIZE));
4083                         }
4084
4085                         queryGroup->addChild(group.release());
4086                 }
4087
4088                 // textureSamples() cases
4089                 {
4090                         const TexQueryFuncCaseSpec textureSamplesCases[] =
4091                         {
4092                                 { "sampler2dms_fixed",                  "sampler2DMS",                          tex2DFixed                      },
4093                                 { "sampler2dms_float",                  "sampler2DMS",                          tex2DFloat                      },
4094                                 { "isampler2dms",                               "isampler2DMS",                         tex2DInt                        },
4095                                 { "usampler2dms",                               "usampler2DMS",                         tex2DUint                       },
4096                                 { "sampler2dmsarray_fixed",             "sampler2DMSArray",                     tex2DArrayFixed         },
4097                                 { "sampler2dmsarray_float",             "sampler2DMSArray",                     tex2DArrayFloat         },
4098                                 { "isampler2dmsarray",                  "isampler2DMSArray",            tex2DArrayInt           },
4099                                 { "usampler2dmsarray",                  "usampler2DMSArray",            tex2DArrayUint          },
4100                         };
4101
4102                         de::MovePtr<tcu::TestCaseGroup>         group           (new tcu::TestCaseGroup(m_testCtx, "texturesamples", "textureSamples() Tests"));
4103
4104                         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(textureSamplesCases); ++ndx)
4105                         {
4106                                 const TexQueryFuncCaseSpec&             caseSpec        = textureSamplesCases[ndx];
4107
4108                                 group->addChild(new TextureQueryCase(m_testCtx, (std::string(caseSpec.name) + "_vertex"),   "", caseSpec.samplerName, caseSpec.textureSpec, true,  QUERYFUNCTION_TEXTURESAMPLES));
4109                                 group->addChild(new TextureQueryCase(m_testCtx, (std::string(caseSpec.name) + "_fragment"), "", caseSpec.samplerName, caseSpec.textureSpec, false, QUERYFUNCTION_TEXTURESAMPLES));
4110                         }
4111
4112                         queryGroup->addChild(group.release());
4113                 }
4114
4115                 // textureQueryLevels() cases
4116                 {
4117                         const TexQueryFuncCaseSpec textureQueryLevelsCases[] =
4118                         {
4119                                 { "sampler2d_fixed",                    "sampler2D",                            tex2DFixed                      },
4120                                 { "sampler2d_float",                    "sampler2D",                            tex2DFloat                      },
4121                                 { "isampler2d",                                 "isampler2D",                           tex2DInt                        },
4122                                 { "usampler2d",                                 "usampler2D",                           tex2DUint                       },
4123                                 { "sampler2dshadow",                    "sampler2DShadow",                      tex2DShadow                     },
4124                                 { "sampler3d_fixed",                    "sampler3D",                            tex3DFixed                      },
4125                                 { "sampler3d_float",                    "sampler3D",                            tex3DFloat                      },
4126                                 { "isampler3d",                                 "isampler3D",                           tex3DInt                        },
4127                                 { "usampler3d",                                 "usampler3D",                           tex3DUint                       },
4128                                 { "samplercube_fixed",                  "samplerCube",                          texCubeFixed            },
4129                                 { "samplercube_float",                  "samplerCube",                          texCubeFloat            },
4130                                 { "isamplercube",                               "isamplerCube",                         texCubeInt                      },
4131                                 { "usamplercube",                               "usamplerCube",                         texCubeUint                     },
4132                                 { "samplercubeshadow",                  "samplerCubeShadow",            texCubeShadow           },
4133                                 { "sampler2darray_fixed",               "sampler2DArray",                       tex2DArrayFixed         },
4134                                 { "sampler2darray_float",               "sampler2DArray",                       tex2DArrayFloat         },
4135                                 { "isampler2darray",                    "isampler2DArray",                      tex2DArrayInt           },
4136                                 { "usampler2darray",                    "usampler2DArray",                      tex2DArrayUint          },
4137                                 { "sampler2darrayshadow",               "sampler2DArrayShadow",         tex2DArrayShadow        },
4138                                 { "samplercubearray_fixed",             "samplerCubeArray",                     texCubeArrayFixed       },
4139                                 { "samplercubearray_float",             "samplerCubeArray",                     texCubeArrayFloat       },
4140                                 { "isamplercubearray",                  "isamplerCubeArray",            texCubeArrayInt         },
4141                                 { "usamplercubearray",                  "usamplerCubeArray",            texCubeArrayUint        },
4142                                 { "samplercubearrayshadow",             "samplerCubeArrayShadow",       texCubeArrayShadow      },
4143                                 { "sampler1d_fixed",                    "sampler1D",                            tex1DFixed                      },
4144                                 { "sampler1d_float",                    "sampler1D",                            tex1DFloat                      },
4145                                 { "isampler1d",                                 "isampler1D",                           tex1DInt                        },
4146                                 { "usampler1d",                                 "usampler1D",                           tex1DUint                       },
4147                                 { "sampler1dshadow",                    "sampler1DShadow",                      tex1DShadow                     },
4148                                 { "sampler1darray_fixed",               "sampler1DArray",                       tex1DArrayFixed         },
4149                                 { "sampler1darray_float",               "sampler1DArray",                       tex1DArrayFloat         },
4150                                 { "isampler1darray",                    "isampler1DArray",                      tex1DArrayInt           },
4151                                 { "usampler1darray",                    "usampler1DArray",                      tex1DArrayUint          },
4152                                 { "sampler1darrayshadow",               "sampler1DArrayShadow",         tex1DArrayShadow        },
4153                         };
4154
4155                         de::MovePtr<tcu::TestCaseGroup>         group           (new tcu::TestCaseGroup(m_testCtx, "texturequerylevels", "textureQueryLevels() Tests"));
4156
4157                         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(textureQueryLevelsCases); ++ndx)
4158                         {
4159                                 const TexQueryFuncCaseSpec&             caseSpec        = textureQueryLevelsCases[ndx];
4160
4161                                 group->addChild(new TextureQueryCase(m_testCtx, (std::string(caseSpec.name) + "_vertex"),   "", caseSpec.samplerName, caseSpec.textureSpec, true,  QUERYFUNCTION_TEXTUREQUERYLEVELS));
4162                                 group->addChild(new TextureQueryCase(m_testCtx, (std::string(caseSpec.name) + "_fragment"), "", caseSpec.samplerName, caseSpec.textureSpec, false, QUERYFUNCTION_TEXTUREQUERYLEVELS));
4163                         }
4164
4165                         queryGroup->addChild(group.release());
4166                 }
4167
4168                 // textureQueryLod() cases
4169                 {
4170                         const TexQueryFuncCaseSpec textureQueryLodCases[] =
4171                         {
4172                                 { "sampler2d_fixed",                    "sampler2D",                            tex2DMipmapFixed                        },
4173                                 { "sampler2d_float",                    "sampler2D",                            tex2DMipmapFloat                        },
4174                                 { "isampler2d",                                 "isampler2D",                           tex2DMipmapInt                          },
4175                                 { "usampler2d",                                 "usampler2D",                           tex2DMipmapUint                         },
4176                                 { "sampler2dshadow",                    "sampler2DShadow",                      tex2DMipmapShadow                       },
4177                                 { "sampler3d_fixed",                    "sampler3D",                            tex3DMipmapFixed                        },
4178                                 { "sampler3d_float",                    "sampler3D",                            tex3DMipmapFloat                        },
4179                                 { "isampler3d",                                 "isampler3D",                           tex3DMipmapInt                          },
4180                                 { "usampler3d",                                 "usampler3D",                           tex3DMipmapUint                         },
4181                                 { "samplercube_fixed",                  "samplerCube",                          texCubeMipmapFixed                      },
4182                                 { "samplercube_float",                  "samplerCube",                          texCubeMipmapFloat                      },
4183                                 { "isamplercube",                               "isamplerCube",                         texCubeMipmapInt                        },
4184                                 { "usamplercube",                               "usamplerCube",                         texCubeMipmapUint                       },
4185                                 { "samplercubeshadow",                  "samplerCubeShadow",            texCubeMipmapShadow                     },
4186                                 { "sampler2darray_fixed",               "sampler2DArray",                       tex2DArrayMipmapFixed           },
4187                                 { "sampler2darray_float",               "sampler2DArray",                       tex2DArrayMipmapFloat           },
4188                                 { "isampler2darray",                    "isampler2DArray",                      tex2DArrayMipmapInt                     },
4189                                 { "usampler2darray",                    "usampler2DArray",                      tex2DArrayMipmapUint            },
4190                                 { "sampler2darrayshadow",               "sampler2DArrayShadow",         tex2DArrayMipmapShadow          },
4191                                 { "samplercubearray_fixed",             "samplerCubeArray",                     texCubeArrayMipmapFixed         },
4192                                 { "samplercubearray_float",             "samplerCubeArray",                     texCubeArrayMipmapFloat         },
4193                                 { "isamplercubearray",                  "isamplerCubeArray",            texCubeArrayMipmapInt           },
4194                                 { "usamplercubearray",                  "usamplerCubeArray",            texCubeArrayMipmapUint          },
4195                                 { "samplercubearrayshadow",             "samplerCubeArrayShadow",       texCubeArrayMipmapShadow        },
4196                                 { "sampler1d_fixed",                    "sampler1D",                            tex1DMipmapFixed                        },
4197                                 { "sampler1d_float",                    "sampler1D",                            tex1DMipmapFloat                        },
4198                                 { "isampler1d",                                 "isampler1D",                           tex1DMipmapInt                          },
4199                                 { "usampler1d",                                 "usampler1D",                           tex1DMipmapUint                         },
4200                                 { "sampler1dshadow",                    "sampler1DShadow",                      tex1DMipmapShadow                       },
4201                                 { "sampler1darray_fixed",               "sampler1DArray",                       tex1DArrayMipmapFixed           },
4202                                 { "sampler1darray_float",               "sampler1DArray",                       tex1DArrayMipmapFloat           },
4203                                 { "isampler1darray",                    "isampler1DArray",                      tex1DArrayMipmapInt                     },
4204                                 { "usampler1darray",                    "usampler1DArray",                      tex1DArrayMipmapUint            },
4205                                 { "sampler1darrayshadow",               "sampler1DArrayShadow",         tex1DArrayMipmapShadow          },
4206                         };
4207
4208                         de::MovePtr<tcu::TestCaseGroup>         group           (new tcu::TestCaseGroup(m_testCtx, "texturequerylod", "textureQueryLod() Tests"));
4209
4210                         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(textureQueryLodCases); ++ndx)
4211                         {
4212                                 const TexQueryFuncCaseSpec&             caseSpec        = textureQueryLodCases[ndx];
4213
4214                                 // available only in fragment shader
4215                                 group->addChild(new TextureQueryCase(m_testCtx, (std::string(caseSpec.name) + "_fragment"), "", caseSpec.samplerName, caseSpec.textureSpec, false, QUERYFUNCTION_TEXTUREQUERYLOD));
4216                         }
4217
4218                         queryGroup->addChild(group.release());
4219                 }
4220
4221                 addChild(queryGroup.release());
4222         }
4223 }
4224
4225 } // anonymous
4226
4227 tcu::TestCaseGroup* createTextureFunctionTests (tcu::TestContext& testCtx)
4228 {
4229         return new ShaderTextureFunctionTests(testCtx);
4230 }
4231
4232 } // sr
4233 } // vkt