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