xref: /aosp_15_r20/external/deqp/external/openglcts/modules/gl/gl4cGPUShaderFP64Tests.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker #ifndef _GL4CGPUSHADERFP64TESTS_HPP
2*35238bceSAndroid Build Coastguard Worker #define _GL4CGPUSHADERFP64TESTS_HPP
3*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker  * OpenGL Conformance Test Suite
5*35238bceSAndroid Build Coastguard Worker  * -----------------------------
6*35238bceSAndroid Build Coastguard Worker  *
7*35238bceSAndroid Build Coastguard Worker  * Copyright (c) 2014-2016 The Khronos Group Inc.
8*35238bceSAndroid Build Coastguard Worker  *
9*35238bceSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
10*35238bceSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
11*35238bceSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
12*35238bceSAndroid Build Coastguard Worker  *
13*35238bceSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
14*35238bceSAndroid Build Coastguard Worker  *
15*35238bceSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
16*35238bceSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
17*35238bceSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18*35238bceSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
19*35238bceSAndroid Build Coastguard Worker  * limitations under the License.
20*35238bceSAndroid Build Coastguard Worker  *
21*35238bceSAndroid Build Coastguard Worker  */ /*!
22*35238bceSAndroid Build Coastguard Worker  * \file
23*35238bceSAndroid Build Coastguard Worker  * \brief
24*35238bceSAndroid Build Coastguard Worker  */ /*-------------------------------------------------------------------*/
25*35238bceSAndroid Build Coastguard Worker 
26*35238bceSAndroid Build Coastguard Worker /**
27*35238bceSAndroid Build Coastguard Worker  * \file  gl4cGPUShaderFP64Tests.hpp
28*35238bceSAndroid Build Coastguard Worker  * \brief Declares test classes for "GPU Shader FP64" functionality.
29*35238bceSAndroid Build Coastguard Worker  */ /*-------------------------------------------------------------------*/
30*35238bceSAndroid Build Coastguard Worker 
31*35238bceSAndroid Build Coastguard Worker #include "glcTestCase.hpp"
32*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp"
33*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
34*35238bceSAndroid Build Coastguard Worker #include "tcuDefs.hpp"
35*35238bceSAndroid Build Coastguard Worker #include "tcuVector.hpp"
36*35238bceSAndroid Build Coastguard Worker #include <queue>
37*35238bceSAndroid Build Coastguard Worker 
38*35238bceSAndroid Build Coastguard Worker namespace gl4cts
39*35238bceSAndroid Build Coastguard Worker {
40*35238bceSAndroid Build Coastguard Worker class Utils
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker public:
43*35238bceSAndroid Build Coastguard Worker     /* Public type definitions */
44*35238bceSAndroid Build Coastguard Worker 
45*35238bceSAndroid Build Coastguard Worker     /** Store information about program object
46*35238bceSAndroid Build Coastguard Worker      *
47*35238bceSAndroid Build Coastguard Worker      **/
48*35238bceSAndroid Build Coastguard Worker     struct programInfo
49*35238bceSAndroid Build Coastguard Worker     {
50*35238bceSAndroid Build Coastguard Worker         programInfo(deqp::Context &context);
51*35238bceSAndroid Build Coastguard Worker         ~programInfo();
52*35238bceSAndroid Build Coastguard Worker 
53*35238bceSAndroid Build Coastguard Worker         void build(const glw::GLchar *compute_shader_code, const glw::GLchar *fragment_shader_code,
54*35238bceSAndroid Build Coastguard Worker                    const glw::GLchar *geometry_shader_code, const glw::GLchar *tesselation_control_shader_code,
55*35238bceSAndroid Build Coastguard Worker                    const glw::GLchar *tesselation_evaluation_shader_code, const glw::GLchar *vertex_shader_code,
56*35238bceSAndroid Build Coastguard Worker                    const glw::GLchar *const *varying_names, glw::GLuint n_varying_names);
57*35238bceSAndroid Build Coastguard Worker 
58*35238bceSAndroid Build Coastguard Worker         void compile(glw::GLuint shader_id, const glw::GLchar *shader_code) const;
59*35238bceSAndroid Build Coastguard Worker 
60*35238bceSAndroid Build Coastguard Worker         void link() const;
61*35238bceSAndroid Build Coastguard Worker 
62*35238bceSAndroid Build Coastguard Worker         static const glw::GLenum ARB_COMPUTE_SHADER;
63*35238bceSAndroid Build Coastguard Worker 
64*35238bceSAndroid Build Coastguard Worker         deqp::Context &m_context;
65*35238bceSAndroid Build Coastguard Worker 
66*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_compute_shader_id;
67*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_fragment_shader_id;
68*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_geometry_shader_id;
69*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_program_object_id;
70*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_tesselation_control_shader_id;
71*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_tesselation_evaluation_shader_id;
72*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_vertex_shader_id;
73*35238bceSAndroid Build Coastguard Worker     };
74*35238bceSAndroid Build Coastguard Worker 
75*35238bceSAndroid Build Coastguard Worker     /* Defines GLSL variable type */
76*35238bceSAndroid Build Coastguard Worker     enum _variable_type
77*35238bceSAndroid Build Coastguard Worker     {
78*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_BOOL,
79*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_BVEC2,
80*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_BVEC3,
81*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_BVEC4,
82*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DOUBLE,
83*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT2,
84*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT2X3,
85*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT2X4,
86*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT3,
87*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT3X2,
88*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT3X4,
89*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT4,
90*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT4X2,
91*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DMAT4X3,
92*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DVEC2,
93*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DVEC3,
94*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_DVEC4,
95*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_FLOAT,
96*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_INT,
97*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_IVEC2,
98*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_IVEC3,
99*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_IVEC4,
100*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT2,
101*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT2X3,
102*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT2X4,
103*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT3,
104*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT3X2,
105*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT3X4,
106*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT4,
107*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT4X2,
108*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_MAT4X3,
109*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_UINT,
110*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_UVEC2,
111*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_UVEC3,
112*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_UVEC4,
113*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_VEC2,
114*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_VEC3,
115*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_VEC4,
116*35238bceSAndroid Build Coastguard Worker 
117*35238bceSAndroid Build Coastguard Worker         /* Always last */
118*35238bceSAndroid Build Coastguard Worker         VARIABLE_TYPE_UNKNOWN
119*35238bceSAndroid Build Coastguard Worker     };
120*35238bceSAndroid Build Coastguard Worker 
121*35238bceSAndroid Build Coastguard Worker     /* Public static methods */
122*35238bceSAndroid Build Coastguard Worker     static _variable_type getBaseVariableType(_variable_type type);
123*35238bceSAndroid Build Coastguard Worker     static unsigned int getBaseVariableTypeComponentSize(_variable_type type);
124*35238bceSAndroid Build Coastguard Worker     static unsigned char getComponentAtIndex(unsigned int index);
125*35238bceSAndroid Build Coastguard Worker 
126*35238bceSAndroid Build Coastguard Worker     static _variable_type getDoubleVariableType(glw::GLuint n_columns, glw::GLuint n_rows);
127*35238bceSAndroid Build Coastguard Worker 
128*35238bceSAndroid Build Coastguard Worker     static std::string getFPVariableTypeStringForVariableType(_variable_type type);
129*35238bceSAndroid Build Coastguard Worker     static glw::GLenum getGLDataTypeOfBaseVariableType(_variable_type type);
130*35238bceSAndroid Build Coastguard Worker     static glw::GLenum getGLDataTypeOfVariableType(_variable_type type);
131*35238bceSAndroid Build Coastguard Worker 
132*35238bceSAndroid Build Coastguard Worker     static _variable_type getIntVariableType(glw::GLuint n_columns, glw::GLuint n_rows);
133*35238bceSAndroid Build Coastguard Worker 
134*35238bceSAndroid Build Coastguard Worker     static unsigned int getNumberOfColumnsForVariableType(_variable_type type);
135*35238bceSAndroid Build Coastguard Worker     static unsigned int getNumberOfComponentsForVariableType(_variable_type type);
136*35238bceSAndroid Build Coastguard Worker     static unsigned int getNumberOfLocationsUsedByDoublePrecisionVariableType(_variable_type type);
137*35238bceSAndroid Build Coastguard Worker     static unsigned int getNumberOfRowsForVariableType(_variable_type type);
138*35238bceSAndroid Build Coastguard Worker 
139*35238bceSAndroid Build Coastguard Worker     static _variable_type getPostMatrixMultiplicationVariableType(_variable_type type_matrix_a,
140*35238bceSAndroid Build Coastguard Worker                                                                   _variable_type type_matrix_b);
141*35238bceSAndroid Build Coastguard Worker 
142*35238bceSAndroid Build Coastguard Worker     static std::string getStringForVariableTypeValue(_variable_type type, const unsigned char *data_ptr);
143*35238bceSAndroid Build Coastguard Worker 
144*35238bceSAndroid Build Coastguard Worker     static _variable_type getTransposedMatrixVariableType(_variable_type type);
145*35238bceSAndroid Build Coastguard Worker 
146*35238bceSAndroid Build Coastguard Worker     static _variable_type getUintVariableType(glw::GLuint n_columns, glw::GLuint n_rows);
147*35238bceSAndroid Build Coastguard Worker 
148*35238bceSAndroid Build Coastguard Worker     static std::string getVariableTypeString(_variable_type type);
149*35238bceSAndroid Build Coastguard Worker 
150*35238bceSAndroid Build Coastguard Worker     static bool isGLVersionAtLeast(const glw::Functions &gl, glw::GLint required_major, glw::GLint required_minor);
151*35238bceSAndroid Build Coastguard Worker 
152*35238bceSAndroid Build Coastguard Worker     static bool isMatrixVariableType(_variable_type type);
153*35238bceSAndroid Build Coastguard Worker     static bool isScalarVariableType(_variable_type type);
154*35238bceSAndroid Build Coastguard Worker 
155*35238bceSAndroid Build Coastguard Worker     static void replaceToken(const glw::GLchar *token, size_t &search_position, const glw::GLchar *text,
156*35238bceSAndroid Build Coastguard Worker                              std::string &string);
157*35238bceSAndroid Build Coastguard Worker };
158*35238bceSAndroid Build Coastguard Worker 
159*35238bceSAndroid Build Coastguard Worker /** Make sure errors as per spec are generated for new entry-points.
160*35238bceSAndroid Build Coastguard Worker  *
161*35238bceSAndroid Build Coastguard Worker  * a) Make sure GL_INVALID_OPERATION is generated by glUniform*() and
162*35238bceSAndroid Build Coastguard Worker  *    glUniformMatrix*() functions if there is no current program object.
163*35238bceSAndroid Build Coastguard Worker  * b) Make sure GL_INVALID_OPERATION is generated by glUniform*() if
164*35238bceSAndroid Build Coastguard Worker  *    the size of the uniform variable declared in the shader does not
165*35238bceSAndroid Build Coastguard Worker  *    match the size indicated by the command.
166*35238bceSAndroid Build Coastguard Worker  * c) Make sure GL_INVALID_OPERATION is generated if glUniform*() and
167*35238bceSAndroid Build Coastguard Worker  *    glUniformMatrix*() are used to load a uniform variable of type
168*35238bceSAndroid Build Coastguard Worker  *    bool, bvec2, bvec3, bvec4, float, int, ivec2, ivec3, ivec4,
169*35238bceSAndroid Build Coastguard Worker  *    unsigned int, uvec2, uvec3, uvec4, vec2, vec3, vec4 or an array
170*35238bceSAndroid Build Coastguard Worker  *    of these.
171*35238bceSAndroid Build Coastguard Worker  * d) Make sure GL_INVALID_OPERATION is generated if glUniform*() and
172*35238bceSAndroid Build Coastguard Worker  *    glUniformMatrix*() are used to load incompatible double-typed
173*35238bceSAndroid Build Coastguard Worker  *    uniforms, as presented below:
174*35238bceSAndroid Build Coastguard Worker  *
175*35238bceSAndroid Build Coastguard Worker  *    I.    double-typed uniform configured by glUniform2d();
176*35238bceSAndroid Build Coastguard Worker  *    II.   double-typed uniform configured by glUniform3d();
177*35238bceSAndroid Build Coastguard Worker  *    III.  double-typed uniform configured by glUniform4d();
178*35238bceSAndroid Build Coastguard Worker  *    IV.   double-typed uniform configured by glUniformMatrix*();
179*35238bceSAndroid Build Coastguard Worker  *    V.    dvec2-typed  uniform configured by glUniform1d();
180*35238bceSAndroid Build Coastguard Worker  *    VI.   dvec2-typed  uniform configured by glUniform3d();
181*35238bceSAndroid Build Coastguard Worker  *    VII.  dvec2-typed  uniform configured by glUniform4d();
182*35238bceSAndroid Build Coastguard Worker  *    VIII. dvec2-typed  uniform configured by glUniformMatrix*();
183*35238bceSAndroid Build Coastguard Worker  *
184*35238bceSAndroid Build Coastguard Worker  *                             (etc.)
185*35238bceSAndroid Build Coastguard Worker  *
186*35238bceSAndroid Build Coastguard Worker  * e) Make sure GL_INVALID_OPERATION is generated if <location> of
187*35238bceSAndroid Build Coastguard Worker  *    glUniform*() and glUniformMatrix*() is an invalid uniform
188*35238bceSAndroid Build Coastguard Worker  *    location for the current program object and location is not
189*35238bceSAndroid Build Coastguard Worker  *    equal to -1.
190*35238bceSAndroid Build Coastguard Worker  * f) Make sure GL_INVALID_VALUE is generated if <count> of
191*35238bceSAndroid Build Coastguard Worker  *    glUniform*() (*dv() functions only) and glUniformMatrix*() is
192*35238bceSAndroid Build Coastguard Worker  *    negative.
193*35238bceSAndroid Build Coastguard Worker  * g) Make sure GL_INVALID_OPERATION is generated if <count> of
194*35238bceSAndroid Build Coastguard Worker  *    glUniform*() (*dv() functions only) and glUniformMatrix*() is
195*35238bceSAndroid Build Coastguard Worker  *    greater than 1 and the indicated uniform variable is not an
196*35238bceSAndroid Build Coastguard Worker  *    array variable.
197*35238bceSAndroid Build Coastguard Worker  * h) Make sure GL_INVALID_OPERATION is generated if a sampler is
198*35238bceSAndroid Build Coastguard Worker  *    loaded by glUniform*() and glUniformMatrix*().
199*35238bceSAndroid Build Coastguard Worker  * i) Make sure GL_INVALID_OPERATION is generated if glUniform*() and
200*35238bceSAndroid Build Coastguard Worker  *    glUniformMatrix*() is used to load values for uniforms of
201*35238bceSAndroid Build Coastguard Worker  *    boolean types.
202*35238bceSAndroid Build Coastguard Worker  */
203*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test1 : public deqp::TestCase
204*35238bceSAndroid Build Coastguard Worker {
205*35238bceSAndroid Build Coastguard Worker public:
206*35238bceSAndroid Build Coastguard Worker     /* Public methods */
207*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test1(deqp::Context &context);
208*35238bceSAndroid Build Coastguard Worker 
209*35238bceSAndroid Build Coastguard Worker     void deinit();
210*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
211*35238bceSAndroid Build Coastguard Worker 
212*35238bceSAndroid Build Coastguard Worker     /* Private type definitions */
213*35238bceSAndroid Build Coastguard Worker private:
214*35238bceSAndroid Build Coastguard Worker     typedef enum
215*35238bceSAndroid Build Coastguard Worker     {
216*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_FIRST,
217*35238bceSAndroid Build Coastguard Worker 
218*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_1D = UNIFORM_FUNCTION_FIRST,
219*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_1DV,
220*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_2D,
221*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_2DV,
222*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_3D,
223*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_3DV,
224*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_4D,
225*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_4DV,
226*35238bceSAndroid Build Coastguard Worker 
227*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX2DV,
228*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX2X3DV,
229*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX2X4DV,
230*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX3DV,
231*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX3X2DV,
232*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX3X4DV,
233*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX4DV,
234*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX4X2DV,
235*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_MATRIX4X3DV,
236*35238bceSAndroid Build Coastguard Worker 
237*35238bceSAndroid Build Coastguard Worker         /* Always last */
238*35238bceSAndroid Build Coastguard Worker         UNIFORM_FUNCTION_COUNT
239*35238bceSAndroid Build Coastguard Worker     } _uniform_function;
240*35238bceSAndroid Build Coastguard Worker 
241*35238bceSAndroid Build Coastguard Worker     /* Private methods */
242*35238bceSAndroid Build Coastguard Worker     const char *getUniformFunctionString(_uniform_function func);
243*35238bceSAndroid Build Coastguard Worker     const char *getUniformNameForLocation(glw::GLint location);
244*35238bceSAndroid Build Coastguard Worker     void initTest();
245*35238bceSAndroid Build Coastguard Worker     bool isMatrixUniform(glw::GLint uniform_location);
246*35238bceSAndroid Build Coastguard Worker     bool isMatrixUniformFunction(_uniform_function func);
247*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingDoubleUniformFunctionsForBooleans();
248*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingDoubleUniformFunctionsForSamplers();
249*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingDoubleUniformFunctionsWithInvalidCount();
250*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingDoubleUniformFunctionsWithInvalidLocation();
251*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingDoubleUniformFunctionsWithNegativeCount();
252*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingMismatchedDoubleUniformFunctions();
253*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingSizeMismatchedUniformFunctions();
254*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenCallingTypeMismatchedUniformFunctions();
255*35238bceSAndroid Build Coastguard Worker     bool verifyErrorGenerationWhenUniformFunctionsCalledWithoutActivePO();
256*35238bceSAndroid Build Coastguard Worker 
257*35238bceSAndroid Build Coastguard Worker     /* Private fields */
258*35238bceSAndroid Build Coastguard Worker     bool m_has_test_passed;
259*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bool_arr_uniform_location;
260*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bool_uniform_location;
261*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bvec2_arr_uniform_location;
262*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bvec2_uniform_location;
263*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bvec3_arr_uniform_location;
264*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bvec3_uniform_location;
265*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bvec4_arr_uniform_location;
266*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_bvec4_uniform_location;
267*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat2_arr_uniform_location;
268*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat2_uniform_location;
269*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat2x3_arr_uniform_location;
270*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat2x3_uniform_location;
271*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat2x4_arr_uniform_location;
272*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat2x4_uniform_location;
273*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat3_arr_uniform_location;
274*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat3_uniform_location;
275*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat3x2_arr_uniform_location;
276*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat3x2_uniform_location;
277*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat3x4_arr_uniform_location;
278*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat3x4_uniform_location;
279*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat4_arr_uniform_location;
280*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat4_uniform_location;
281*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat4x2_arr_uniform_location;
282*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat4x2_uniform_location;
283*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat4x3_arr_uniform_location;
284*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dmat4x3_uniform_location;
285*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_double_arr_uniform_location;
286*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_double_uniform_location;
287*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dvec2_arr_uniform_location;
288*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dvec2_uniform_location;
289*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dvec3_arr_uniform_location;
290*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dvec3_uniform_location;
291*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dvec4_arr_uniform_location;
292*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_dvec4_uniform_location;
293*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_float_arr_uniform_location;
294*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_float_uniform_location;
295*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_int_arr_uniform_location;
296*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_int_uniform_location;
297*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_ivec2_arr_uniform_location;
298*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_ivec2_uniform_location;
299*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_ivec3_arr_uniform_location;
300*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_ivec3_uniform_location;
301*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_ivec4_arr_uniform_location;
302*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_ivec4_uniform_location;
303*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_sampler_uniform_location;
304*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uint_arr_uniform_location;
305*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uint_uniform_location;
306*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uvec2_arr_uniform_location;
307*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uvec2_uniform_location;
308*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uvec3_arr_uniform_location;
309*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uvec3_uniform_location;
310*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uvec4_arr_uniform_location;
311*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_uvec4_uniform_location;
312*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_vec2_arr_uniform_location;
313*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_vec2_uniform_location;
314*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_vec3_arr_uniform_location;
315*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_vec3_uniform_location;
316*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_vec4_arr_uniform_location;
317*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_vec4_uniform_location;
318*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_po_id;
319*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vs_id;
320*35238bceSAndroid Build Coastguard Worker };
321*35238bceSAndroid Build Coastguard Worker 
322*35238bceSAndroid Build Coastguard Worker /** Implements "Subtest 2" from CTS_ARB_gpu_shader_fp64, description follows:
323*35238bceSAndroid Build Coastguard Worker  *  Make sure that it is possible to use:
324*35238bceSAndroid Build Coastguard Worker  *
325*35238bceSAndroid Build Coastguard Worker  *  a) up to (GL_MAX_VERTEX_UNIFORM_COMPONENTS / 2) double uniforms
326*35238bceSAndroid Build Coastguard Worker  *    in a default uniform block of a vertex shader;
327*35238bceSAndroid Build Coastguard Worker  *  b) up to (GL_MAX_VERTEX_UNIFORM_COMPONENTS / 4) dvec2 uniforms
328*35238bceSAndroid Build Coastguard Worker  *    in a default uniform block of a vertex shader;
329*35238bceSAndroid Build Coastguard Worker  *  c) up to (GL_MAX_VERTEX_UNIFORM_COMPONENTS / 6) dvec3 uniforms
330*35238bceSAndroid Build Coastguard Worker  *    in a default uniform block of a vertex shader;
331*35238bceSAndroid Build Coastguard Worker  *  d) up to (GL_MAX_VERTEX_UNIFORM_COMPONENTS / 8) dvec4 uniforms
332*35238bceSAndroid Build Coastguard Worker  *    in a default uniform block of a vertex shader;
333*35238bceSAndroid Build Coastguard Worker  *  e) up to (GL_MAX_VERTEX_UNIFORM_COMPONENTS / 16) dmat2, dmat2x3,
334*35238bceSAndroid Build Coastguard Worker  *    dmat2x4, dmat3x2, dmat4x2 uniforms in a default uniform block
335*35238bceSAndroid Build Coastguard Worker  *    of a vertex shader; (each type tested in a separate shader)
336*35238bceSAndroid Build Coastguard Worker  *  f) up to (GL_MAX_VERTEX_UNIFORM_COMPONENTS / 24) dmat3, dmat3x4,
337*35238bceSAndroid Build Coastguard Worker  *    dmat4x3 uniforms in a default uniform block of a vertex shader;
338*35238bceSAndroid Build Coastguard Worker  *    (each type tested in a separate shader)
339*35238bceSAndroid Build Coastguard Worker  *  g) up to (GL_MAX_VERTEX_UNIFORM_COMPONENTS / 32) dmat4 uniforms
340*35238bceSAndroid Build Coastguard Worker  *    in a default uniform block of a vertex shader;
341*35238bceSAndroid Build Coastguard Worker  *  h) arrayed cases of a)-g), where the array size is 3 and the
342*35238bceSAndroid Build Coastguard Worker  *    amount of uniforms that can be supported should be divided
343*35238bceSAndroid Build Coastguard Worker  *    by three as well.
344*35238bceSAndroid Build Coastguard Worker  *  i) cases a)-h), where "vertex shader" is replaced by "fragment
345*35238bceSAndroid Build Coastguard Worker  *    shader" and GL_MAX_VERTEX_UNIFORM_COMPONENTS is changed to
346*35238bceSAndroid Build Coastguard Worker  *    GL_MAX_FRAGMENT_UNIFORM_COMPONENTS;
347*35238bceSAndroid Build Coastguard Worker  *  j) cases a)-h) where "vertex shader" is replaced by "geometry
348*35238bceSAndroid Build Coastguard Worker  *    shader" and GL_MAX_VERTEX_UNIFORM_COMPONENTS is changed to
349*35238bceSAndroid Build Coastguard Worker  *    GL_MAX_GEOMETRY_UNIFORM_COMPONENTS;
350*35238bceSAndroid Build Coastguard Worker  *  k) cases a)-h) where "vertex shader" is replaced by "compute
351*35238bceSAndroid Build Coastguard Worker  *    shader" and GL_MAX_VERTEX_UNIFORM_COMPONENTS is changed to
352*35238bceSAndroid Build Coastguard Worker  *    GL_MAX_COMPUTE_UNIFORM_COMPONENTS;
353*35238bceSAndroid Build Coastguard Worker  *  l) cases a)-h) where "vertex shader" is replaced by "tessellation
354*35238bceSAndroid Build Coastguard Worker  *    control shader" and GL_MAX_VERTEX_UNIFORM_COMPONENTS is changed
355*35238bceSAndroid Build Coastguard Worker  *    to GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS;
356*35238bceSAndroid Build Coastguard Worker  *  m) cases a)-h) where "vertex shader" is replaced by "tessellation
357*35238bceSAndroid Build Coastguard Worker  *    evaluation shader" and GL_MAX_VERTEX_UNIFORM_COMPONENTS is
358*35238bceSAndroid Build Coastguard Worker  *    changed to GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS;
359*35238bceSAndroid Build Coastguard Worker  *
360*35238bceSAndroid Build Coastguard Worker  *  For each case considered, the test should only define uniforms
361*35238bceSAndroid Build Coastguard Worker  *  for the stage the test is dealing with.
362*35238bceSAndroid Build Coastguard Worker  *
363*35238bceSAndroid Build Coastguard Worker  *  All uniform components considered as a whole should be assigned
364*35238bceSAndroid Build Coastguard Worker  *  unique values, where the very first uniform component is set to
365*35238bceSAndroid Build Coastguard Worker  *  a value of 1, the one following set to 2, the one afterward set
366*35238bceSAndroid Build Coastguard Worker  *  to 3, and so on.
367*35238bceSAndroid Build Coastguard Worker  *
368*35238bceSAndroid Build Coastguard Worker  *  For "vertex shader" cases, the test should work by creating
369*35238bceSAndroid Build Coastguard Worker  *  a program object, to which a vertex shader (as per test case)
370*35238bceSAndroid Build Coastguard Worker  *  would be attached. The shader would then read all the uniforms,
371*35238bceSAndroid Build Coastguard Worker  *  verify their values are correct and then set an output bool
372*35238bceSAndroid Build Coastguard Worker  *  variable to true if the validation passed, false otherwise.
373*35238bceSAndroid Build Coastguard Worker  *  The test should draw 1024 points, XFB the contents of the output
374*35238bceSAndroid Build Coastguard Worker  *  variable and verify the result.
375*35238bceSAndroid Build Coastguard Worker  *
376*35238bceSAndroid Build Coastguard Worker  *  For "geometry shader" cases, the test should create a program object
377*35238bceSAndroid Build Coastguard Worker  *  and attach vertex and geometry shaders to it. The vertex shader
378*35238bceSAndroid Build Coastguard Worker  *  should set gl_Position to (1, 0, 0, 1). The geometry shader
379*35238bceSAndroid Build Coastguard Worker  *  should accept points on input and emit 1 point, read all the
380*35238bceSAndroid Build Coastguard Worker  *  uniforms, verify their values are correct and then set an output
381*35238bceSAndroid Build Coastguard Worker  *  bool variable to true if the validation passed, false otherwise.
382*35238bceSAndroid Build Coastguard Worker  *  The test should draw 1024 points, XFB the contents of the output
383*35238bceSAndroid Build Coastguard Worker  *  variable and verify the result.
384*35238bceSAndroid Build Coastguard Worker  *
385*35238bceSAndroid Build Coastguard Worker  *  For "tessellation control shader" cases, the test should create
386*35238bceSAndroid Build Coastguard Worker  *  a program object and attach vertex and tessellation control shaders
387*35238bceSAndroid Build Coastguard Worker  *  to the program object. The vertex shader should set gl_Position
388*35238bceSAndroid Build Coastguard Worker  *  to (1, 0, 0, 1). The tessellation control shader should output
389*35238bceSAndroid Build Coastguard Worker  *  a single vertex per patch and set all inner/outer tessellation.
390*35238bceSAndroid Build Coastguard Worker  *  levels to 1. The shader should read all the uniforms, verify
391*35238bceSAndroid Build Coastguard Worker  *  their values are correct and then set an output per-vertex bool
392*35238bceSAndroid Build Coastguard Worker  *  variable to true if the validation passed, false otherwise. The
393*35238bceSAndroid Build Coastguard Worker  *  test should draw 1024 patches, XFB the contents of the output
394*35238bceSAndroid Build Coastguard Worker  *  variable and verify the result.
395*35238bceSAndroid Build Coastguard Worker  *
396*35238bceSAndroid Build Coastguard Worker  *  For "tessellation evaluation shader" cases, the test should create
397*35238bceSAndroid Build Coastguard Worker  *  a program object and attach vertex, tessellation control and
398*35238bceSAndroid Build Coastguard Worker  *  tessellation evaluation shaders to the program object. The vertex
399*35238bceSAndroid Build Coastguard Worker  *  shader should set gl_Position to (1, 0, 0, 1). The tessellation
400*35238bceSAndroid Build Coastguard Worker  *  control shader should behave as in "tessellation control shader"
401*35238bceSAndroid Build Coastguard Worker  *  case. The tessellation evaluation shader should accept isolines
402*35238bceSAndroid Build Coastguard Worker  *  and work in point mode. The shader should read all the uniforms,
403*35238bceSAndroid Build Coastguard Worker  *  verify their values are correct and then set an output
404*35238bceSAndroid Build Coastguard Worker  *  bool variable to true if the validation passed, false otherwise.
405*35238bceSAndroid Build Coastguard Worker  *  The test should draw 1024 patches, XFB the contents of the output
406*35238bceSAndroid Build Coastguard Worker  *  variable and verify the result.
407*35238bceSAndroid Build Coastguard Worker  *
408*35238bceSAndroid Build Coastguard Worker  *  For "fragment shader" cases, the test should create a program object
409*35238bceSAndroid Build Coastguard Worker  *  and attach vertex and fragment shaders to the program object. The
410*35238bceSAndroid Build Coastguard Worker  *  vertex shader should set gl_Position to 4 different values
411*35238bceSAndroid Build Coastguard Worker  *  (depending on gl_VertexID value), defining screen-space corners
412*35238bceSAndroid Build Coastguard Worker  *  for a GL_TRIANGLE_FAN-based draw call. The fragment shader should
413*35238bceSAndroid Build Coastguard Worker  *  read all the uniforms, verify their values are correct and then
414*35238bceSAndroid Build Coastguard Worker  *  set the output color to vec4(1) if the validation passed, vec4(0)
415*35238bceSAndroid Build Coastguard Worker  *  otherwise. The test should draw 4 vertices making up a triangle fan,
416*35238bceSAndroid Build Coastguard Worker  *  read the rasterized image and confirm the result.
417*35238bceSAndroid Build Coastguard Worker  *
418*35238bceSAndroid Build Coastguard Worker  *  For all cases apart from "fragment shader", the test should also
419*35238bceSAndroid Build Coastguard Worker  *  verify that glGetTransformFeedbackVarying() reports correct
420*35238bceSAndroid Build Coastguard Worker  *  properties for the uniforms.
421*35238bceSAndroid Build Coastguard Worker  *
422*35238bceSAndroid Build Coastguard Worker  *  The test should also verify that in all cases glGetActiveUniform()
423*35238bceSAndroid Build Coastguard Worker  *  reports correct properties for all the defined uniforms.
424*35238bceSAndroid Build Coastguard Worker  **/
425*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test2 : public deqp::TestCase
426*35238bceSAndroid Build Coastguard Worker {
427*35238bceSAndroid Build Coastguard Worker public:
428*35238bceSAndroid Build Coastguard Worker     /* Public methods */
429*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test2(deqp::Context &context);
430*35238bceSAndroid Build Coastguard Worker 
431*35238bceSAndroid Build Coastguard Worker     virtual void deinit();
432*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
433*35238bceSAndroid Build Coastguard Worker 
434*35238bceSAndroid Build Coastguard Worker private:
435*35238bceSAndroid Build Coastguard Worker     /* Private types */
436*35238bceSAndroid Build Coastguard Worker     typedef glw::GLint captured_varying_type;
437*35238bceSAndroid Build Coastguard Worker     typedef void(GLW_APIENTRY *arbDispatchComputeFunc)(glw::GLuint num_groups_x, glw::GLuint num_groups_y,
438*35238bceSAndroid Build Coastguard Worker                                                        glw::GLuint num_groups_z);
439*35238bceSAndroid Build Coastguard Worker 
440*35238bceSAndroid Build Coastguard Worker     /** Shader stage enumeration
441*35238bceSAndroid Build Coastguard Worker      *
442*35238bceSAndroid Build Coastguard Worker      */
443*35238bceSAndroid Build Coastguard Worker     enum shaderStage
444*35238bceSAndroid Build Coastguard Worker     {
445*35238bceSAndroid Build Coastguard Worker         COMPUTE_SHADER,
446*35238bceSAndroid Build Coastguard Worker         FRAGMENT_SHADER,
447*35238bceSAndroid Build Coastguard Worker         GEOMETRY_SHADER,
448*35238bceSAndroid Build Coastguard Worker         TESS_CTRL_SHADER,
449*35238bceSAndroid Build Coastguard Worker         TESS_EVAL_SHADER,
450*35238bceSAndroid Build Coastguard Worker         VERTEX_SHADER,
451*35238bceSAndroid Build Coastguard Worker     };
452*35238bceSAndroid Build Coastguard Worker 
453*35238bceSAndroid Build Coastguard Worker     /** Store details about uniform type
454*35238bceSAndroid Build Coastguard Worker      *
455*35238bceSAndroid Build Coastguard Worker      **/
456*35238bceSAndroid Build Coastguard Worker     struct uniformTypeDetails
457*35238bceSAndroid Build Coastguard Worker     {
458*35238bceSAndroid Build Coastguard Worker         uniformTypeDetails(glw::GLuint n_columns, glw::GLuint n_rows);
459*35238bceSAndroid Build Coastguard Worker 
460*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_n_columns;
461*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_n_rows;
462*35238bceSAndroid Build Coastguard Worker         glw::GLenum m_type;
463*35238bceSAndroid Build Coastguard Worker         std::string m_type_name;
464*35238bceSAndroid Build Coastguard Worker     };
465*35238bceSAndroid Build Coastguard Worker 
466*35238bceSAndroid Build Coastguard Worker     /** Store details about uniform
467*35238bceSAndroid Build Coastguard Worker      *
468*35238bceSAndroid Build Coastguard Worker      **/
469*35238bceSAndroid Build Coastguard Worker     struct uniformDetails
470*35238bceSAndroid Build Coastguard Worker     {
471*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_array_stride;
472*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_matrix_stride;
473*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_offset;
474*35238bceSAndroid Build Coastguard Worker     };
475*35238bceSAndroid Build Coastguard Worker 
476*35238bceSAndroid Build Coastguard Worker     /* Provate methods */
477*35238bceSAndroid Build Coastguard Worker     glw::GLenum getCapturedPrimitiveType(shaderStage shader_stage) const;
478*35238bceSAndroid Build Coastguard Worker     glw::GLenum getDrawPrimitiveType(shaderStage shader_stage) const;
479*35238bceSAndroid Build Coastguard Worker     glw::GLuint getMaxUniformComponents(shaderStage shader_stage) const;
480*35238bceSAndroid Build Coastguard Worker     glw::GLuint getMaxUniformBlockSize() const;
481*35238bceSAndroid Build Coastguard Worker     glw::GLuint getRequiredComponentsNumber(const uniformTypeDetails &uniform_type) const;
482*35238bceSAndroid Build Coastguard Worker     glw::GLuint getUniformTypeMemberSize(const uniformTypeDetails &uniform_type) const;
483*35238bceSAndroid Build Coastguard Worker     glw::GLuint getAmountUniforms(shaderStage shader_stage, const uniformTypeDetails &uniform_type) const;
484*35238bceSAndroid Build Coastguard Worker     const glw::GLchar *getShaderStageName(shaderStage shader_stage) const;
485*35238bceSAndroid Build Coastguard Worker 
486*35238bceSAndroid Build Coastguard Worker     void inspectProgram(glw::GLuint program_id, glw::GLint n_uniforms, const uniformTypeDetails &uniform_type,
487*35238bceSAndroid Build Coastguard Worker                         glw::GLint &out_buffer_size, uniformDetails &out_offsets,
488*35238bceSAndroid Build Coastguard Worker                         glw::GLuint &uniform_block_index) const;
489*35238bceSAndroid Build Coastguard Worker 
490*35238bceSAndroid Build Coastguard Worker     void prepareBoilerplateShader(const glw::GLchar *stage_specific_layout, const glw::GLchar *stage_specific_main_body,
491*35238bceSAndroid Build Coastguard Worker                                   std::string &out_source_code) const;
492*35238bceSAndroid Build Coastguard Worker 
493*35238bceSAndroid Build Coastguard Worker     void prepareProgram(shaderStage shader_stage, const uniformTypeDetails &uniform_type,
494*35238bceSAndroid Build Coastguard Worker                         Utils::programInfo &out_program_info) const;
495*35238bceSAndroid Build Coastguard Worker 
496*35238bceSAndroid Build Coastguard Worker     void prepareShaderStages();
497*35238bceSAndroid Build Coastguard Worker 
498*35238bceSAndroid Build Coastguard Worker     void prepareTestShader(const glw::GLchar *stage_specific_layout, const glw::GLchar *uniform_definitions,
499*35238bceSAndroid Build Coastguard Worker                            const glw::GLchar *in_variable_definitions, const glw::GLchar *out_variable_definitions,
500*35238bceSAndroid Build Coastguard Worker                            const glw::GLchar *uniform_verification, const glw::GLchar *stage_specific_main_body,
501*35238bceSAndroid Build Coastguard Worker                            std::string &out_source_code) const;
502*35238bceSAndroid Build Coastguard Worker 
503*35238bceSAndroid Build Coastguard Worker     void prepareTestComputeShader(const glw::GLchar *uniform_definitions, const glw::GLchar *uniform_verification,
504*35238bceSAndroid Build Coastguard Worker                                   std::string &out_source_code) const;
505*35238bceSAndroid Build Coastguard Worker 
506*35238bceSAndroid Build Coastguard Worker     void prepareUniformDefinitions(shaderStage shader_stage, const uniformTypeDetails &uniform_type,
507*35238bceSAndroid Build Coastguard Worker                                    std::string &out_source_code) const;
508*35238bceSAndroid Build Coastguard Worker 
509*35238bceSAndroid Build Coastguard Worker     void prepareUniforms(shaderStage shader_stage, const uniformTypeDetails &uniform_type,
510*35238bceSAndroid Build Coastguard Worker                          const Utils::programInfo &program_info) const;
511*35238bceSAndroid Build Coastguard Worker 
512*35238bceSAndroid Build Coastguard Worker     void prepareUniformTypes();
513*35238bceSAndroid Build Coastguard Worker 
514*35238bceSAndroid Build Coastguard Worker     void prepareUniformVerification(shaderStage shader_stage, const uniformTypeDetails &uniform_type,
515*35238bceSAndroid Build Coastguard Worker                                     std::string &out_source_code) const;
516*35238bceSAndroid Build Coastguard Worker 
517*35238bceSAndroid Build Coastguard Worker     bool test(shaderStage shader_stage, const uniformTypeDetails &uniform_type) const;
518*35238bceSAndroid Build Coastguard Worker 
519*35238bceSAndroid Build Coastguard Worker     void testBegin(glw::GLuint program_id, shaderStage shader_stage) const;
520*35238bceSAndroid Build Coastguard Worker 
521*35238bceSAndroid Build Coastguard Worker     void testEnd(shaderStage shader_stage) const;
522*35238bceSAndroid Build Coastguard Worker     void testInit();
523*35238bceSAndroid Build Coastguard Worker     bool verifyResults(shaderStage shader_stage) const;
524*35238bceSAndroid Build Coastguard Worker 
525*35238bceSAndroid Build Coastguard Worker     /* Private constants */
526*35238bceSAndroid Build Coastguard Worker     static const glw::GLuint m_n_captured_results;
527*35238bceSAndroid Build Coastguard Worker     static const glw::GLint m_result_failure;
528*35238bceSAndroid Build Coastguard Worker     static const glw::GLint m_result_success;
529*35238bceSAndroid Build Coastguard Worker     static const glw::GLuint m_texture_width;
530*35238bceSAndroid Build Coastguard Worker     static const glw::GLuint m_texture_height;
531*35238bceSAndroid Build Coastguard Worker     static const glw::GLuint m_transform_feedback_buffer_size;
532*35238bceSAndroid Build Coastguard Worker 
533*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_uniform_block_name;
534*35238bceSAndroid Build Coastguard Worker 
535*35238bceSAndroid Build Coastguard Worker     static const glw::GLenum ARB_MAX_COMPUTE_UNIFORM_COMPONENTS;
536*35238bceSAndroid Build Coastguard Worker 
537*35238bceSAndroid Build Coastguard Worker     /* Private fields */
538*35238bceSAndroid Build Coastguard Worker     arbDispatchComputeFunc m_pDispatchCompute;
539*35238bceSAndroid Build Coastguard Worker 
540*35238bceSAndroid Build Coastguard Worker     std::vector<shaderStage> m_shader_stages;
541*35238bceSAndroid Build Coastguard Worker     std::vector<uniformTypeDetails> m_uniform_types;
542*35238bceSAndroid Build Coastguard Worker 
543*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_framebuffer_id;
544*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_texture_id;
545*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_transform_feedback_buffer_id;
546*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_uniform_buffer_id;
547*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vertex_array_object_id;
548*35238bceSAndroid Build Coastguard Worker };
549*35238bceSAndroid Build Coastguard Worker 
550*35238bceSAndroid Build Coastguard Worker /** Implements "Subtest 3" from CTS_ARB_gpu_shader_fp64, description follows:
551*35238bceSAndroid Build Coastguard Worker  *
552*35238bceSAndroid Build Coastguard Worker  *  Make sure it is possible to use new types for member declaration
553*35238bceSAndroid Build Coastguard Worker  *  in a named uniform block.
554*35238bceSAndroid Build Coastguard Worker  *  The following members should be defined in the block:
555*35238bceSAndroid Build Coastguard Worker  *
556*35238bceSAndroid Build Coastguard Worker  *  ivec3   unused1[3];
557*35238bceSAndroid Build Coastguard Worker  *  double  double_value;
558*35238bceSAndroid Build Coastguard Worker  *  bool    unused2;
559*35238bceSAndroid Build Coastguard Worker  *  dvec2   dvec2_value;
560*35238bceSAndroid Build Coastguard Worker  *  bvec3   unused3;
561*35238bceSAndroid Build Coastguard Worker  *  dvec3   dvec3_value;
562*35238bceSAndroid Build Coastguard Worker  *  int     unused4[3];
563*35238bceSAndroid Build Coastguard Worker  *  dvec4   dvec4_value;
564*35238bceSAndroid Build Coastguard Worker  *  bool    unused5;
565*35238bceSAndroid Build Coastguard Worker  *  bool    unused6[2];
566*35238bceSAndroid Build Coastguard Worker  *  dmat2   dmat2_value;
567*35238bceSAndroid Build Coastguard Worker  *  dmat3   dmat3_value;
568*35238bceSAndroid Build Coastguard Worker  *  bool    unused7;
569*35238bceSAndroid Build Coastguard Worker  *  dmat4   dmat4_value;
570*35238bceSAndroid Build Coastguard Worker  *  dmat2x3 dmat2x3_value;
571*35238bceSAndroid Build Coastguard Worker  *  uvec3   unused8;
572*35238bceSAndroid Build Coastguard Worker  *  dmat2x4 dmat2x4_value;
573*35238bceSAndroid Build Coastguard Worker  *  dmat3x2 dmat3x2_value;
574*35238bceSAndroid Build Coastguard Worker  *  bool    unused9;
575*35238bceSAndroid Build Coastguard Worker  *  dmat3x4 dmat3x4_value;
576*35238bceSAndroid Build Coastguard Worker  *  int     unused10;
577*35238bceSAndroid Build Coastguard Worker  *  dmat4x2 dmat4x2_value;
578*35238bceSAndroid Build Coastguard Worker  *  dmat4x3 dmat4x3_value;
579*35238bceSAndroid Build Coastguard Worker  *
580*35238bceSAndroid Build Coastguard Worker  *  std140, packed and shared layout qualifiers should be tested
581*35238bceSAndroid Build Coastguard Worker  *  separately.
582*35238bceSAndroid Build Coastguard Worker  *
583*35238bceSAndroid Build Coastguard Worker  *  For the purpose of the test, a buffer object, storage of which
584*35238bceSAndroid Build Coastguard Worker  *  is to be used for the uniform buffer, should be filled with
585*35238bceSAndroid Build Coastguard Worker  *  predefined values at member-specific offsets. These values
586*35238bceSAndroid Build Coastguard Worker  *  should then be read in each shader stage covered by the test
587*35238bceSAndroid Build Coastguard Worker  *  and verified.
588*35238bceSAndroid Build Coastguard Worker  *
589*35238bceSAndroid Build Coastguard Worker  *  For std140 layout qualifier, the test should additionally verify
590*35238bceSAndroid Build Coastguard Worker  *  the offsets assigned by GL implementation are as per specification.
591*35238bceSAndroid Build Coastguard Worker  *
592*35238bceSAndroid Build Coastguard Worker  *  The following shader stages should be defined for a program object
593*35238bceSAndroid Build Coastguard Worker  *  to be used by the test:
594*35238bceSAndroid Build Coastguard Worker  *
595*35238bceSAndroid Build Coastguard Worker  *  1) Vertex shader stage;
596*35238bceSAndroid Build Coastguard Worker  *  2) Geometry shader stage;
597*35238bceSAndroid Build Coastguard Worker  *  3) Tessellation control shader stage;
598*35238bceSAndroid Build Coastguard Worker  *  4) Tessellation evaluation shader stage;
599*35238bceSAndroid Build Coastguard Worker  *  5) Fragment shader stage;
600*35238bceSAndroid Build Coastguard Worker  *
601*35238bceSAndroid Build Coastguard Worker  *  Vertex shader stage should set a stage-specific bool variable to
602*35238bceSAndroid Build Coastguard Worker  *  true if all uniform buffer members are assigned valid values,
603*35238bceSAndroid Build Coastguard Worker  *  false otherwise.
604*35238bceSAndroid Build Coastguard Worker  *
605*35238bceSAndroid Build Coastguard Worker  *  Geometry shader stage should take points on input and emit a single
606*35238bceSAndroid Build Coastguard Worker  *  point. Similarly to vertex shader stage, it should set a stage-specific
607*35238bceSAndroid Build Coastguard Worker  *  bool variable to true, if all uniform buffer members are determined
608*35238bceSAndroid Build Coastguard Worker  *  to expose valid values, false otherwise.
609*35238bceSAndroid Build Coastguard Worker  *  Geometry shader stage should pass the result value from the vertex
610*35238bceSAndroid Build Coastguard Worker  *  shader stage down the rendering pipeline using a new output variable,
611*35238bceSAndroid Build Coastguard Worker  *  set to the value of the variable exposed by vertex shader stage.
612*35238bceSAndroid Build Coastguard Worker  *
613*35238bceSAndroid Build Coastguard Worker  *  Tessellation control shader stage should set all inner/outer
614*35238bceSAndroid Build Coastguard Worker  *  tessellation levels to 1 and output 1 vertex per patch.
615*35238bceSAndroid Build Coastguard Worker  *  The verification should be carried out as in previous stages.
616*35238bceSAndroid Build Coastguard Worker  *  TC shader stage should also define stage-specific output variables
617*35238bceSAndroid Build Coastguard Worker  *  for vertex and geometry shader stages and set them to relevant
618*35238bceSAndroid Build Coastguard Worker  *  values, similar to what's been described for geometry shader stage.
619*35238bceSAndroid Build Coastguard Worker  *
620*35238bceSAndroid Build Coastguard Worker  *  Tessellation evaluation shader stage should take quads on
621*35238bceSAndroid Build Coastguard Worker  *  input. It should be constructed in a way that will make it
622*35238bceSAndroid Build Coastguard Worker  *  generate a quad that occupies whole screen-space. This is necessary
623*35238bceSAndroid Build Coastguard Worker  *  to perform validation of the input variables in fragment shader
624*35238bceSAndroid Build Coastguard Worker  *  stage.
625*35238bceSAndroid Build Coastguard Worker  *  The verification should be carried out as in previous stages.
626*35238bceSAndroid Build Coastguard Worker  *  TE stage should pass down validation results from previous stages
627*35238bceSAndroid Build Coastguard Worker  *  in a similar manner as was described for TC shader stage.
628*35238bceSAndroid Build Coastguard Worker  *
629*35238bceSAndroid Build Coastguard Worker  *  Fragment shader stage should verify all the uniform buffer members
630*35238bceSAndroid Build Coastguard Worker  *  carry valid values. Upon success, it should output vec4(1) to the
631*35238bceSAndroid Build Coastguard Worker  *  only output variable. Otherwise, it should set it to vec4(0).
632*35238bceSAndroid Build Coastguard Worker  *
633*35238bceSAndroid Build Coastguard Worker  *  XFB should be used to read all the output variables defined in TE
634*35238bceSAndroid Build Coastguard Worker  *  stage that carry result information from all the rendering stages
635*35238bceSAndroid Build Coastguard Worker  *  until tessellation evaluation shader stage. The test passes, if
636*35238bceSAndroid Build Coastguard Worker  *  all result values are set to true and the draw buffer is filled
637*35238bceSAndroid Build Coastguard Worker  *  with vec4(1).
638*35238bceSAndroid Build Coastguard Worker  **/
639*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test3 : public deqp::TestCase
640*35238bceSAndroid Build Coastguard Worker {
641*35238bceSAndroid Build Coastguard Worker public:
642*35238bceSAndroid Build Coastguard Worker     /* Public methods */
643*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test3(deqp::Context &);
~GPUShaderFP64Test3()644*35238bceSAndroid Build Coastguard Worker     virtual ~GPUShaderFP64Test3()
645*35238bceSAndroid Build Coastguard Worker     {
646*35238bceSAndroid Build Coastguard Worker     }
647*35238bceSAndroid Build Coastguard Worker 
648*35238bceSAndroid Build Coastguard Worker     /* Public methods inherited from TestCase */
649*35238bceSAndroid Build Coastguard Worker     virtual void deinit(void);
650*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate(void);
651*35238bceSAndroid Build Coastguard Worker 
652*35238bceSAndroid Build Coastguard Worker private:
653*35238bceSAndroid Build Coastguard Worker     /* Private types */
654*35238bceSAndroid Build Coastguard Worker 
655*35238bceSAndroid Build Coastguard Worker     /** Enumerate shader stages
656*35238bceSAndroid Build Coastguard Worker      *
657*35238bceSAndroid Build Coastguard Worker      **/
658*35238bceSAndroid Build Coastguard Worker     enum shaderStage
659*35238bceSAndroid Build Coastguard Worker     {
660*35238bceSAndroid Build Coastguard Worker         FRAGMENT_SHADER,
661*35238bceSAndroid Build Coastguard Worker         GEOMETRY_SHADER,
662*35238bceSAndroid Build Coastguard Worker         TESS_CONTROL_SHADER,
663*35238bceSAndroid Build Coastguard Worker         TESS_EVAL_SHADER,
664*35238bceSAndroid Build Coastguard Worker         VERTEX_SHADER,
665*35238bceSAndroid Build Coastguard Worker     };
666*35238bceSAndroid Build Coastguard Worker 
667*35238bceSAndroid Build Coastguard Worker     /** Enumerate buffer data layouts
668*35238bceSAndroid Build Coastguard Worker      *
669*35238bceSAndroid Build Coastguard Worker      **/
670*35238bceSAndroid Build Coastguard Worker     enum uniformDataLayout
671*35238bceSAndroid Build Coastguard Worker     {
672*35238bceSAndroid Build Coastguard Worker         PACKED,
673*35238bceSAndroid Build Coastguard Worker         SHARED,
674*35238bceSAndroid Build Coastguard Worker         STD140,
675*35238bceSAndroid Build Coastguard Worker     };
676*35238bceSAndroid Build Coastguard Worker 
677*35238bceSAndroid Build Coastguard Worker     /** Store details about "double precision" uniforms
678*35238bceSAndroid Build Coastguard Worker      *
679*35238bceSAndroid Build Coastguard Worker      **/
680*35238bceSAndroid Build Coastguard Worker     struct uniformDetails
681*35238bceSAndroid Build Coastguard Worker     {
uniformDetailsgl4cts::GPUShaderFP64Test3::uniformDetails682*35238bceSAndroid Build Coastguard Worker         uniformDetails(glw::GLint expected_std140_offset, const glw::GLchar *name, glw::GLuint n_columns,
683*35238bceSAndroid Build Coastguard Worker                        glw::GLuint n_elements, const glw::GLchar *type_name)
684*35238bceSAndroid Build Coastguard Worker             : m_expected_std140_offset(expected_std140_offset)
685*35238bceSAndroid Build Coastguard Worker             , m_name(name)
686*35238bceSAndroid Build Coastguard Worker             , m_n_columns(n_columns)
687*35238bceSAndroid Build Coastguard Worker             , m_n_elements(n_elements)
688*35238bceSAndroid Build Coastguard Worker             , m_type_name(type_name)
689*35238bceSAndroid Build Coastguard Worker         {
690*35238bceSAndroid Build Coastguard Worker             /* Nothing to be done */
691*35238bceSAndroid Build Coastguard Worker         }
692*35238bceSAndroid Build Coastguard Worker 
693*35238bceSAndroid Build Coastguard Worker         glw::GLint m_expected_std140_offset;
694*35238bceSAndroid Build Coastguard Worker         const glw::GLchar *m_name;
695*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_n_columns;
696*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_n_elements;
697*35238bceSAndroid Build Coastguard Worker         const glw::GLchar *m_type_name;
698*35238bceSAndroid Build Coastguard Worker     };
699*35238bceSAndroid Build Coastguard Worker 
700*35238bceSAndroid Build Coastguard Worker     /** Store details about program object
701*35238bceSAndroid Build Coastguard Worker      *
702*35238bceSAndroid Build Coastguard Worker      **/
703*35238bceSAndroid Build Coastguard Worker     struct programInfo
704*35238bceSAndroid Build Coastguard Worker     {
705*35238bceSAndroid Build Coastguard Worker 
706*35238bceSAndroid Build Coastguard Worker         programInfo();
707*35238bceSAndroid Build Coastguard Worker 
708*35238bceSAndroid Build Coastguard Worker         void compile(deqp::Context &context, glw::GLuint shader_id, const glw::GLchar *shader_code) const;
709*35238bceSAndroid Build Coastguard Worker 
710*35238bceSAndroid Build Coastguard Worker         void deinit(deqp::Context &context);
711*35238bceSAndroid Build Coastguard Worker 
712*35238bceSAndroid Build Coastguard Worker         void init(deqp::Context &context, const std::vector<uniformDetails> m_uniform_details,
713*35238bceSAndroid Build Coastguard Worker                   const glw::GLchar *fragment_shader_code, const glw::GLchar *geometry_shader_code,
714*35238bceSAndroid Build Coastguard Worker                   const glw::GLchar *tesselation_control_shader_code,
715*35238bceSAndroid Build Coastguard Worker                   const glw::GLchar *tesselation_evaluation_shader_code, const glw::GLchar *vertex_shader_code);
716*35238bceSAndroid Build Coastguard Worker 
717*35238bceSAndroid Build Coastguard Worker         void link(deqp::Context &context) const;
718*35238bceSAndroid Build Coastguard Worker 
719*35238bceSAndroid Build Coastguard Worker         static const glw::GLint m_invalid_uniform_offset;
720*35238bceSAndroid Build Coastguard Worker         static const glw::GLint m_invalid_uniform_matrix_stride;
721*35238bceSAndroid Build Coastguard Worker         static const glw::GLint m_non_matrix_uniform_matrix_stride;
722*35238bceSAndroid Build Coastguard Worker 
723*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_fragment_shader_id;
724*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_geometry_shader_id;
725*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_program_object_id;
726*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_tesselation_control_shader_id;
727*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_tesselation_evaluation_shader_id;
728*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_vertex_shader_id;
729*35238bceSAndroid Build Coastguard Worker 
730*35238bceSAndroid Build Coastguard Worker         glw::GLint m_buffer_size;
731*35238bceSAndroid Build Coastguard Worker         glw::GLuint m_uniform_block_index;
732*35238bceSAndroid Build Coastguard Worker 
733*35238bceSAndroid Build Coastguard Worker         std::vector<glw::GLint> m_uniform_offsets;
734*35238bceSAndroid Build Coastguard Worker         std::vector<glw::GLint> m_uniform_matrix_strides;
735*35238bceSAndroid Build Coastguard Worker     };
736*35238bceSAndroid Build Coastguard Worker 
737*35238bceSAndroid Build Coastguard Worker     /* Private methods */
738*35238bceSAndroid Build Coastguard Worker     glw::GLdouble getExpectedValue(glw::GLuint type_ordinal, glw::GLuint element) const;
739*35238bceSAndroid Build Coastguard Worker     const programInfo &getProgramInfo(uniformDataLayout uniform_data_layout) const;
740*35238bceSAndroid Build Coastguard Worker     const glw::GLchar *getUniformLayoutName(uniformDataLayout uniform_data_layout) const;
741*35238bceSAndroid Build Coastguard Worker 
742*35238bceSAndroid Build Coastguard Worker     void prepareProgram(programInfo &program_info, uniformDataLayout uniform_data_layout) const;
743*35238bceSAndroid Build Coastguard Worker 
744*35238bceSAndroid Build Coastguard Worker     bool prepareUniformBuffer(const programInfo &program_info, bool verify_offsets) const;
745*35238bceSAndroid Build Coastguard Worker 
746*35238bceSAndroid Build Coastguard Worker     void testInit();
747*35238bceSAndroid Build Coastguard Worker     bool test(uniformDataLayout uniform_data_layout) const;
748*35238bceSAndroid Build Coastguard Worker     bool verifyResults() const;
749*35238bceSAndroid Build Coastguard Worker 
750*35238bceSAndroid Build Coastguard Worker     void writeMainBody(std::ostream &stream, shaderStage shader_stage) const;
751*35238bceSAndroid Build Coastguard Worker 
752*35238bceSAndroid Build Coastguard Worker     void writePreamble(std::ostream &stream, shaderStage shader_stage) const;
753*35238bceSAndroid Build Coastguard Worker 
754*35238bceSAndroid Build Coastguard Worker     void writeUniformBlock(std::ostream &stream, uniformDataLayout uniform_data_layout) const;
755*35238bceSAndroid Build Coastguard Worker 
756*35238bceSAndroid Build Coastguard Worker     void writeVaryingDeclarations(std::ostream &stream, shaderStage shader_stage) const;
757*35238bceSAndroid Build Coastguard Worker 
758*35238bceSAndroid Build Coastguard Worker     void writeVaryingPassthrough(std::ostream &stream, shaderStage shader_stage) const;
759*35238bceSAndroid Build Coastguard Worker 
760*35238bceSAndroid Build Coastguard Worker     /* Private fields */
761*35238bceSAndroid Build Coastguard Worker     /* Constants */
762*35238bceSAndroid Build Coastguard Worker     static const glw::GLuint m_result_failure;
763*35238bceSAndroid Build Coastguard Worker     static const glw::GLuint m_result_success;
764*35238bceSAndroid Build Coastguard Worker 
765*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_uniform_block_name;
766*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_uniform_block_instance_name;
767*35238bceSAndroid Build Coastguard Worker 
768*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_fs_out_fs_result;
769*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_gs_fs_gs_result;
770*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_gs_fs_tcs_result;
771*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_gs_fs_tes_result;
772*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_gs_fs_vs_result;
773*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_tcs_tes_tcs_result;
774*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_tcs_tes_vs_result;
775*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_tes_gs_tcs_result;
776*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_tes_gs_tes_result;
777*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_tes_gs_vs_result;
778*35238bceSAndroid Build Coastguard Worker     static const glw::GLchar *m_varying_name_vs_tcs_vs_result;
779*35238bceSAndroid Build Coastguard Worker 
780*35238bceSAndroid Build Coastguard Worker     /* GL objects */
781*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_color_texture_id;
782*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_framebuffer_id;
783*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_transform_feedback_buffer_id;
784*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_uniform_buffer_id;
785*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vertex_array_object_id;
786*35238bceSAndroid Build Coastguard Worker 
787*35238bceSAndroid Build Coastguard Worker     /* Random values used by getExpectedValue */
788*35238bceSAndroid Build Coastguard Worker     glw::GLdouble m_base_element;
789*35238bceSAndroid Build Coastguard Worker     glw::GLdouble m_base_type_ordinal;
790*35238bceSAndroid Build Coastguard Worker 
791*35238bceSAndroid Build Coastguard Worker     /* Program details, one per data layout */
792*35238bceSAndroid Build Coastguard Worker     programInfo m_packed_program;
793*35238bceSAndroid Build Coastguard Worker     programInfo m_shared_program;
794*35238bceSAndroid Build Coastguard Worker     programInfo m_std140_program;
795*35238bceSAndroid Build Coastguard Worker 
796*35238bceSAndroid Build Coastguard Worker     /* Storage for uniforms' details */
797*35238bceSAndroid Build Coastguard Worker     std::vector<uniformDetails> m_uniform_details;
798*35238bceSAndroid Build Coastguard Worker };
799*35238bceSAndroid Build Coastguard Worker 
800*35238bceSAndroid Build Coastguard Worker /** Make sure glGetUniformdv() reports correct values, as assigned
801*35238bceSAndroid Build Coastguard Worker  *  by corresponding glUniform*() functions, for the following
802*35238bceSAndroid Build Coastguard Worker  *  uniform types:
803*35238bceSAndroid Build Coastguard Worker  *
804*35238bceSAndroid Build Coastguard Worker  *  a) double;
805*35238bceSAndroid Build Coastguard Worker  *  b) dvec2;
806*35238bceSAndroid Build Coastguard Worker  *  c) dvec3;
807*35238bceSAndroid Build Coastguard Worker  *  d) dvec4;
808*35238bceSAndroid Build Coastguard Worker  *  e) Arrays of a)-d);
809*35238bceSAndroid Build Coastguard Worker  *  f) a)-d) defined in single-dimensional arrays built of the same
810*35238bceSAndroid Build Coastguard Worker  *     structure.
811*35238bceSAndroid Build Coastguard Worker  *
812*35238bceSAndroid Build Coastguard Worker  *  These uniforms should be defined in the default uniform block,
813*35238bceSAndroid Build Coastguard Worker  *  separately in each stage defined for the following program
814*35238bceSAndroid Build Coastguard Worker  *  objects:
815*35238bceSAndroid Build Coastguard Worker  *
816*35238bceSAndroid Build Coastguard Worker  *  a) A program object consisting of a fragment, geometry, tessellation
817*35238bceSAndroid Build Coastguard Worker  *     control, tessellation evaluation, vertex shader stages.
818*35238bceSAndroid Build Coastguard Worker  *  b) A program object consisting of a compute shader stage.
819*35238bceSAndroid Build Coastguard Worker  *
820*35238bceSAndroid Build Coastguard Worker  *  If GL_ARB_program_interface_query is supported, the test should
821*35238bceSAndroid Build Coastguard Worker  *  also verify that the following API functions work correctly with
822*35238bceSAndroid Build Coastguard Worker  *  the described uniforms:
823*35238bceSAndroid Build Coastguard Worker  *
824*35238bceSAndroid Build Coastguard Worker  *  - glGetProgramResourceiv()    (query GL_TYPE and GL_ARRAY_SIZE
825*35238bceSAndroid Build Coastguard Worker  *                                 properties of GL_UNIFORM interface
826*35238bceSAndroid Build Coastguard Worker  *                                 for all uniforms);
827*35238bceSAndroid Build Coastguard Worker  *  - glGetProgramResourceIndex() (use GL_UNIFORM interface)
828*35238bceSAndroid Build Coastguard Worker  *  - glGetProgramResourceName()  (use GL_UNIFORM interface)
829*35238bceSAndroid Build Coastguard Worker  *
830*35238bceSAndroid Build Coastguard Worker  *  To verify the values returned by these functions, values returned
831*35238bceSAndroid Build Coastguard Worker  *  by relevant glGetUniform*() API functions should be used as
832*35238bceSAndroid Build Coastguard Worker  *  reference.
833*35238bceSAndroid Build Coastguard Worker  */
834*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test4 : public deqp::TestCase
835*35238bceSAndroid Build Coastguard Worker {
836*35238bceSAndroid Build Coastguard Worker public:
837*35238bceSAndroid Build Coastguard Worker     /* Public methods */
838*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test4(deqp::Context &context);
839*35238bceSAndroid Build Coastguard Worker 
840*35238bceSAndroid Build Coastguard Worker     virtual void deinit();
841*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
842*35238bceSAndroid Build Coastguard Worker 
843*35238bceSAndroid Build Coastguard Worker private:
844*35238bceSAndroid Build Coastguard Worker     /* Private type definitions */
845*35238bceSAndroid Build Coastguard Worker     /* Defines a type used as a data container for one of the test cases */
846*35238bceSAndroid Build Coastguard Worker     typedef std::pair<glw::GLint /* uniform location */, double * /* value(s) assigned */> uniform_value_pair;
847*35238bceSAndroid Build Coastguard Worker 
848*35238bceSAndroid Build Coastguard Worker     /* Holds uniform locations & associated values. used by one of the test cases */
849*35238bceSAndroid Build Coastguard Worker     struct _data
850*35238bceSAndroid Build Coastguard Worker     {
851*35238bceSAndroid Build Coastguard Worker         _data();
852*35238bceSAndroid Build Coastguard Worker 
853*35238bceSAndroid Build Coastguard Worker         double uniform_double;
854*35238bceSAndroid Build Coastguard Worker         double uniform_double_arr[2];
855*35238bceSAndroid Build Coastguard Worker         double uniform_dvec2[2];
856*35238bceSAndroid Build Coastguard Worker         double uniform_dvec2_arr[4];
857*35238bceSAndroid Build Coastguard Worker         double uniform_dvec3[3];
858*35238bceSAndroid Build Coastguard Worker         double uniform_dvec3_arr[6];
859*35238bceSAndroid Build Coastguard Worker         double uniform_dvec4[4];
860*35238bceSAndroid Build Coastguard Worker         double uniform_dvec4_arr[8];
861*35238bceSAndroid Build Coastguard Worker 
862*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_double;
863*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_double_arr[2];
864*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_dvec2;
865*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_dvec2_arr[2];
866*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_dvec3;
867*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_dvec3_arr[2];
868*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_dvec4;
869*35238bceSAndroid Build Coastguard Worker         glw::GLint uniform_location_dvec4_arr[2];
870*35238bceSAndroid Build Coastguard Worker     };
871*35238bceSAndroid Build Coastguard Worker 
872*35238bceSAndroid Build Coastguard Worker     /** Holds uniform location & properties information. Used by one of the test cases. */
873*35238bceSAndroid Build Coastguard Worker     struct _program_interface_query_test_item
874*35238bceSAndroid Build Coastguard Worker     {
875*35238bceSAndroid Build Coastguard Worker         glw::GLint expected_array_size;
876*35238bceSAndroid Build Coastguard Worker         std::string name;
877*35238bceSAndroid Build Coastguard Worker         glw::GLenum expected_type;
878*35238bceSAndroid Build Coastguard Worker         glw::GLint location;
879*35238bceSAndroid Build Coastguard Worker     };
880*35238bceSAndroid Build Coastguard Worker 
881*35238bceSAndroid Build Coastguard Worker     /** Holds information on all uniforms defined for a single shader stage. */
882*35238bceSAndroid Build Coastguard Worker     struct _stage_data
883*35238bceSAndroid Build Coastguard Worker     {
884*35238bceSAndroid Build Coastguard Worker         _data uniform_structure_arrays[2];
885*35238bceSAndroid Build Coastguard Worker         _data uniforms;
886*35238bceSAndroid Build Coastguard Worker     };
887*35238bceSAndroid Build Coastguard Worker 
888*35238bceSAndroid Build Coastguard Worker     /* Private methods */
889*35238bceSAndroid Build Coastguard Worker     void generateUniformValues();
890*35238bceSAndroid Build Coastguard Worker     void initProgramObjects();
891*35238bceSAndroid Build Coastguard Worker     void initTest();
892*35238bceSAndroid Build Coastguard Worker     void initUniformValues();
893*35238bceSAndroid Build Coastguard Worker     bool verifyProgramInterfaceQuerySupport();
894*35238bceSAndroid Build Coastguard Worker     bool verifyUniformValues();
895*35238bceSAndroid Build Coastguard Worker 
896*35238bceSAndroid Build Coastguard Worker     /* Private declarations */
897*35238bceSAndroid Build Coastguard Worker     bool m_has_test_passed;
898*35238bceSAndroid Build Coastguard Worker     char *m_uniform_name_buffer;
899*35238bceSAndroid Build Coastguard Worker 
900*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_cs_id;
901*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_fs_id;
902*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_gs_id;
903*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_po_cs_id;
904*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_po_noncs_id;
905*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_tc_id;
906*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_te_id;
907*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vs_id;
908*35238bceSAndroid Build Coastguard Worker 
909*35238bceSAndroid Build Coastguard Worker     _stage_data m_data_cs;
910*35238bceSAndroid Build Coastguard Worker     _stage_data m_data_fs;
911*35238bceSAndroid Build Coastguard Worker     _stage_data m_data_gs;
912*35238bceSAndroid Build Coastguard Worker     _stage_data m_data_tc;
913*35238bceSAndroid Build Coastguard Worker     _stage_data m_data_te;
914*35238bceSAndroid Build Coastguard Worker     _stage_data m_data_vs;
915*35238bceSAndroid Build Coastguard Worker };
916*35238bceSAndroid Build Coastguard Worker 
917*35238bceSAndroid Build Coastguard Worker /** Make sure the following implicit conversion work correctly:
918*35238bceSAndroid Build Coastguard Worker  *
919*35238bceSAndroid Build Coastguard Worker  *   a) int    -> double;
920*35238bceSAndroid Build Coastguard Worker  *   b) ivec2  -> dvec2;
921*35238bceSAndroid Build Coastguard Worker  *   c) ivec3  -> dvec3;
922*35238bceSAndroid Build Coastguard Worker  *   d) ivec4  -> dvec4;
923*35238bceSAndroid Build Coastguard Worker  *   e) uint   -> double;
924*35238bceSAndroid Build Coastguard Worker  *   f) uvec2  -> dvec2;
925*35238bceSAndroid Build Coastguard Worker  *   g) uvec3  -> dvec3;
926*35238bceSAndroid Build Coastguard Worker  *   h) uvec4  -> dvec4;
927*35238bceSAndroid Build Coastguard Worker  *   i) float  -> double;
928*35238bceSAndroid Build Coastguard Worker  *   j) vec2   -> dvec2;
929*35238bceSAndroid Build Coastguard Worker  *   k) vec3   -> dvec3;
930*35238bceSAndroid Build Coastguard Worker  *   l) vec4   -> dvec4;
931*35238bceSAndroid Build Coastguard Worker  *   m) mat2   -> dmat2;
932*35238bceSAndroid Build Coastguard Worker  *   n) mat3   -> dmat3;
933*35238bceSAndroid Build Coastguard Worker  *   o) mat4   -> dmat4;
934*35238bceSAndroid Build Coastguard Worker  *   p) mat2x3 -> dmat2x3;
935*35238bceSAndroid Build Coastguard Worker  *   q) mat2x4 -> dmat2x4;
936*35238bceSAndroid Build Coastguard Worker  *   r) mat3x2 -> dmat3x2;
937*35238bceSAndroid Build Coastguard Worker  *   s) mat3x4 -> dmat3x4;
938*35238bceSAndroid Build Coastguard Worker  *   t) max4x2 -> dmat4x2;
939*35238bceSAndroid Build Coastguard Worker  *   u) mat4x3 -> dmat4x3;
940*35238bceSAndroid Build Coastguard Worker  *
941*35238bceSAndroid Build Coastguard Worker  *   The test should also verify the following explicit conversions
942*35238bceSAndroid Build Coastguard Worker  *   are supported (that is: when the right-side value is used as
943*35238bceSAndroid Build Coastguard Worker  *   an argument to a constructor of left-side type):
944*35238bceSAndroid Build Coastguard Worker  *
945*35238bceSAndroid Build Coastguard Worker  *   a) int    -> double;
946*35238bceSAndroid Build Coastguard Worker  *   b) uint   -> double;
947*35238bceSAndroid Build Coastguard Worker  *   c) float  -> double;
948*35238bceSAndroid Build Coastguard Worker  *   d) double -> int;
949*35238bceSAndroid Build Coastguard Worker  *   e) double -> uint;
950*35238bceSAndroid Build Coastguard Worker  *   f) double -> float;
951*35238bceSAndroid Build Coastguard Worker  *   g) double -> bool;
952*35238bceSAndroid Build Coastguard Worker  *   h) bool   -> double;
953*35238bceSAndroid Build Coastguard Worker  *
954*35238bceSAndroid Build Coastguard Worker  *   For each conversion, the test should create a program object and
955*35238bceSAndroid Build Coastguard Worker  *   attach a vertex shader to it.
956*35238bceSAndroid Build Coastguard Worker  *   The shader should define an uniform named "base_value", with
957*35238bceSAndroid Build Coastguard Worker  *   its type dependent on the type defined left-side for particular
958*35238bceSAndroid Build Coastguard Worker  *   case, as defined below:
959*35238bceSAndroid Build Coastguard Worker  *
960*35238bceSAndroid Build Coastguard Worker  *   [base_value type: bool]
961*35238bceSAndroid Build Coastguard Worker  *   bool
962*35238bceSAndroid Build Coastguard Worker  *
963*35238bceSAndroid Build Coastguard Worker  *   [base_value type: double]
964*35238bceSAndroid Build Coastguard Worker  *   double
965*35238bceSAndroid Build Coastguard Worker  *
966*35238bceSAndroid Build Coastguard Worker  *   [base_value type: int]
967*35238bceSAndroid Build Coastguard Worker  *   int, ivec2, ivec3, ivec4
968*35238bceSAndroid Build Coastguard Worker  *
969*35238bceSAndroid Build Coastguard Worker  *   [base_value type: uint]
970*35238bceSAndroid Build Coastguard Worker  *   uint, uvec2, uvec3, uvec4
971*35238bceSAndroid Build Coastguard Worker  *
972*35238bceSAndroid Build Coastguard Worker  *   [base_value type: float]
973*35238bceSAndroid Build Coastguard Worker  *   float,  vec2,   vec3,   vec4,
974*35238bceSAndroid Build Coastguard Worker  *   mat2,   mat3,   mat4,   mat2x3,
975*35238bceSAndroid Build Coastguard Worker  *   mat2x4, mat3x2, mat3x4, mat4x2,
976*35238bceSAndroid Build Coastguard Worker  *   mat4x3
977*35238bceSAndroid Build Coastguard Worker  *
978*35238bceSAndroid Build Coastguard Worker  *   For each tested pair, it should build the "source" value/vector/matrix
979*35238bceSAndroid Build Coastguard Worker  *   by taking the value specified in uniform of the same type as the one
980*35238bceSAndroid Build Coastguard Worker  *   that is to be used as source, and use it for zeroth component. First
981*35238bceSAndroid Build Coastguard Worker  *   component should be larger by one, second component should be bigger
982*35238bceSAndroid Build Coastguard Worker  *   by two, and so on.
983*35238bceSAndroid Build Coastguard Worker  *   Once the source value/vector/matrix is defined, the casting operation
984*35238bceSAndroid Build Coastguard Worker  *   should be performed, giving a "destination" value/vector/matrix of
985*35238bceSAndroid Build Coastguard Worker  *   type as defined for particular case.
986*35238bceSAndroid Build Coastguard Worker  *   The resulting value should be XFBed out to the test implementation.
987*35238bceSAndroid Build Coastguard Worker  *   The comparison should be performed on CPU to ensure validity of
988*35238bceSAndroid Build Coastguard Worker  *   the resulting data.
989*35238bceSAndroid Build Coastguard Worker  *
990*35238bceSAndroid Build Coastguard Worker  *   A swizzling operator should be used where possible when setting
991*35238bceSAndroid Build Coastguard Worker  *   the output variables to additionally check that swizzling works
992*35238bceSAndroid Build Coastguard Worker  *   correctly for multi-component double-precision types.
993*35238bceSAndroid Build Coastguard Worker  *
994*35238bceSAndroid Build Coastguard Worker  *   The program object should be used for the following base values:
995*35238bceSAndroid Build Coastguard Worker  *
996*35238bceSAndroid Build Coastguard Worker  *   a) -25.12065
997*35238bceSAndroid Build Coastguard Worker  *   b)   0.0
998*35238bceSAndroid Build Coastguard Worker  *   c)   0.001
999*35238bceSAndroid Build Coastguard Worker  *   d)   1.0
1000*35238bceSAndroid Build Coastguard Worker  *   e) 256.78901
1001*35238bceSAndroid Build Coastguard Worker  *
1002*35238bceSAndroid Build Coastguard Worker  *   An epsilon of 1e-5 should be used for floating-point comparisons.
1003*35238bceSAndroid Build Coastguard Worker  **/
1004*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test5 : public deqp::TestCase
1005*35238bceSAndroid Build Coastguard Worker {
1006*35238bceSAndroid Build Coastguard Worker public:
1007*35238bceSAndroid Build Coastguard Worker     /* Public methods */
1008*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test5(deqp::Context &context);
1009*35238bceSAndroid Build Coastguard Worker 
1010*35238bceSAndroid Build Coastguard Worker     virtual void deinit();
1011*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
1012*35238bceSAndroid Build Coastguard Worker 
1013*35238bceSAndroid Build Coastguard Worker private:
1014*35238bceSAndroid Build Coastguard Worker     /* Private type definitions */
1015*35238bceSAndroid Build Coastguard Worker     /* Defines swizzle operators used by shaders generated by the test */
1016*35238bceSAndroid Build Coastguard Worker     enum _swizzle_type
1017*35238bceSAndroid Build Coastguard Worker     {
1018*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_NONE,
1019*35238bceSAndroid Build Coastguard Worker 
1020*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_XWZY,
1021*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_XZXY,
1022*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_XZY,
1023*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_XZYW,
1024*35238bceSAndroid Build Coastguard Worker 
1025*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_Y,
1026*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_YX,
1027*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_YXX,
1028*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_YXXY,
1029*35238bceSAndroid Build Coastguard Worker 
1030*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_Z,
1031*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_ZY,
1032*35238bceSAndroid Build Coastguard Worker 
1033*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_W,
1034*35238bceSAndroid Build Coastguard Worker         SWIZZLE_TYPE_WX,
1035*35238bceSAndroid Build Coastguard Worker     };
1036*35238bceSAndroid Build Coastguard Worker 
1037*35238bceSAndroid Build Coastguard Worker     /* Defines cast type to be used for specific test case */
1038*35238bceSAndroid Build Coastguard Worker     enum _test_case_type
1039*35238bceSAndroid Build Coastguard Worker     {
1040*35238bceSAndroid Build Coastguard Worker         TEST_CASE_TYPE_EXPLICIT,
1041*35238bceSAndroid Build Coastguard Worker         TEST_CASE_TYPE_IMPLICIT,
1042*35238bceSAndroid Build Coastguard Worker 
1043*35238bceSAndroid Build Coastguard Worker         /* Always last */
1044*35238bceSAndroid Build Coastguard Worker         TEST_CASE_TYPE_UNKNOWN
1045*35238bceSAndroid Build Coastguard Worker     };
1046*35238bceSAndroid Build Coastguard Worker 
1047*35238bceSAndroid Build Coastguard Worker     /* Holds a complete description of a single test case */
1048*35238bceSAndroid Build Coastguard Worker     struct _test_case
1049*35238bceSAndroid Build Coastguard Worker     {
1050*35238bceSAndroid Build Coastguard Worker         _test_case_type type;
1051*35238bceSAndroid Build Coastguard Worker 
1052*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type src_type;
1053*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type dst_type;
1054*35238bceSAndroid Build Coastguard Worker 
1055*35238bceSAndroid Build Coastguard Worker         std::string shader_body;
1056*35238bceSAndroid Build Coastguard Worker     };
1057*35238bceSAndroid Build Coastguard Worker 
1058*35238bceSAndroid Build Coastguard Worker     /* Private methods */
1059*35238bceSAndroid Build Coastguard Worker     bool executeIteration(const _test_case &test_case);
1060*35238bceSAndroid Build Coastguard Worker 
1061*35238bceSAndroid Build Coastguard Worker     void getSwizzleTypeProperties(_swizzle_type type, std::string *out_swizzle_string, unsigned int *out_n_components,
1062*35238bceSAndroid Build Coastguard Worker                                   unsigned int *out_component_order);
1063*35238bceSAndroid Build Coastguard Worker 
1064*35238bceSAndroid Build Coastguard Worker     std::string getVertexShaderBody(const _test_case &test_case);
1065*35238bceSAndroid Build Coastguard Worker     void initIteration(_test_case &test_case);
1066*35238bceSAndroid Build Coastguard Worker     void initTest();
1067*35238bceSAndroid Build Coastguard Worker 
1068*35238bceSAndroid Build Coastguard Worker     bool verifyXFBData(const unsigned char *data_ptr, const _test_case &test_case);
1069*35238bceSAndroid Build Coastguard Worker 
1070*35238bceSAndroid Build Coastguard Worker     void deinitInteration();
1071*35238bceSAndroid Build Coastguard Worker 
1072*35238bceSAndroid Build Coastguard Worker     /* Private declarations */
1073*35238bceSAndroid Build Coastguard Worker     unsigned char *m_base_value_bo_data;
1074*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_base_value_bo_id;
1075*35238bceSAndroid Build Coastguard Worker     bool m_has_test_passed;
1076*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_base_value_attribute_location;
1077*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_id;
1078*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vao_id;
1079*35238bceSAndroid Build Coastguard Worker     glw::GLint m_vs_id;
1080*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_xfb_bo_id;
1081*35238bceSAndroid Build Coastguard Worker     unsigned int m_xfb_bo_size;
1082*35238bceSAndroid Build Coastguard Worker 
1083*35238bceSAndroid Build Coastguard Worker     float m_base_values[5]; /* as per test spec */
1084*35238bceSAndroid Build Coastguard Worker     _swizzle_type m_swizzle_matrix[4 /* max number of dst components */][4 /* max number of src components */];
1085*35238bceSAndroid Build Coastguard Worker };
1086*35238bceSAndroid Build Coastguard Worker 
1087*35238bceSAndroid Build Coastguard Worker /** The test should verify it is a compilation error to perform the
1088*35238bceSAndroid Build Coastguard Worker  * following casts in the shader:
1089*35238bceSAndroid Build Coastguard Worker  *
1090*35238bceSAndroid Build Coastguard Worker  * a) int   [2] -> double;
1091*35238bceSAndroid Build Coastguard Worker  * b) ivec2 [2] -> dvec2;
1092*35238bceSAndroid Build Coastguard Worker  * c) ivec3 [2] -> dvec3;
1093*35238bceSAndroid Build Coastguard Worker  * d) ivec4 [2] -> dvec4;
1094*35238bceSAndroid Build Coastguard Worker  * e) uint  [2] -> double;
1095*35238bceSAndroid Build Coastguard Worker  * f) uvec2 [2] -> dvec2;
1096*35238bceSAndroid Build Coastguard Worker  * g) uvec3 [2] -> dvec3;
1097*35238bceSAndroid Build Coastguard Worker  * h) uvec4 [2] -> dvec4;
1098*35238bceSAndroid Build Coastguard Worker  * i) float [2] -> double;
1099*35238bceSAndroid Build Coastguard Worker  * j) vec2  [2] -> dvec2;
1100*35238bceSAndroid Build Coastguard Worker  * k) vec3  [2] -> dvec3;
1101*35238bceSAndroid Build Coastguard Worker  * l) vec4  [2] -> dvec4;
1102*35238bceSAndroid Build Coastguard Worker  * m) mat2  [2] -> dmat2;
1103*35238bceSAndroid Build Coastguard Worker  * n) mat3  [2] -> dmat3;
1104*35238bceSAndroid Build Coastguard Worker  * o) mat4  [2] -> dmat4;
1105*35238bceSAndroid Build Coastguard Worker  * p) mat2x3[2] -> dmat2x3;
1106*35238bceSAndroid Build Coastguard Worker  * q) mat2x4[2] -> dmat2x4;
1107*35238bceSAndroid Build Coastguard Worker  * r) mat3x2[2] -> dmat3x2;
1108*35238bceSAndroid Build Coastguard Worker  * s) mat3x4[2] -> dmat3x4;
1109*35238bceSAndroid Build Coastguard Worker  * t) mat4x2[2] -> dmat4x2;
1110*35238bceSAndroid Build Coastguard Worker  * u) mat4x3[2] -> dmat4x3;
1111*35238bceSAndroid Build Coastguard Worker  *
1112*35238bceSAndroid Build Coastguard Worker  * The test should also attempt to cast all types defined left-side
1113*35238bceSAndroid Build Coastguard Worker  * in a)-u) to structures, where the only variable embedded inside
1114*35238bceSAndroid Build Coastguard Worker  * the structure would be defined on the right-side of the test
1115*35238bceSAndroid Build Coastguard Worker  * case considered.
1116*35238bceSAndroid Build Coastguard Worker  *
1117*35238bceSAndroid Build Coastguard Worker  * The following shader stages should be considered for the purpose
1118*35238bceSAndroid Build Coastguard Worker  * of the test:
1119*35238bceSAndroid Build Coastguard Worker  *
1120*35238bceSAndroid Build Coastguard Worker  * 1) Fragment shader stage;
1121*35238bceSAndroid Build Coastguard Worker  * 2) Geometry shader stage;
1122*35238bceSAndroid Build Coastguard Worker  * 3) Tessellation control shader stage;
1123*35238bceSAndroid Build Coastguard Worker  * 4) Tessellation evaluation shader stage;
1124*35238bceSAndroid Build Coastguard Worker  * 5) Vertex shader stage;
1125*35238bceSAndroid Build Coastguard Worker  * 6) Compute shader stage;
1126*35238bceSAndroid Build Coastguard Worker  **/
1127*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test6 : public deqp::TestCase
1128*35238bceSAndroid Build Coastguard Worker {
1129*35238bceSAndroid Build Coastguard Worker public:
1130*35238bceSAndroid Build Coastguard Worker     /* Public methods */
1131*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test6(deqp::Context &context);
1132*35238bceSAndroid Build Coastguard Worker 
1133*35238bceSAndroid Build Coastguard Worker     virtual void deinit();
1134*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
1135*35238bceSAndroid Build Coastguard Worker 
1136*35238bceSAndroid Build Coastguard Worker private:
1137*35238bceSAndroid Build Coastguard Worker     /* Private type definitions */
1138*35238bceSAndroid Build Coastguard Worker 
1139*35238bceSAndroid Build Coastguard Worker     /* Holds a complete description of a single test case */
1140*35238bceSAndroid Build Coastguard Worker     struct _test_case
1141*35238bceSAndroid Build Coastguard Worker     {
1142*35238bceSAndroid Build Coastguard Worker         unsigned int src_array_size;
1143*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type src_type;
1144*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type dst_type;
1145*35238bceSAndroid Build Coastguard Worker 
1146*35238bceSAndroid Build Coastguard Worker         bool wrap_dst_type_in_structure;
1147*35238bceSAndroid Build Coastguard Worker 
1148*35238bceSAndroid Build Coastguard Worker         std::string cs_shader_body;
1149*35238bceSAndroid Build Coastguard Worker         std::string fs_shader_body;
1150*35238bceSAndroid Build Coastguard Worker         std::string gs_shader_body;
1151*35238bceSAndroid Build Coastguard Worker         std::string tc_shader_body;
1152*35238bceSAndroid Build Coastguard Worker         std::string te_shader_body;
1153*35238bceSAndroid Build Coastguard Worker         std::string vs_shader_body;
1154*35238bceSAndroid Build Coastguard Worker     };
1155*35238bceSAndroid Build Coastguard Worker 
1156*35238bceSAndroid Build Coastguard Worker     /* Private methods */
1157*35238bceSAndroid Build Coastguard Worker     bool executeIteration(const _test_case &test_case);
1158*35238bceSAndroid Build Coastguard Worker     std::string getComputeShaderBody(const _test_case &test_case);
1159*35238bceSAndroid Build Coastguard Worker     std::string getFragmentShaderBody(const _test_case &test_case);
1160*35238bceSAndroid Build Coastguard Worker     std::string getGeometryShaderBody(const _test_case &test_case);
1161*35238bceSAndroid Build Coastguard Worker     std::string getTessellationControlShaderBody(const _test_case &test_case);
1162*35238bceSAndroid Build Coastguard Worker     std::string getTessellationEvaluationShaderBody(const _test_case &test_case);
1163*35238bceSAndroid Build Coastguard Worker     std::string getVertexShaderBody(const _test_case &test_case);
1164*35238bceSAndroid Build Coastguard Worker 
1165*35238bceSAndroid Build Coastguard Worker     void initTest();
1166*35238bceSAndroid Build Coastguard Worker     void initIteration(_test_case &test_case);
1167*35238bceSAndroid Build Coastguard Worker 
1168*35238bceSAndroid Build Coastguard Worker     /* Private declarations */
1169*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_cs_id;
1170*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_fs_id;
1171*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_gs_id;
1172*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_tc_id;
1173*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_te_id;
1174*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vs_id;
1175*35238bceSAndroid Build Coastguard Worker 
1176*35238bceSAndroid Build Coastguard Worker     bool m_has_test_passed;
1177*35238bceSAndroid Build Coastguard Worker };
1178*35238bceSAndroid Build Coastguard Worker 
1179*35238bceSAndroid Build Coastguard Worker /** Make sure that double-precision types (double, dvec2, dvec3,
1180*35238bceSAndroid Build Coastguard Worker  *  dvec4, dmat2, dmat3, dmat4, dmat2x3, dmat2x4, dmat3x2, dmat3x4,
1181*35238bceSAndroid Build Coastguard Worker  *  dmat4x2, dmat4x2) and arrays of those:
1182*35238bceSAndroid Build Coastguard Worker  *
1183*35238bceSAndroid Build Coastguard Worker  *  a) can be used as varyings (excl. vertex shader inputs *if*
1184*35238bceSAndroid Build Coastguard Worker  *     GL_ARB_vertex_attrib_64bit support is *not* reported, and
1185*35238bceSAndroid Build Coastguard Worker  *     fragment shader outputs; 'flat' layout qualifier should be
1186*35238bceSAndroid Build Coastguard Worker  *     used for transferring data to fragment shader stage);
1187*35238bceSAndroid Build Coastguard Worker  *  b) cannot be used as fragment shader output; (compilation error
1188*35238bceSAndroid Build Coastguard Worker  *     expected).
1189*35238bceSAndroid Build Coastguard Worker  *  c) cannot be used as fragment shader input if 'flat' layout
1190*35238bceSAndroid Build Coastguard Worker  *     qualifier is missing)
1191*35238bceSAndroid Build Coastguard Worker  *
1192*35238bceSAndroid Build Coastguard Worker  *  For case a), the following shader stages should be defined for
1193*35238bceSAndroid Build Coastguard Worker  *  a single program object:
1194*35238bceSAndroid Build Coastguard Worker  *
1195*35238bceSAndroid Build Coastguard Worker  *  1) Vertex shader stage;
1196*35238bceSAndroid Build Coastguard Worker  *  2) Geometry shader stage;
1197*35238bceSAndroid Build Coastguard Worker  *  3) Tessellation control shader stage;
1198*35238bceSAndroid Build Coastguard Worker  *  4) Tessellation evaluation shader stage;
1199*35238bceSAndroid Build Coastguard Worker  *  5) Fragment shader stage;
1200*35238bceSAndroid Build Coastguard Worker  *
1201*35238bceSAndroid Build Coastguard Worker  *  Vertex shader stage should define a single output variable for
1202*35238bceSAndroid Build Coastguard Worker  *  each type considered. Each component of these output variables
1203*35238bceSAndroid Build Coastguard Worker  *  should be set to predefined unique values.
1204*35238bceSAndroid Build Coastguard Worker  *  Geometry shader stage should take points on input and emit a single
1205*35238bceSAndroid Build Coastguard Worker  *  point. It should take all input variables from the previous stage,
1206*35238bceSAndroid Build Coastguard Worker  *  add a predefined value to each component and pass it down the
1207*35238bceSAndroid Build Coastguard Worker  *  rendering pipeline.
1208*35238bceSAndroid Build Coastguard Worker  *  Tessellation control shader stage should set all inner/outer
1209*35238bceSAndroid Build Coastguard Worker  *  tessellation levels to 1 and output 1 vertex per patch.
1210*35238bceSAndroid Build Coastguard Worker  *  It should take all input variables from the previous stage,
1211*35238bceSAndroid Build Coastguard Worker  *  add a predefined value to each component and pass it to
1212*35238bceSAndroid Build Coastguard Worker  *  tessellation evaluation stage by using per-vertex outputs.
1213*35238bceSAndroid Build Coastguard Worker  *  Tessellation evaluation shader stage should take quads on
1214*35238bceSAndroid Build Coastguard Worker  *  input. It should also define all relevant input variables, as
1215*35238bceSAndroid Build Coastguard Worker  *  defined by previous stage, add a predefined value to each
1216*35238bceSAndroid Build Coastguard Worker  *  component and pass it to geometry shader stage. Finally, it
1217*35238bceSAndroid Build Coastguard Worker  *  should be constructed in a way that will make it generate
1218*35238bceSAndroid Build Coastguard Worker  *  a quad that occupies whole screen-space. This is necessary
1219*35238bceSAndroid Build Coastguard Worker  *  to perform validation of the input variables in fragment shader
1220*35238bceSAndroid Build Coastguard Worker  *  stage.
1221*35238bceSAndroid Build Coastguard Worker  *  Fragment shader stage should take all inputs, as defined as
1222*35238bceSAndroid Build Coastguard Worker  *  outputs in tessellation evaluation shader stage. It should
1223*35238bceSAndroid Build Coastguard Worker  *  verify all the inputs carry valid values. Upon success, it
1224*35238bceSAndroid Build Coastguard Worker  *  should output vec4(1) to the only output variable. Otherwise,
1225*35238bceSAndroid Build Coastguard Worker  *  it should set it to vec4(0).
1226*35238bceSAndroid Build Coastguard Worker  **/
1227*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test7 : public deqp::TestCase
1228*35238bceSAndroid Build Coastguard Worker {
1229*35238bceSAndroid Build Coastguard Worker public:
1230*35238bceSAndroid Build Coastguard Worker     /* Public methods */
1231*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test7(deqp::Context &context);
1232*35238bceSAndroid Build Coastguard Worker 
1233*35238bceSAndroid Build Coastguard Worker     virtual void deinit();
1234*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
1235*35238bceSAndroid Build Coastguard Worker 
1236*35238bceSAndroid Build Coastguard Worker private:
1237*35238bceSAndroid Build Coastguard Worker     /* Private type definitions */
1238*35238bceSAndroid Build Coastguard Worker     struct _variable
1239*35238bceSAndroid Build Coastguard Worker     {
1240*35238bceSAndroid Build Coastguard Worker         glw::GLint attribute_location;
1241*35238bceSAndroid Build Coastguard Worker         unsigned int array_size;
1242*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type type;
1243*35238bceSAndroid Build Coastguard Worker     };
1244*35238bceSAndroid Build Coastguard Worker 
1245*35238bceSAndroid Build Coastguard Worker     typedef std::vector<_variable> _variables;
1246*35238bceSAndroid Build Coastguard Worker     typedef _variables::const_iterator _variables_const_iterator;
1247*35238bceSAndroid Build Coastguard Worker 
1248*35238bceSAndroid Build Coastguard Worker     /* Private methods */
1249*35238bceSAndroid Build Coastguard Worker     bool buildTestProgram(_variables &variables);
1250*35238bceSAndroid Build Coastguard Worker     bool compileShader(glw::GLint shader_id, const std::string &body);
1251*35238bceSAndroid Build Coastguard Worker     void configureXFBBuffer(const _variables &variables);
1252*35238bceSAndroid Build Coastguard Worker     bool executeFunctionalTest(_variables &variables);
1253*35238bceSAndroid Build Coastguard Worker     void generateXFBVaryingNames(const _variables &variables);
1254*35238bceSAndroid Build Coastguard Worker 
1255*35238bceSAndroid Build Coastguard Worker     std::string getCodeOfFragmentShaderWithNonFlatDoublePrecisionInput(Utils::_variable_type input_variable_type,
1256*35238bceSAndroid Build Coastguard Worker                                                                        unsigned int array_size);
1257*35238bceSAndroid Build Coastguard Worker 
1258*35238bceSAndroid Build Coastguard Worker     std::string getCodeOfFragmentShaderWithDoublePrecisionOutput(Utils::_variable_type output_variable_type,
1259*35238bceSAndroid Build Coastguard Worker                                                                  unsigned int array_size);
1260*35238bceSAndroid Build Coastguard Worker 
1261*35238bceSAndroid Build Coastguard Worker     std::string getFragmentShaderBody(const _variables &variables);
1262*35238bceSAndroid Build Coastguard Worker     std::string getGeometryShaderBody(const _variables &variables);
1263*35238bceSAndroid Build Coastguard Worker     std::string getTessellationControlShaderBody(const _variables &variables);
1264*35238bceSAndroid Build Coastguard Worker     std::string getTessellationEvaluationShaderBody(const _variables &variables);
1265*35238bceSAndroid Build Coastguard Worker 
1266*35238bceSAndroid Build Coastguard Worker     std::string getVariableDeclarations(const char *prefix, const _variables &variables,
1267*35238bceSAndroid Build Coastguard Worker                                         const char *layout_qualifier = "");
1268*35238bceSAndroid Build Coastguard Worker 
1269*35238bceSAndroid Build Coastguard Worker     std::string getVertexShaderBody(const _variables &variables);
1270*35238bceSAndroid Build Coastguard Worker     void initTest();
1271*35238bceSAndroid Build Coastguard Worker     void logVariableContents(const _variables &variables);
1272*35238bceSAndroid Build Coastguard Worker     void releaseXFBVaryingNames();
1273*35238bceSAndroid Build Coastguard Worker     void setInputAttributeValues(const _variables &variables);
1274*35238bceSAndroid Build Coastguard Worker 
1275*35238bceSAndroid Build Coastguard Worker     /* Private declarations */
1276*35238bceSAndroid Build Coastguard Worker     bool m_are_double_inputs_supported;
1277*35238bceSAndroid Build Coastguard Worker     std::string m_current_fs_body;
1278*35238bceSAndroid Build Coastguard Worker     std::string m_current_gs_body;
1279*35238bceSAndroid Build Coastguard Worker     std::string m_current_tc_body;
1280*35238bceSAndroid Build Coastguard Worker     std::string m_current_te_body;
1281*35238bceSAndroid Build Coastguard Worker     std::string m_current_vs_body;
1282*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_fbo_id;
1283*35238bceSAndroid Build Coastguard Worker     glw::GLint m_fs_id;
1284*35238bceSAndroid Build Coastguard Worker     glw::GLint m_gs_id;
1285*35238bceSAndroid Build Coastguard Worker     bool m_has_test_passed;
1286*35238bceSAndroid Build Coastguard Worker     glw::GLint m_n_max_components_per_stage;
1287*35238bceSAndroid Build Coastguard Worker     unsigned int m_n_xfb_varyings;
1288*35238bceSAndroid Build Coastguard Worker     glw::GLint m_po_id;
1289*35238bceSAndroid Build Coastguard Worker     glw::GLint m_tc_id;
1290*35238bceSAndroid Build Coastguard Worker     glw::GLint m_te_id;
1291*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_to_id;
1292*35238bceSAndroid Build Coastguard Worker     unsigned char *m_to_data;
1293*35238bceSAndroid Build Coastguard Worker     unsigned int m_to_height;
1294*35238bceSAndroid Build Coastguard Worker     unsigned int m_to_width;
1295*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_xfb_bo_id;
1296*35238bceSAndroid Build Coastguard Worker     glw::GLchar **m_xfb_varyings;
1297*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vao_id;
1298*35238bceSAndroid Build Coastguard Worker     glw::GLint m_vs_id;
1299*35238bceSAndroid Build Coastguard Worker };
1300*35238bceSAndroid Build Coastguard Worker 
1301*35238bceSAndroid Build Coastguard Worker /** Make sure that all constructors valid for double-precision
1302*35238bceSAndroid Build Coastguard Worker  * vector/matrix types are accepted by the GLSL compiler for
1303*35238bceSAndroid Build Coastguard Worker  * all six shader stages.
1304*35238bceSAndroid Build Coastguard Worker  *
1305*35238bceSAndroid Build Coastguard Worker  * The test passes if all shaders compile successfully.
1306*35238bceSAndroid Build Coastguard Worker  **/
1307*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test8 : public deqp::TestCase
1308*35238bceSAndroid Build Coastguard Worker {
1309*35238bceSAndroid Build Coastguard Worker public:
1310*35238bceSAndroid Build Coastguard Worker     /* Public methods */
1311*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test8(deqp::Context &context);
1312*35238bceSAndroid Build Coastguard Worker 
1313*35238bceSAndroid Build Coastguard Worker     virtual void deinit();
1314*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
1315*35238bceSAndroid Build Coastguard Worker 
1316*35238bceSAndroid Build Coastguard Worker private:
1317*35238bceSAndroid Build Coastguard Worker     /* Private type definitions */
1318*35238bceSAndroid Build Coastguard Worker     typedef std::vector<Utils::_variable_type> _argument_list;
1319*35238bceSAndroid Build Coastguard Worker     typedef _argument_list::const_iterator _argument_list_const_iterator;
1320*35238bceSAndroid Build Coastguard Worker     typedef std::vector<_argument_list> _argument_lists;
1321*35238bceSAndroid Build Coastguard Worker     typedef _argument_lists::const_iterator _argument_lists_const_iterator;
1322*35238bceSAndroid Build Coastguard Worker 
1323*35238bceSAndroid Build Coastguard Worker     /* Holds a complete description of a single test case */
1324*35238bceSAndroid Build Coastguard Worker     struct _argument_list_tree_node;
1325*35238bceSAndroid Build Coastguard Worker 
1326*35238bceSAndroid Build Coastguard Worker     typedef std::vector<_argument_list_tree_node *> _argument_list_tree_nodes;
1327*35238bceSAndroid Build Coastguard Worker     typedef _argument_list_tree_nodes::const_iterator _argument_list_tree_nodes_const_iterator;
1328*35238bceSAndroid Build Coastguard Worker     typedef std::queue<_argument_list_tree_node *> _argument_list_tree_node_queue;
1329*35238bceSAndroid Build Coastguard Worker 
1330*35238bceSAndroid Build Coastguard Worker     struct _argument_list_tree_node
1331*35238bceSAndroid Build Coastguard Worker     {
1332*35238bceSAndroid Build Coastguard Worker         _argument_list_tree_nodes children;
1333*35238bceSAndroid Build Coastguard Worker         int n_components_used;
1334*35238bceSAndroid Build Coastguard Worker         _argument_list_tree_node *parent;
1335*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type type;
1336*35238bceSAndroid Build Coastguard Worker 
~_argument_list_tree_nodegl4cts::GPUShaderFP64Test8::_argument_list_tree_node1337*35238bceSAndroid Build Coastguard Worker         ~_argument_list_tree_node()
1338*35238bceSAndroid Build Coastguard Worker         {
1339*35238bceSAndroid Build Coastguard Worker             while (children.size() > 0)
1340*35238bceSAndroid Build Coastguard Worker             {
1341*35238bceSAndroid Build Coastguard Worker                 _argument_list_tree_node *node_ptr = children.back();
1342*35238bceSAndroid Build Coastguard Worker 
1343*35238bceSAndroid Build Coastguard Worker                 children.pop_back();
1344*35238bceSAndroid Build Coastguard Worker 
1345*35238bceSAndroid Build Coastguard Worker                 delete node_ptr;
1346*35238bceSAndroid Build Coastguard Worker                 node_ptr = NULL;
1347*35238bceSAndroid Build Coastguard Worker             }
1348*35238bceSAndroid Build Coastguard Worker         }
1349*35238bceSAndroid Build Coastguard Worker     };
1350*35238bceSAndroid Build Coastguard Worker 
1351*35238bceSAndroid Build Coastguard Worker     struct _test_case
1352*35238bceSAndroid Build Coastguard Worker     {
1353*35238bceSAndroid Build Coastguard Worker         _argument_list argument_list;
1354*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type type;
1355*35238bceSAndroid Build Coastguard Worker 
1356*35238bceSAndroid Build Coastguard Worker         std::string cs_shader_body;
1357*35238bceSAndroid Build Coastguard Worker         std::string fs_shader_body;
1358*35238bceSAndroid Build Coastguard Worker         std::string gs_shader_body;
1359*35238bceSAndroid Build Coastguard Worker         std::string tc_shader_body;
1360*35238bceSAndroid Build Coastguard Worker         std::string te_shader_body;
1361*35238bceSAndroid Build Coastguard Worker         std::string vs_shader_body;
1362*35238bceSAndroid Build Coastguard Worker     };
1363*35238bceSAndroid Build Coastguard Worker 
1364*35238bceSAndroid Build Coastguard Worker     /* Private methods */
1365*35238bceSAndroid Build Coastguard Worker     bool executeIteration(const _test_case &test_case);
1366*35238bceSAndroid Build Coastguard Worker     _argument_lists getArgumentListsForVariableType(const Utils::_variable_type &variable_type);
1367*35238bceSAndroid Build Coastguard Worker     std::string getComputeShaderBody(const _test_case &test_case);
1368*35238bceSAndroid Build Coastguard Worker     std::string getFragmentShaderBody(const _test_case &test_case);
1369*35238bceSAndroid Build Coastguard Worker     std::string getGeneralBody(const _test_case &test_case);
1370*35238bceSAndroid Build Coastguard Worker     std::string getGeometryShaderBody(const _test_case &test_case);
1371*35238bceSAndroid Build Coastguard Worker     std::string getTessellationControlShaderBody(const _test_case &test_case);
1372*35238bceSAndroid Build Coastguard Worker     std::string getTessellationEvaluationShaderBody(const _test_case &test_case);
1373*35238bceSAndroid Build Coastguard Worker     std::string getVertexShaderBody(const _test_case &test_case);
1374*35238bceSAndroid Build Coastguard Worker 
1375*35238bceSAndroid Build Coastguard Worker     void initTest();
1376*35238bceSAndroid Build Coastguard Worker     void initIteration(_test_case &test_case);
1377*35238bceSAndroid Build Coastguard Worker 
1378*35238bceSAndroid Build Coastguard Worker     /* Private declarations */
1379*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_cs_id;
1380*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_fs_id;
1381*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_gs_id;
1382*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_tc_id;
1383*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_te_id;
1384*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vs_id;
1385*35238bceSAndroid Build Coastguard Worker 
1386*35238bceSAndroid Build Coastguard Worker     bool m_has_test_passed;
1387*35238bceSAndroid Build Coastguard Worker };
1388*35238bceSAndroid Build Coastguard Worker 
1389*35238bceSAndroid Build Coastguard Worker /** Make sure that the following operators work correctly for
1390*35238bceSAndroid Build Coastguard Worker  *  double-precision floating-point scalars, vectors and matrices:
1391*35238bceSAndroid Build Coastguard Worker  *
1392*35238bceSAndroid Build Coastguard Worker  *  a) +  (addition)
1393*35238bceSAndroid Build Coastguard Worker  *  b) -  (subtraction)
1394*35238bceSAndroid Build Coastguard Worker  *  c) *  (multiplication)
1395*35238bceSAndroid Build Coastguard Worker  *  d) /  (division)
1396*35238bceSAndroid Build Coastguard Worker  *  e) -  (negation)
1397*35238bceSAndroid Build Coastguard Worker  *  f) -- (pre-decrementation and post-decrementation)
1398*35238bceSAndroid Build Coastguard Worker  *  g) ++ (pre-incrementation and post-incrementation)
1399*35238bceSAndroid Build Coastguard Worker  *
1400*35238bceSAndroid Build Coastguard Worker  *  Furthermore, the following relational operators should also be
1401*35238bceSAndroid Build Coastguard Worker  *  tested for double-precision floating-point expressions:
1402*35238bceSAndroid Build Coastguard Worker  *
1403*35238bceSAndroid Build Coastguard Worker  *  a) <  (less than)
1404*35238bceSAndroid Build Coastguard Worker  *  b) <= (less than or equal)
1405*35238bceSAndroid Build Coastguard Worker  *  c) >  (greater than)
1406*35238bceSAndroid Build Coastguard Worker  *  d) >= (greater than or equal)
1407*35238bceSAndroid Build Coastguard Worker  *
1408*35238bceSAndroid Build Coastguard Worker  *  For each double-precision floating-point type, the test should
1409*35238bceSAndroid Build Coastguard Worker  *  create a program object, to which it should then attach
1410*35238bceSAndroid Build Coastguard Worker  *  a vertex shader, body of which was adjusted to handle case-specific
1411*35238bceSAndroid Build Coastguard Worker  *  type. The shader should use all the operators and operations
1412*35238bceSAndroid Build Coastguard Worker  *  described above. The result value should be XFBed out to the
1413*35238bceSAndroid Build Coastguard Worker  *  test for verification.
1414*35238bceSAndroid Build Coastguard Worker  *
1415*35238bceSAndroid Build Coastguard Worker  *  For relational operators, both cases described below should be
1416*35238bceSAndroid Build Coastguard Worker  *  tested:
1417*35238bceSAndroid Build Coastguard Worker  *
1418*35238bceSAndroid Build Coastguard Worker  *  a) fundamental type of the two operands should match without
1419*35238bceSAndroid Build Coastguard Worker  *     any implicit type conversion involved in the process;
1420*35238bceSAndroid Build Coastguard Worker  *  b) fundamental type of the two operands should match after an
1421*35238bceSAndroid Build Coastguard Worker  *     implicit type conversion (use some of the casts enlisted for
1422*35238bceSAndroid Build Coastguard Worker  *     test 6).
1423*35238bceSAndroid Build Coastguard Worker  *
1424*35238bceSAndroid Build Coastguard Worker  *  The test passes if the returned set of values was correct for
1425*35238bceSAndroid Build Coastguard Worker  *  all the types considered. Assume epsilon value of 1e-5.
1426*35238bceSAndroid Build Coastguard Worker  *
1427*35238bceSAndroid Build Coastguard Worker  **/
1428*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Test9 : public deqp::TestCase
1429*35238bceSAndroid Build Coastguard Worker {
1430*35238bceSAndroid Build Coastguard Worker public:
1431*35238bceSAndroid Build Coastguard Worker     /* Public methods */
1432*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Test9(deqp::Context &context);
1433*35238bceSAndroid Build Coastguard Worker 
1434*35238bceSAndroid Build Coastguard Worker     void deinit();
1435*35238bceSAndroid Build Coastguard Worker     virtual tcu::TestNode::IterateResult iterate();
1436*35238bceSAndroid Build Coastguard Worker 
1437*35238bceSAndroid Build Coastguard Worker private:
1438*35238bceSAndroid Build Coastguard Worker     /* Private type definitions */
1439*35238bceSAndroid Build Coastguard Worker     typedef enum
1440*35238bceSAndroid Build Coastguard Worker     {
1441*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_ADDITION,
1442*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_DIVISION,
1443*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_MULTIPLICATION,
1444*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_SUBTRACTION,
1445*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_PRE_DECREMENTATION,
1446*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_PRE_INCREMENTATION,
1447*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_POST_DECREMENTATION,
1448*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_POST_INCREMENTATION,
1449*35238bceSAndroid Build Coastguard Worker 
1450*35238bceSAndroid Build Coastguard Worker         /* Always last */
1451*35238bceSAndroid Build Coastguard Worker         OPERATION_TYPE_COUNT
1452*35238bceSAndroid Build Coastguard Worker     } _operation_type;
1453*35238bceSAndroid Build Coastguard Worker 
1454*35238bceSAndroid Build Coastguard Worker     struct _test_case
1455*35238bceSAndroid Build Coastguard Worker     {
1456*35238bceSAndroid Build Coastguard Worker         _operation_type operation_type;
1457*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type result_variable_type;
1458*35238bceSAndroid Build Coastguard Worker         std::string vs_body;
1459*35238bceSAndroid Build Coastguard Worker         Utils::_variable_type variable_type;
1460*35238bceSAndroid Build Coastguard Worker     };
1461*35238bceSAndroid Build Coastguard Worker 
1462*35238bceSAndroid Build Coastguard Worker     /* Private methods */
1463*35238bceSAndroid Build Coastguard Worker     bool executeTestIteration(const _test_case &test_case);
1464*35238bceSAndroid Build Coastguard Worker 
1465*35238bceSAndroid Build Coastguard Worker     void getMatrixMultiplicationResult(const Utils::_variable_type &matrix_a_type,
1466*35238bceSAndroid Build Coastguard Worker                                        const std::vector<double> &matrix_a_data,
1467*35238bceSAndroid Build Coastguard Worker                                        const Utils::_variable_type &matrix_b_type,
1468*35238bceSAndroid Build Coastguard Worker                                        const std::vector<double> &matrix_b_data, double *out_result_ptr);
1469*35238bceSAndroid Build Coastguard Worker 
1470*35238bceSAndroid Build Coastguard Worker     const char *getOperatorForOperationType(const _operation_type &operation_type);
1471*35238bceSAndroid Build Coastguard Worker     std::string getOperationTypeString(const _operation_type &operation_type);
1472*35238bceSAndroid Build Coastguard Worker     std::string getVertexShaderBody(_test_case &test_case);
1473*35238bceSAndroid Build Coastguard Worker     void initTest();
1474*35238bceSAndroid Build Coastguard Worker     void initTestIteration(_test_case &test_case);
1475*35238bceSAndroid Build Coastguard Worker 
1476*35238bceSAndroid Build Coastguard Worker     bool verifyXFBData(const _test_case &test_case, const unsigned char *xfb_data);
1477*35238bceSAndroid Build Coastguard Worker 
1478*35238bceSAndroid Build Coastguard Worker     /* Private fields */
1479*35238bceSAndroid Build Coastguard Worker     bool m_has_test_passed;
1480*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_po_id;
1481*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_xfb_bo_id;
1482*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vao_id;
1483*35238bceSAndroid Build Coastguard Worker     glw::GLuint m_vs_id;
1484*35238bceSAndroid Build Coastguard Worker };
1485*35238bceSAndroid Build Coastguard Worker 
1486*35238bceSAndroid Build Coastguard Worker /** Group class for GPU Shader FP64 conformance tests */
1487*35238bceSAndroid Build Coastguard Worker class GPUShaderFP64Tests : public deqp::TestCaseGroup
1488*35238bceSAndroid Build Coastguard Worker {
1489*35238bceSAndroid Build Coastguard Worker public:
1490*35238bceSAndroid Build Coastguard Worker     /* Public methods */
1491*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Tests(deqp::Context &context);
~GPUShaderFP64Tests()1492*35238bceSAndroid Build Coastguard Worker     virtual ~GPUShaderFP64Tests()
1493*35238bceSAndroid Build Coastguard Worker     {
1494*35238bceSAndroid Build Coastguard Worker     }
1495*35238bceSAndroid Build Coastguard Worker 
1496*35238bceSAndroid Build Coastguard Worker     virtual void init(void);
1497*35238bceSAndroid Build Coastguard Worker 
1498*35238bceSAndroid Build Coastguard Worker private:
1499*35238bceSAndroid Build Coastguard Worker     /* Private methods */
1500*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Tests(const GPUShaderFP64Tests &);
1501*35238bceSAndroid Build Coastguard Worker     GPUShaderFP64Tests &operator=(const GPUShaderFP64Tests &);
1502*35238bceSAndroid Build Coastguard Worker };
1503*35238bceSAndroid Build Coastguard Worker 
1504*35238bceSAndroid Build Coastguard Worker } // namespace gl4cts
1505*35238bceSAndroid Build Coastguard Worker 
1506*35238bceSAndroid Build Coastguard Worker #endif // _GL4CGPUSHADERFP64TESTS_HPP
1507