1#ifndef _TCUTEXCOMPAREVERIFIER_HPP
2#define _TCUTEXCOMPAREVERIFIER_HPP
3/*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
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 compare (shadow) result verifier.
24 *//*--------------------------------------------------------------------*/
25
26#include "tcuDefs.hpp"
27#include "tcuTexture.hpp"
28#include "tcuTexLookupVerifier.hpp"
29
30namespace tcu
31{
32
33/*--------------------------------------------------------------------*//*!
34 * \brief Texture compare (shadow) lookup precision parameters.
35 * \see LookupPrecision
36 *//*--------------------------------------------------------------------*/
37struct TexComparePrecision
38{
39	IVec3		coordBits;		//!< Bits per coordinate component before any transformations. Assumed to be floating-point.
40	IVec3		uvwBits;		//!< Bits per component in final per-level UV(W) coordinates. Assumed to be fixed-point.
41	int			pcfBits;		//!< Number of accurate bits in PCF. This is additional error taken into account when doing filtering. Assumed to be fixed-point.
42	int			referenceBits;	//!< Number of accurate bits in compare reference value. Assumed to be fixed-point.
43	int			resultBits;		//!< Number of accurate bits in result value. Assumed to be fixed-point.
44
45	TexComparePrecision (void)
46		: coordBits		(22)
47		, uvwBits		(16)
48		, pcfBits		(16)
49		, referenceBits	(16)
50		, resultBits	(16)
51	{
52	}
53};
54
55bool		isTexCompareResultValid				(const Texture2DView&		texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec2& coord, const Vec2& lodBounds, const float cmpReference, const float result);
56bool		isTexCompareResultValid				(const TextureCubeView&		texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec3& coord, const Vec2& lodBounds, const float cmpReference, const float result);
57bool		isTexCompareResultValid				(const Texture2DArrayView&	texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec3& coord, const Vec2& lodBounds, const float cmpReference, const float result);
58
59bool		isGatherOffsetsCompareResultValid	(const Texture2DView&		texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec2& coord, const IVec2 (&offsets)[4], float cmpReference, const Vec4& result);
60bool		isGatherOffsetsCompareResultValid	(const Texture2DArrayView&	texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec3& coord, const IVec2 (&offsets)[4], float cmpReference, const Vec4& result);
61// \note For cube textures, gather is only defined without offset.
62bool		isGatherCompareResultValid			(const TextureCubeView&		texture, const Sampler& sampler, const TexComparePrecision& prec, const Vec3& coord, float cmpReference, const Vec4& result);
63
64} // tcu
65
66#endif // _TCUTEXCOMPAREVERIFIER_HPP
67