Increase no-data timeout to 5 seconds. am: d00b71cbc3 am: f8083c0977 am: 5e52d6630c...
[platform/upstream/VK-GL-CTS.git] / modules / glshared / glsTextureTestUtil.hpp
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 #include "tcuTexVerifierUtil.hpp"
41
42 #include "gluShaderProgram.hpp"
43 #include "gluShaderUtil.hpp"
44 #include "gluTextureTestUtil.hpp"
45
46 #include "deInt32.h"
47
48 #include <map>
49
50 namespace tcu
51 {
52 struct LookupPrecision;
53 struct LodPrecision;
54 struct TexComparePrecision;
55 }
56
57 namespace deqp
58 {
59 namespace gls
60 {
61 namespace TextureTestUtil
62 {
63
64 enum Program
65 {
66         PROGRAM_2D_FLOAT = 0,
67         PROGRAM_2D_INT,
68         PROGRAM_2D_UINT,
69         PROGRAM_2D_SHADOW,
70
71         PROGRAM_2D_FLOAT_BIAS,
72         PROGRAM_2D_INT_BIAS,
73         PROGRAM_2D_UINT_BIAS,
74         PROGRAM_2D_SHADOW_BIAS,
75
76         PROGRAM_1D_FLOAT,
77         PROGRAM_1D_INT,
78         PROGRAM_1D_UINT,
79         PROGRAM_1D_SHADOW,
80
81         PROGRAM_1D_FLOAT_BIAS,
82         PROGRAM_1D_INT_BIAS,
83         PROGRAM_1D_UINT_BIAS,
84         PROGRAM_1D_SHADOW_BIAS,
85
86         PROGRAM_CUBE_FLOAT,
87         PROGRAM_CUBE_INT,
88         PROGRAM_CUBE_UINT,
89         PROGRAM_CUBE_SHADOW,
90
91         PROGRAM_CUBE_FLOAT_BIAS,
92         PROGRAM_CUBE_INT_BIAS,
93         PROGRAM_CUBE_UINT_BIAS,
94         PROGRAM_CUBE_SHADOW_BIAS,
95
96         PROGRAM_1D_ARRAY_FLOAT,
97         PROGRAM_1D_ARRAY_INT,
98         PROGRAM_1D_ARRAY_UINT,
99         PROGRAM_1D_ARRAY_SHADOW,
100
101         PROGRAM_2D_ARRAY_FLOAT,
102         PROGRAM_2D_ARRAY_INT,
103         PROGRAM_2D_ARRAY_UINT,
104         PROGRAM_2D_ARRAY_SHADOW,
105
106         PROGRAM_3D_FLOAT,
107         PROGRAM_3D_INT,
108         PROGRAM_3D_UINT,
109
110         PROGRAM_3D_FLOAT_BIAS,
111         PROGRAM_3D_INT_BIAS,
112         PROGRAM_3D_UINT_BIAS,
113
114         PROGRAM_CUBE_ARRAY_FLOAT,
115         PROGRAM_CUBE_ARRAY_INT,
116         PROGRAM_CUBE_ARRAY_UINT,
117         PROGRAM_CUBE_ARRAY_SHADOW,
118
119         PROGRAM_BUFFER_FLOAT,
120         PROGRAM_BUFFER_INT,
121         PROGRAM_BUFFER_UINT,
122
123         PROGRAM_LAST
124 };
125
126 class ProgramLibrary
127 {
128 public:
129                                                                                         ProgramLibrary                  (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
130                                                                                         ~ProgramLibrary                 (void);
131
132         glu::ShaderProgram*                                             getProgram                              (Program program);
133         void                                                                    clear                                   (void);
134
135 private:
136                                                                                         ProgramLibrary                  (const ProgramLibrary& other);
137         ProgramLibrary&                                                 operator=                               (const ProgramLibrary& other);
138
139         const glu::RenderContext&                               m_context;
140         tcu::TestLog&                                                   m_log;
141         glu::GLSLVersion                                                m_glslVersion;
142         glu::Precision                                                  m_texCoordPrecision;
143         std::map<Program, glu::ShaderProgram*>  m_programs;
144 };
145
146 class TextureRenderer
147 {
148 public:
149                                                                 TextureRenderer                 (const glu::RenderContext& context, tcu::TestLog& log, glu::GLSLVersion glslVersion, glu::Precision texCoordPrecision);
150                                                                 ~TextureRenderer                (void);
151
152         void                                            clear                                   (void); //!< Frees allocated resources. Destructor will call clear() as well.
153
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);
156
157 private:
158                                                                 TextureRenderer                 (const TextureRenderer& other);
159         TextureRenderer&                        operator=                               (const TextureRenderer& other);
160
161         const glu::RenderContext&       m_renderCtx;
162         tcu::TestLog&                           m_log;
163         ProgramLibrary                          m_programLibrary;
164 };
165
166 class RandomViewport
167 {
168 public:
169         int             x;
170         int             y;
171         int             width;
172         int             height;
173
174         RandomViewport (const tcu::RenderTarget& renderTarget, int preferredWidth, int preferredHeight, deUint32 seed);
175 };
176
177 } // TextureTestUtil
178 } // gls
179 } // deqp
180
181 #endif // _GLSTEXTURETESTUTIL_HPP