1 #ifndef _GLSTEXTURETESTUTIL_HPP
2 #define _GLSTEXTURETESTUTIL_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program OpenGL (ES) Module
5 * -----------------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief Texture test utilities.
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 *//*--------------------------------------------------------------------*/
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 #include "tcuTexVerifierUtil.hpp"
42 #include "gluShaderProgram.hpp"
43 #include "gluShaderUtil.hpp"
44 #include "gluTextureTestUtil.hpp"
52 struct LookupPrecision;
54 struct TexComparePrecision;
61 namespace TextureTestUtil
71 PROGRAM_2D_FLOAT_BIAS,
74 PROGRAM_2D_SHADOW_BIAS,
81 PROGRAM_1D_FLOAT_BIAS,
84 PROGRAM_1D_SHADOW_BIAS,
91 PROGRAM_CUBE_FLOAT_BIAS,
92 PROGRAM_CUBE_INT_BIAS,
93 PROGRAM_CUBE_UINT_BIAS,
94 PROGRAM_CUBE_SHADOW_BIAS,
96 PROGRAM_1D_ARRAY_FLOAT,
98 PROGRAM_1D_ARRAY_UINT,
99 PROGRAM_1D_ARRAY_SHADOW,
101 PROGRAM_2D_ARRAY_FLOAT,
102 PROGRAM_2D_ARRAY_INT,
103 PROGRAM_2D_ARRAY_UINT,
104 PROGRAM_2D_ARRAY_SHADOW,
110 PROGRAM_3D_FLOAT_BIAS,
112 PROGRAM_3D_UINT_BIAS,
114 PROGRAM_CUBE_ARRAY_FLOAT,
115 PROGRAM_CUBE_ARRAY_INT,
116 PROGRAM_CUBE_ARRAY_UINT,
117 PROGRAM_CUBE_ARRAY_SHADOW,
119 PROGRAM_BUFFER_FLOAT,
129 ProgramLibrary (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
130 ~ProgramLibrary (void);
132 glu::ShaderProgram* getProgram (Program program);
136 ProgramLibrary (const ProgramLibrary& other);
137 ProgramLibrary& operator= (const ProgramLibrary& other);
139 const glu::RenderContext& m_context;
141 glu::GLSLVersion m_glslVersion;
142 glu::Precision m_texCoordPrecision;
143 std::map<Program, glu::ShaderProgram*> m_programs;
146 class TextureRenderer
149 TextureRenderer (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
150 ~TextureRenderer (void);
152 void clear (void); //!< Frees allocated resources. Destructor will call clear() as well.
154 void renderQuad (int texUnit, const float* texCoord, glu::TextureTestUtil::TextureType texType);
155 void renderQuad (int texUnit, const float* texCoord, const glu::TextureTestUtil::RenderParams& params);
158 TextureRenderer (const TextureRenderer& other);
159 TextureRenderer& operator= (const TextureRenderer& other);
161 const glu::RenderContext& m_renderCtx;
163 ProgramLibrary m_programLibrary;
174 RandomViewport (const tcu::RenderTarget& renderTarget, int preferredWidth, int preferredHeight, deUint32 seed);
181 #endif // _GLSTEXTURETESTUTIL_HPP