1#ifndef _GLSTEXTURETESTUTIL_HPP
2#define _GLSTEXTURETESTUTIL_HPP
3/*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL (ES) Module
5 * -----------------------------------------------
6 *
7 * Copyright 2014 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 test utilities.
24 *
25 * About coordinates:
26 *  + Quads consist of 2 triangles, rendered using explicit indices.
27 *  + All TextureTestUtil functions and classes expect texture coordinates
28 *    for quads to be specified in order (-1, -1), (-1, 1), (1, -1), (1, 1).
29 *//*--------------------------------------------------------------------*/
30
31#include "tcuDefs.hpp"
32#include "tcuTexture.hpp"
33#include "tcuSurface.hpp"
34#include "tcuPixelFormat.hpp"
35#include "tcuRenderTarget.hpp"
36#include "tcuTestContext.hpp"
37#include "tcuTestLog.hpp"
38#include "tcuCompressedTexture.hpp"
39#include "tcuTextureUtil.hpp"
40
41#include "gluShaderProgram.hpp"
42#include "gluShaderUtil.hpp"
43
44#include "deMath.h"
45#include "deInt32.h"
46
47#include <map>
48
49namespace tcu
50{
51struct LookupPrecision;
52struct LodPrecision;
53struct TexComparePrecision;
54}
55
56namespace deqp
57{
58namespace gls
59{
60namespace TextureTestUtil
61{
62
63enum TextureType
64{
65	TEXTURETYPE_2D = 0,
66	TEXTURETYPE_CUBE,
67	TEXTURETYPE_2D_ARRAY,
68	TEXTURETYPE_3D,
69	TEXTURETYPE_CUBE_ARRAY,
70	TEXTURETYPE_1D,
71	TEXTURETYPE_1D_ARRAY,
72	TEXTURETYPE_BUFFER,
73
74	TEXTURETYPE_LAST
75};
76
77enum SamplerType
78{
79	SAMPLERTYPE_FLOAT,
80	SAMPLERTYPE_INT,
81	SAMPLERTYPE_UINT,
82	SAMPLERTYPE_SHADOW,
83
84	SAMPLERTYPE_FETCH_FLOAT,
85	SAMPLERTYPE_FETCH_INT,
86	SAMPLERTYPE_FETCH_UINT,
87
88	SAMPLERTYPE_LAST
89};
90
91SamplerType		getSamplerType		(tcu::TextureFormat format);
92SamplerType		getFetchSamplerType	(tcu::TextureFormat format);
93
94struct RenderParams
95{
96	enum Flags
97	{
98		PROJECTED		= (1<<0),
99		USE_BIAS		= (1<<1),
100		LOG_PROGRAMS	= (1<<2),
101		LOG_UNIFORMS	= (1<<3),
102
103		LOG_ALL			= LOG_PROGRAMS|LOG_UNIFORMS
104	};
105
106	RenderParams (TextureType texType_)
107		: texType		(texType_)
108		, samplerType	(SAMPLERTYPE_FLOAT)
109		, flags			(0)
110		, w				(1.0f)
111		, bias			(0.0f)
112		, ref			(0.0f)
113		, colorScale	(1.0f)
114		, colorBias		(0.0f)
115	{
116	}
117
118	TextureType		texType;		//!< Texture type.
119	SamplerType		samplerType;	//!< Sampler type.
120	deUint32		flags;			//!< Feature flags.
121	tcu::Vec4		w;				//!< w coordinates for quad vertices.
122	float			bias;			//!< User-supplied bias.
123	float			ref;			//!< Reference value for shadow lookups.
124
125	// color = lookup() * scale + bias
126	tcu::Vec4		colorScale;		//!< Scale for texture color values.
127	tcu::Vec4		colorBias;		//!< Bias for texture color values.
128};
129
130enum Program
131{
132	PROGRAM_2D_FLOAT = 0,
133	PROGRAM_2D_INT,
134	PROGRAM_2D_UINT,
135	PROGRAM_2D_SHADOW,
136
137	PROGRAM_2D_FLOAT_BIAS,
138	PROGRAM_2D_INT_BIAS,
139	PROGRAM_2D_UINT_BIAS,
140	PROGRAM_2D_SHADOW_BIAS,
141
142	PROGRAM_1D_FLOAT,
143	PROGRAM_1D_INT,
144	PROGRAM_1D_UINT,
145	PROGRAM_1D_SHADOW,
146
147	PROGRAM_1D_FLOAT_BIAS,
148	PROGRAM_1D_INT_BIAS,
149	PROGRAM_1D_UINT_BIAS,
150	PROGRAM_1D_SHADOW_BIAS,
151
152	PROGRAM_CUBE_FLOAT,
153	PROGRAM_CUBE_INT,
154	PROGRAM_CUBE_UINT,
155	PROGRAM_CUBE_SHADOW,
156
157	PROGRAM_CUBE_FLOAT_BIAS,
158	PROGRAM_CUBE_INT_BIAS,
159	PROGRAM_CUBE_UINT_BIAS,
160	PROGRAM_CUBE_SHADOW_BIAS,
161
162	PROGRAM_1D_ARRAY_FLOAT,
163	PROGRAM_1D_ARRAY_INT,
164	PROGRAM_1D_ARRAY_UINT,
165	PROGRAM_1D_ARRAY_SHADOW,
166
167	PROGRAM_2D_ARRAY_FLOAT,
168	PROGRAM_2D_ARRAY_INT,
169	PROGRAM_2D_ARRAY_UINT,
170	PROGRAM_2D_ARRAY_SHADOW,
171
172	PROGRAM_3D_FLOAT,
173	PROGRAM_3D_INT,
174	PROGRAM_3D_UINT,
175
176	PROGRAM_3D_FLOAT_BIAS,
177	PROGRAM_3D_INT_BIAS,
178	PROGRAM_3D_UINT_BIAS,
179
180	PROGRAM_CUBE_ARRAY_FLOAT,
181	PROGRAM_CUBE_ARRAY_INT,
182	PROGRAM_CUBE_ARRAY_UINT,
183	PROGRAM_CUBE_ARRAY_SHADOW,
184
185	PROGRAM_BUFFER_FLOAT,
186	PROGRAM_BUFFER_INT,
187	PROGRAM_BUFFER_UINT,
188
189	PROGRAM_LAST
190};
191
192class ProgramLibrary
193{
194public:
195											ProgramLibrary			(const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
196											~ProgramLibrary			(void);
197
198	glu::ShaderProgram*						getProgram				(Program program);
199	void									clear					(void);
200
201private:
202											ProgramLibrary			(const ProgramLibrary& other);
203	ProgramLibrary&							operator=				(const ProgramLibrary& other);
204
205	const glu::RenderContext&				m_context;
206	tcu::TestLog&							m_log;
207	glu::GLSLVersion						m_glslVersion;
208	glu::Precision							m_texCoordPrecision;
209	std::map<Program, glu::ShaderProgram*>	m_programs;
210};
211
212class TextureRenderer
213{
214public:
215								TextureRenderer			(const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
216								~TextureRenderer		(void);
217
218	void						clear					(void); //!< Frees allocated resources. Destructor will call clear() as well.
219
220	void						renderQuad				(int texUnit, const float* texCoord, TextureType texType);
221	void						renderQuad				(int texUnit, const float* texCoord, const RenderParams& params);
222
223private:
224								TextureRenderer			(const TextureRenderer& other);
225	TextureRenderer&			operator=				(const TextureRenderer& other);
226
227	const glu::RenderContext&	m_renderCtx;
228	tcu::TestLog&				m_log;
229	ProgramLibrary				m_programLibrary;
230};
231
232class RandomViewport
233{
234public:
235	int		x;
236	int		y;
237	int		width;
238	int		height;
239
240	RandomViewport (const tcu::RenderTarget& renderTarget, int preferredWidth, int preferredHeight, deUint32 seed);
241};
242
243inline tcu::RGBA toRGBAMasked (const tcu::Vec4& v, deUint8 mask)
244{
245	return tcu::RGBA((mask&tcu::RGBA::RED_MASK)		? tcu::floatToU8(v.x()) : 0,
246					 (mask&tcu::RGBA::GREEN_MASK)	? tcu::floatToU8(v.y()) : 0,
247					 (mask&tcu::RGBA::BLUE_MASK)	? tcu::floatToU8(v.z()) : 0,
248					 (mask&tcu::RGBA::ALPHA_MASK)	? tcu::floatToU8(v.w()) : 0xFF); //!< \note Alpha defaults to full saturation when reading masked format
249}
250
251// \todo[jarkko 2015-05-19] remove this
252inline tcu::Vec4 toVec4 (const tcu::RGBA& c)
253{
254	return c.toVec();
255}
256
257inline deUint8 getColorMask (const tcu::PixelFormat& format)
258{
259	return (deUint8)((format.redBits	? tcu::RGBA::RED_MASK	: 0) |
260					 (format.greenBits	? tcu::RGBA::GREEN_MASK	: 0) |
261					 (format.blueBits	? tcu::RGBA::BLUE_MASK	: 0) |
262					 (format.alphaBits	? tcu::RGBA::ALPHA_MASK	: 0));
263}
264
265inline tcu::IVec4 getBitsVec (const tcu::PixelFormat& format)
266{
267	return tcu::IVec4(format.redBits, format.greenBits, format.blueBits, format.alphaBits);
268}
269
270inline tcu::BVec4 getCompareMask (const tcu::PixelFormat& format)
271{
272	return tcu::BVec4(format.redBits	> 0,
273					  format.greenBits	> 0,
274					  format.blueBits	> 0,
275					  format.alphaBits	> 0);
276}
277
278// \todo [2012-02-09 pyry] Move to tcuSurfaceAccess?
279class SurfaceAccess
280{
281public:
282							SurfaceAccess		(tcu::Surface& surface, const tcu::PixelFormat& colorFmt);
283							SurfaceAccess		(tcu::Surface& surface, const tcu::PixelFormat& colorFmt, int x, int y, int width, int height);
284							SurfaceAccess		(const SurfaceAccess& parent, int x, int y, int width, int height);
285
286	int						getWidth			(void) const	{ return m_width;	}
287	int						getHeight			(void) const	{ return m_height;	}
288
289	void					setPixel			(const tcu::Vec4& color, int x, int y) const;
290
291private:
292	mutable tcu::Surface*	m_surface;
293	deUint8					m_colorMask;
294	int						m_x;
295	int						m_y;
296	int						m_width;
297	int						m_height;
298};
299
300inline void SurfaceAccess::setPixel (const tcu::Vec4& color, int x, int y) const
301{
302	DE_ASSERT(de::inBounds(x, 0, m_width) && de::inBounds(y, 0, m_height));
303	m_surface->setPixel(m_x+x, m_y+y, toRGBAMasked(color, m_colorMask));
304}
305
306enum LodMode
307{
308	LODMODE_EXACT = 0,		//!< Ideal lod computation.
309	LODMODE_MIN_BOUND,		//!< Use estimation range minimum bound.
310	LODMODE_MAX_BOUND,		//!< Use estimation range maximum bound.
311
312	LODMODE_LAST
313};
314
315struct ReferenceParams : public RenderParams
316{
317	ReferenceParams (TextureType texType_)
318		: RenderParams	(texType_)
319		, sampler		()
320		, lodMode		(LODMODE_EXACT)
321		, minLod		(-1000.0f)
322		, maxLod		(1000.0f)
323		, baseLevel		(0)
324		, maxLevel		(1000)
325	{
326	}
327
328	ReferenceParams (TextureType texType_, const tcu::Sampler& sampler_, LodMode lodMode_ = LODMODE_EXACT)
329		: RenderParams	(texType_)
330		, sampler		(sampler_)
331		, lodMode		(lodMode_)
332		, minLod		(-1000.0f)
333		, maxLod		(1000.0f)
334		, baseLevel		(0)
335		, maxLevel		(1000)
336	{
337	}
338
339	tcu::Sampler		sampler;
340	LodMode				lodMode;
341	float				minLod;
342	float				maxLod;
343	int					baseLevel;
344	int					maxLevel;
345};
346
347// Similar to sampleTexture() except uses texelFetch.
348void			fetchTexture				(const SurfaceAccess& dst, const tcu::ConstPixelBufferAccess& src, const float* texCoord, const tcu::Vec4& colorScale, const tcu::Vec4& colorBias);
349
350void			sampleTexture				(const SurfaceAccess& dst, const tcu::Texture2DView&		src, const float* texCoord, const ReferenceParams& params);
351void			sampleTexture				(const SurfaceAccess& dst, const tcu::TextureCubeView&		src, const float* texCoord, const ReferenceParams& params);
352void			sampleTexture				(const SurfaceAccess& dst, const tcu::Texture2DArrayView&	src, const float* texCoord, const ReferenceParams& params);
353void			sampleTexture				(const SurfaceAccess& dst, const tcu::Texture3DView&		src, const float* texCoord, const ReferenceParams& params);
354void			sampleTexture				(const SurfaceAccess& dst, const tcu::TextureCubeArrayView&	src, const float* texCoord, const ReferenceParams& params);
355void			sampleTexture				(const SurfaceAccess& dst, const tcu::Texture1DView&		src, const float* texCoord, const ReferenceParams& params);
356void			sampleTexture				(const SurfaceAccess& dst, const tcu::Texture1DArrayView&	src, const float* texCoord, const ReferenceParams& params);
357
358float			computeLodFromDerivates		(LodMode mode, float dudx, float dudy);
359float			computeLodFromDerivates		(LodMode mode, float dudx, float dvdx, float dudy, float dvdy);
360float			computeLodFromDerivates		(LodMode mode, float dudx, float dvdx, float dwdx, float dudy, float dvdy, float dwdy);
361
362void			computeQuadTexCoord1D			(std::vector<float>& dst, float left, float right);
363void			computeQuadTexCoord1DArray		(std::vector<float>& dst, int layerNdx, float left, float right);
364void			computeQuadTexCoord2D			(std::vector<float>& dst, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight);
365void			computeQuadTexCoord2DArray		(std::vector<float>& dst, int layerNdx, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight);
366void			computeQuadTexCoord3D			(std::vector<float>& dst, const tcu::Vec3& p0, const tcu::Vec3& p1, const tcu::IVec3& dirSwz);
367void			computeQuadTexCoordCube			(std::vector<float>& dst, tcu::CubeFace face);
368void			computeQuadTexCoordCube			(std::vector<float>& dst, tcu::CubeFace face, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight);
369void			computeQuadTexCoordCubeArray	(std::vector<float>& dst, tcu::CubeFace face, const tcu::Vec2& bottomLeft, const tcu::Vec2& topRight, const tcu::Vec2& layerRange);
370
371bool			compareImages				(tcu::TestLog& log, const char* name, const char* desc, const tcu::Surface& reference, const tcu::Surface& rendered, tcu::RGBA threshold);
372bool			compareImages				(tcu::TestLog& log, const tcu::Surface& reference, const tcu::Surface& rendered, tcu::RGBA threshold);
373int				measureAccuracy				(tcu::TestLog& log, const tcu::Surface& reference, const tcu::Surface& rendered, int bestScoreDiff, int worstScoreDiff);
374
375int				computeTextureLookupDiff	(const tcu::ConstPixelBufferAccess&	result,
376											 const tcu::ConstPixelBufferAccess&	reference,
377											 const tcu::PixelBufferAccess&		errorMask,
378											 const tcu::Texture1DView&			src,
379											 const float*						texCoord,
380											 const ReferenceParams&				sampleParams,
381											 const tcu::LookupPrecision&		lookupPrec,
382											 const tcu::LodPrecision&			lodPrec,
383											 qpWatchDog*						watchDog);
384
385int				computeTextureLookupDiff	(const tcu::ConstPixelBufferAccess&	result,
386											 const tcu::ConstPixelBufferAccess&	reference,
387											 const tcu::PixelBufferAccess&		errorMask,
388											 const tcu::Texture2DView&			src,
389											 const float*						texCoord,
390											 const ReferenceParams&				sampleParams,
391											 const tcu::LookupPrecision&		lookupPrec,
392											 const tcu::LodPrecision&			lodPrec,
393											 qpWatchDog*						watchDog);
394
395int				computeTextureLookupDiff	(const tcu::ConstPixelBufferAccess&	result,
396											 const tcu::ConstPixelBufferAccess&	reference,
397											 const tcu::PixelBufferAccess&		errorMask,
398											 const tcu::TextureCubeView&		src,
399											 const float*						texCoord,
400											 const ReferenceParams&				sampleParams,
401											 const tcu::LookupPrecision&		lookupPrec,
402											 const tcu::LodPrecision&			lodPrec,
403											 qpWatchDog*						watchDog);
404
405int				computeTextureLookupDiff	(const tcu::ConstPixelBufferAccess&	result,
406											 const tcu::ConstPixelBufferAccess&	reference,
407											 const tcu::PixelBufferAccess&		errorMask,
408											 const tcu::Texture1DArrayView&		src,
409											 const float*						texCoord,
410											 const ReferenceParams&				sampleParams,
411											 const tcu::LookupPrecision&		lookupPrec,
412											 const tcu::LodPrecision&			lodPrec,
413											 qpWatchDog*						watchDog);
414
415int				computeTextureLookupDiff	(const tcu::ConstPixelBufferAccess&	result,
416											 const tcu::ConstPixelBufferAccess&	reference,
417											 const tcu::PixelBufferAccess&		errorMask,
418											 const tcu::Texture2DArrayView&		src,
419											 const float*						texCoord,
420											 const ReferenceParams&				sampleParams,
421											 const tcu::LookupPrecision&		lookupPrec,
422											 const tcu::LodPrecision&			lodPrec,
423											 qpWatchDog*						watchDog);
424
425int				computeTextureLookupDiff	(const tcu::ConstPixelBufferAccess&	result,
426											 const tcu::ConstPixelBufferAccess&	reference,
427											 const tcu::PixelBufferAccess&		errorMask,
428											 const tcu::Texture3DView&			src,
429											 const float*						texCoord,
430											 const ReferenceParams&				sampleParams,
431											 const tcu::LookupPrecision&		lookupPrec,
432											 const tcu::LodPrecision&			lodPrec,
433											 qpWatchDog*						watchDog);
434
435int				computeTextureLookupDiff	(const tcu::ConstPixelBufferAccess&	result,
436											 const tcu::ConstPixelBufferAccess&	reference,
437											 const tcu::PixelBufferAccess&		errorMask,
438											 const tcu::TextureCubeArrayView&	src,
439											 const float*						texCoord,
440											 const ReferenceParams&				sampleParams,
441											 const tcu::LookupPrecision&		lookupPrec,
442											 const tcu::IVec4&					coordBits,
443											 const tcu::LodPrecision&			lodPrec,
444											 qpWatchDog*						watchDog);
445
446bool			verifyTextureResult			(tcu::TestContext&					testCtx,
447											 const tcu::ConstPixelBufferAccess&	result,
448											 const tcu::Texture1DView&			src,
449											 const float*						texCoord,
450											 const ReferenceParams&				sampleParams,
451											 const tcu::LookupPrecision&		lookupPrec,
452											 const tcu::LodPrecision&			lodPrec,
453											 const tcu::PixelFormat&			pixelFormat);
454
455bool			verifyTextureResult			(tcu::TestContext&					testCtx,
456											 const tcu::ConstPixelBufferAccess&	result,
457											 const tcu::Texture2DView&			src,
458											 const float*						texCoord,
459											 const ReferenceParams&				sampleParams,
460											 const tcu::LookupPrecision&		lookupPrec,
461											 const tcu::LodPrecision&			lodPrec,
462											 const tcu::PixelFormat&			pixelFormat);
463
464bool			verifyTextureResult			(tcu::TestContext&					testCtx,
465											 const tcu::ConstPixelBufferAccess&	result,
466											 const tcu::TextureCubeView&		src,
467											 const float*						texCoord,
468											 const ReferenceParams&				sampleParams,
469											 const tcu::LookupPrecision&		lookupPrec,
470											 const tcu::LodPrecision&			lodPrec,
471											 const tcu::PixelFormat&			pixelFormat);
472
473bool			verifyTextureResult			(tcu::TestContext&					testCtx,
474											 const tcu::ConstPixelBufferAccess&	result,
475											 const tcu::Texture1DArrayView&		src,
476											 const float*						texCoord,
477											 const ReferenceParams&				sampleParams,
478											 const tcu::LookupPrecision&		lookupPrec,
479											 const tcu::LodPrecision&			lodPrec,
480											 const tcu::PixelFormat&			pixelFormat);
481
482bool			verifyTextureResult			(tcu::TestContext&					testCtx,
483											 const tcu::ConstPixelBufferAccess&	result,
484											 const tcu::Texture2DArrayView&		src,
485											 const float*						texCoord,
486											 const ReferenceParams&				sampleParams,
487											 const tcu::LookupPrecision&		lookupPrec,
488											 const tcu::LodPrecision&			lodPrec,
489											 const tcu::PixelFormat&			pixelFormat);
490
491bool			verifyTextureResult			(tcu::TestContext&					testCtx,
492											 const tcu::ConstPixelBufferAccess&	result,
493											 const tcu::Texture3DView&			src,
494											 const float*						texCoord,
495											 const ReferenceParams&				sampleParams,
496											 const tcu::LookupPrecision&		lookupPrec,
497											 const tcu::LodPrecision&			lodPrec,
498											 const tcu::PixelFormat&			pixelFormat);
499
500bool			verifyTextureResult			(tcu::TestContext&					testCtx,
501											 const tcu::ConstPixelBufferAccess&	result,
502											 const tcu::TextureCubeArrayView&	src,
503											 const float*						texCoord,
504											 const ReferenceParams&				sampleParams,
505											 const tcu::LookupPrecision&		lookupPrec,
506											 const tcu::IVec4&					coordBits,
507											 const tcu::LodPrecision&			lodPrec,
508											 const tcu::PixelFormat&			pixelFormat);
509
510int				computeTextureCompareDiff	(const tcu::ConstPixelBufferAccess&	result,
511											 const tcu::ConstPixelBufferAccess&	reference,
512											 const tcu::PixelBufferAccess&		errorMask,
513											 const tcu::Texture2DView&			src,
514											 const float*						texCoord,
515											 const ReferenceParams&				sampleParams,
516											 const tcu::TexComparePrecision&	comparePrec,
517											 const tcu::LodPrecision&			lodPrec,
518											 const tcu::Vec3&					nonShadowThreshold);
519
520int				computeTextureCompareDiff	(const tcu::ConstPixelBufferAccess&	result,
521											 const tcu::ConstPixelBufferAccess&	reference,
522											 const tcu::PixelBufferAccess&		errorMask,
523											 const tcu::TextureCubeView&		src,
524											 const float*						texCoord,
525											 const ReferenceParams&				sampleParams,
526											 const tcu::TexComparePrecision&	comparePrec,
527											 const tcu::LodPrecision&			lodPrec,
528											 const tcu::Vec3&					nonShadowThreshold);
529
530int				computeTextureCompareDiff	(const tcu::ConstPixelBufferAccess&	result,
531											 const tcu::ConstPixelBufferAccess&	reference,
532											 const tcu::PixelBufferAccess&		errorMask,
533											 const tcu::Texture2DArrayView&		src,
534											 const float*						texCoord,
535											 const ReferenceParams&				sampleParams,
536											 const tcu::TexComparePrecision&	comparePrec,
537											 const tcu::LodPrecision&			lodPrec,
538											 const tcu::Vec3&					nonShadowThreshold);
539
540// Mipmap generation comparison.
541
542struct GenMipmapPrecision
543{
544	tcu::IVec3			filterBits;			//!< Bits in filtering parameters (fixed-point).
545	tcu::Vec4			colorThreshold;		//!< Threshold for color value comparison.
546	tcu::BVec4			colorMask;			//!< Color channel comparison mask.
547};
548
549qpTestResult	compareGenMipmapResult		(tcu::TestLog& log, const tcu::Texture2D& resultTexture, const tcu::Texture2D& level0Reference, const GenMipmapPrecision& precision);
550qpTestResult	compareGenMipmapResult		(tcu::TestLog& log, const tcu::TextureCube& resultTexture, const tcu::TextureCube& level0Reference, const GenMipmapPrecision& precision);
551
552// Utility for logging texture gradient ranges.
553struct LogGradientFmt
554{
555	LogGradientFmt (const tcu::Vec4* min_, const tcu::Vec4* max_) : valueMin(min_), valueMax(max_) {}
556	const tcu::Vec4* valueMin;
557	const tcu::Vec4* valueMax;
558};
559
560std::ostream&			operator<<		(std::ostream& str, const LogGradientFmt& fmt);
561inline LogGradientFmt	formatGradient	(const tcu::Vec4* minVal, const tcu::Vec4* maxVal) { return LogGradientFmt(minVal, maxVal); }
562
563} // TextureTestUtil
564} // gls
565} // deqp
566
567#endif // _GLSTEXTURETESTUTIL_HPP
568