xref: /aosp_15_r20/external/deqp/framework/common/tcuTexCompareVerifier.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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 
30 namespace tcu
31 {
32 
33 /*--------------------------------------------------------------------*//*!
34  * \brief Texture compare (shadow) lookup precision parameters.
35  * \see LookupPrecision
36  *//*--------------------------------------------------------------------*/
37 struct 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 
TexComparePrecisiontcu::TexComparePrecision45     TexComparePrecision(void) : coordBits(22), uvwBits(16), pcfBits(16), referenceBits(16), resultBits(16)
46     {
47     }
48 } DE_WARN_UNUSED_TYPE;
49 
50 bool isTexCompareResultValid(const Texture2DView &texture, const Sampler &sampler, const TexComparePrecision &prec,
51                              const Vec2 &coord, const Vec2 &lodBounds, const float cmpReference, const float result);
52 bool isTexCompareResultValid(const TextureCubeView &texture, const Sampler &sampler, const TexComparePrecision &prec,
53                              const Vec3 &coord, const Vec2 &lodBounds, const float cmpReference, const float result);
54 bool isTexCompareResultValid(const Texture2DArrayView &texture, const Sampler &sampler, const TexComparePrecision &prec,
55                              const Vec3 &coord, const Vec2 &lodBounds, const float cmpReference, const float result);
56 bool isTexCompareResultValid(const Texture1DView &texture, const Sampler &sampler, const TexComparePrecision &prec,
57                              const Vec1 &coord, const Vec2 &lodBounds, const float cmpReference, const float result);
58 bool isTexCompareResultValid(const Texture1DArrayView &texture, const Sampler &sampler, const TexComparePrecision &prec,
59                              const Vec2 &coord, const Vec2 &lodBounds, const float cmpReference, const float result);
60 bool isTexCompareResultValid(const TextureCubeArrayView &texture, const Sampler &sampler,
61                              const TexComparePrecision &prec, const Vec4 &coord, const Vec2 &lodBounds,
62                              const float cmpReference, const float result);
63 
64 bool isGatherOffsetsCompareResultValid(const Texture2DView &texture, const Sampler &sampler,
65                                        const TexComparePrecision &prec, const Vec2 &coord, const IVec2 (&offsets)[4],
66                                        float cmpReference, const Vec4 &result);
67 bool isGatherOffsetsCompareResultValid(const Texture2DArrayView &texture, const Sampler &sampler,
68                                        const TexComparePrecision &prec, const Vec3 &coord, const IVec2 (&offsets)[4],
69                                        float cmpReference, const Vec4 &result);
70 // \note For cube textures, gather is only defined without offset.
71 bool isGatherCompareResultValid(const TextureCubeView &texture, const Sampler &sampler, const TexComparePrecision &prec,
72                                 const Vec3 &coord, float cmpReference, const Vec4 &result);
73 
74 } // namespace tcu
75 
76 #endif // _TCUTEXCOMPAREVERIFIER_HPP
77