xref: /aosp_15_r20/external/deqp/modules/gles3/functional/es3fFloatStateQueryTests.cpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program OpenGL ES 3.0 Module
3*35238bceSAndroid Build Coastguard Worker  * -------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker  *
5*35238bceSAndroid Build Coastguard Worker  * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker  *
7*35238bceSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker  *
11*35238bceSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker  *
13*35238bceSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker  * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker  *
19*35238bceSAndroid Build Coastguard Worker  *//*!
20*35238bceSAndroid Build Coastguard Worker  * \file
21*35238bceSAndroid Build Coastguard Worker  * \brief Float State Query tests.
22*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker 
24*35238bceSAndroid Build Coastguard Worker #include "es3fFloatStateQueryTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "glsStateQueryUtil.hpp"
26*35238bceSAndroid Build Coastguard Worker #include "es3fApiCase.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "tcuRenderTarget.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "tcuFormatUtil.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "deRandom.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "deMath.h"
32*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
33*35238bceSAndroid Build Coastguard Worker 
34*35238bceSAndroid Build Coastguard Worker #include <limits>
35*35238bceSAndroid Build Coastguard Worker 
36*35238bceSAndroid Build Coastguard Worker using namespace glw; // GLint and other GL types
37*35238bceSAndroid Build Coastguard Worker using namespace deqp::gls;
38*35238bceSAndroid Build Coastguard Worker using deqp::gls::StateQueryUtil::StateQueryMemoryWriteGuard;
39*35238bceSAndroid Build Coastguard Worker 
40*35238bceSAndroid Build Coastguard Worker namespace deqp
41*35238bceSAndroid Build Coastguard Worker {
42*35238bceSAndroid Build Coastguard Worker namespace gles3
43*35238bceSAndroid Build Coastguard Worker {
44*35238bceSAndroid Build Coastguard Worker namespace Functional
45*35238bceSAndroid Build Coastguard Worker {
46*35238bceSAndroid Build Coastguard Worker namespace FloatStateQueryVerifiers
47*35238bceSAndroid Build Coastguard Worker {
48*35238bceSAndroid Build Coastguard Worker namespace
49*35238bceSAndroid Build Coastguard Worker {
50*35238bceSAndroid Build Coastguard Worker 
51*35238bceSAndroid Build Coastguard Worker const int FLOAT_EXPANSION_E    = 0x03FF; // 10 bits error allowed, requires 22 accurate bits
52*35238bceSAndroid Build Coastguard Worker const int FLOAT_EXPANSION_E_64 = 0x07FF;
53*35238bceSAndroid Build Coastguard Worker 
expandGLFloatToInteger(GLfloat f)54*35238bceSAndroid Build Coastguard Worker GLint64 expandGLFloatToInteger(GLfloat f)
55*35238bceSAndroid Build Coastguard Worker {
56*35238bceSAndroid Build Coastguard Worker     const GLuint64 referenceValue = (GLint64)(f * 2147483647.0);
57*35238bceSAndroid Build Coastguard Worker     return referenceValue;
58*35238bceSAndroid Build Coastguard Worker }
59*35238bceSAndroid Build Coastguard Worker 
clampToGLint(GLint64 val)60*35238bceSAndroid Build Coastguard Worker GLint clampToGLint(GLint64 val)
61*35238bceSAndroid Build Coastguard Worker {
62*35238bceSAndroid Build Coastguard Worker     return (GLint)de::clamp<GLint64>(val, std::numeric_limits<GLint>::min(), std::numeric_limits<GLint>::max());
63*35238bceSAndroid Build Coastguard Worker }
64*35238bceSAndroid Build Coastguard Worker 
65*35238bceSAndroid Build Coastguard Worker } // namespace
66*35238bceSAndroid Build Coastguard Worker 
67*35238bceSAndroid Build Coastguard Worker // StateVerifier
68*35238bceSAndroid Build Coastguard Worker 
69*35238bceSAndroid Build Coastguard Worker class StateVerifier : protected glu::CallLogWrapper
70*35238bceSAndroid Build Coastguard Worker {
71*35238bceSAndroid Build Coastguard Worker public:
72*35238bceSAndroid Build Coastguard Worker     StateVerifier(const glw::Functions &gl, tcu::TestLog &log, const char *testNamePostfix);
73*35238bceSAndroid Build Coastguard Worker     virtual ~StateVerifier(); // make GCC happy
74*35238bceSAndroid Build Coastguard Worker 
75*35238bceSAndroid Build Coastguard Worker     const char *getTestNamePostfix(void) const;
76*35238bceSAndroid Build Coastguard Worker 
77*35238bceSAndroid Build Coastguard Worker     virtual void verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference) = DE_NULL;
78*35238bceSAndroid Build Coastguard Worker 
79*35238bceSAndroid Build Coastguard Worker     // "Expanded" == Float to int conversion converts from [-1.0 to 1.0] -> [MIN_INT MAX_INT]
80*35238bceSAndroid Build Coastguard Worker     virtual void verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference) = DE_NULL;
81*35238bceSAndroid Build Coastguard Worker     virtual void verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
82*35238bceSAndroid Build Coastguard Worker                                       GLfloat reference1)                                       = DE_NULL;
83*35238bceSAndroid Build Coastguard Worker     virtual void verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1,
84*35238bceSAndroid Build Coastguard Worker                                    GLfloat reference2, GLfloat reference3)                      = DE_NULL;
85*35238bceSAndroid Build Coastguard Worker 
86*35238bceSAndroid Build Coastguard Worker     // verify that the given range is completely whitin the GL state range
87*35238bceSAndroid Build Coastguard Worker     virtual void verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max)   = DE_NULL;
88*35238bceSAndroid Build Coastguard Worker     virtual void verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference) = DE_NULL;
89*35238bceSAndroid Build Coastguard Worker 
90*35238bceSAndroid Build Coastguard Worker private:
91*35238bceSAndroid Build Coastguard Worker     const char *const m_testNamePostfix;
92*35238bceSAndroid Build Coastguard Worker };
93*35238bceSAndroid Build Coastguard Worker 
StateVerifier(const glw::Functions & gl,tcu::TestLog & log,const char * testNamePostfix)94*35238bceSAndroid Build Coastguard Worker StateVerifier::StateVerifier(const glw::Functions &gl, tcu::TestLog &log, const char *testNamePostfix)
95*35238bceSAndroid Build Coastguard Worker     : glu::CallLogWrapper(gl, log)
96*35238bceSAndroid Build Coastguard Worker     , m_testNamePostfix(testNamePostfix)
97*35238bceSAndroid Build Coastguard Worker {
98*35238bceSAndroid Build Coastguard Worker     enableLogging(true);
99*35238bceSAndroid Build Coastguard Worker }
100*35238bceSAndroid Build Coastguard Worker 
~StateVerifier()101*35238bceSAndroid Build Coastguard Worker StateVerifier::~StateVerifier()
102*35238bceSAndroid Build Coastguard Worker {
103*35238bceSAndroid Build Coastguard Worker }
104*35238bceSAndroid Build Coastguard Worker 
getTestNamePostfix(void) const105*35238bceSAndroid Build Coastguard Worker const char *StateVerifier::getTestNamePostfix(void) const
106*35238bceSAndroid Build Coastguard Worker {
107*35238bceSAndroid Build Coastguard Worker     return m_testNamePostfix;
108*35238bceSAndroid Build Coastguard Worker }
109*35238bceSAndroid Build Coastguard Worker 
110*35238bceSAndroid Build Coastguard Worker // GetBooleanVerifier
111*35238bceSAndroid Build Coastguard Worker 
112*35238bceSAndroid Build Coastguard Worker class GetBooleanVerifier : public StateVerifier
113*35238bceSAndroid Build Coastguard Worker {
114*35238bceSAndroid Build Coastguard Worker public:
115*35238bceSAndroid Build Coastguard Worker     GetBooleanVerifier(const glw::Functions &gl, tcu::TestLog &log);
116*35238bceSAndroid Build Coastguard Worker     void verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
117*35238bceSAndroid Build Coastguard Worker     void verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
118*35238bceSAndroid Build Coastguard Worker     void verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1);
119*35238bceSAndroid Build Coastguard Worker     void verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1,
120*35238bceSAndroid Build Coastguard Worker                            GLfloat reference2, GLfloat reference3);
121*35238bceSAndroid Build Coastguard Worker     void verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max);
122*35238bceSAndroid Build Coastguard Worker     void verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
123*35238bceSAndroid Build Coastguard Worker };
124*35238bceSAndroid Build Coastguard Worker 
GetBooleanVerifier(const glw::Functions & gl,tcu::TestLog & log)125*35238bceSAndroid Build Coastguard Worker GetBooleanVerifier::GetBooleanVerifier(const glw::Functions &gl, tcu::TestLog &log)
126*35238bceSAndroid Build Coastguard Worker     : StateVerifier(gl, log, "_getboolean")
127*35238bceSAndroid Build Coastguard Worker {
128*35238bceSAndroid Build Coastguard Worker }
129*35238bceSAndroid Build Coastguard Worker 
verifyFloat(tcu::TestContext & testCtx,GLenum name,GLfloat reference)130*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
131*35238bceSAndroid Build Coastguard Worker {
132*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
133*35238bceSAndroid Build Coastguard Worker 
134*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLboolean> state;
135*35238bceSAndroid Build Coastguard Worker     glGetBooleanv(name, &state);
136*35238bceSAndroid Build Coastguard Worker 
137*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
138*35238bceSAndroid Build Coastguard Worker         return;
139*35238bceSAndroid Build Coastguard Worker 
140*35238bceSAndroid Build Coastguard Worker     const GLboolean expectedGLState = reference != 0.0f ? GL_TRUE : GL_FALSE;
141*35238bceSAndroid Build Coastguard Worker 
142*35238bceSAndroid Build Coastguard Worker     if (state != expectedGLState)
143*35238bceSAndroid Build Coastguard Worker     {
144*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected "
145*35238bceSAndroid Build Coastguard Worker                          << (expectedGLState == GL_TRUE ? "GL_TRUE" : "GL_FALSE") << "; got "
146*35238bceSAndroid Build Coastguard Worker                          << (state == GL_TRUE ? "GL_TRUE" : (state == GL_FALSE ? "GL_FALSE" : "non-boolean"))
147*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
148*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
149*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
150*35238bceSAndroid Build Coastguard Worker     }
151*35238bceSAndroid Build Coastguard Worker }
152*35238bceSAndroid Build Coastguard Worker 
verifyFloatExpanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference)153*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
154*35238bceSAndroid Build Coastguard Worker {
155*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference, -1.0f, 1.0f));
156*35238bceSAndroid Build Coastguard Worker     verifyFloat(testCtx, name, reference);
157*35238bceSAndroid Build Coastguard Worker }
158*35238bceSAndroid Build Coastguard Worker 
verifyFloat2Expanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1)159*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
160*35238bceSAndroid Build Coastguard Worker                                               GLfloat reference1)
161*35238bceSAndroid Build Coastguard Worker {
162*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference0, -1.0f, 1.0f));
163*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference1, -1.0f, 1.0f));
164*35238bceSAndroid Build Coastguard Worker 
165*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
166*35238bceSAndroid Build Coastguard Worker 
167*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLboolean[2]> boolVector2;
168*35238bceSAndroid Build Coastguard Worker     glGetBooleanv(name, boolVector2);
169*35238bceSAndroid Build Coastguard Worker 
170*35238bceSAndroid Build Coastguard Worker     if (!boolVector2.verifyValidity(testCtx))
171*35238bceSAndroid Build Coastguard Worker         return;
172*35238bceSAndroid Build Coastguard Worker 
173*35238bceSAndroid Build Coastguard Worker     const GLboolean referenceAsGLBoolean[] = {
174*35238bceSAndroid Build Coastguard Worker         reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
175*35238bceSAndroid Build Coastguard Worker         reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
176*35238bceSAndroid Build Coastguard Worker     };
177*35238bceSAndroid Build Coastguard Worker 
178*35238bceSAndroid Build Coastguard Worker     if (boolVector2[0] != referenceAsGLBoolean[0] || boolVector2[1] != referenceAsGLBoolean[1])
179*35238bceSAndroid Build Coastguard Worker     {
180*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << (boolVector2[0] ? "GL_TRUE" : "GL_FALSE")
181*35238bceSAndroid Build Coastguard Worker                          << " " << (boolVector2[1] ? "GL_TRUE" : "GL_FALSE") << " " << TestLog::EndMessage;
182*35238bceSAndroid Build Coastguard Worker 
183*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
184*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
185*35238bceSAndroid Build Coastguard Worker     }
186*35238bceSAndroid Build Coastguard Worker }
187*35238bceSAndroid Build Coastguard Worker 
verifyFloat4Color(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1,GLfloat reference2,GLfloat reference3)188*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
189*35238bceSAndroid Build Coastguard Worker                                            GLfloat reference1, GLfloat reference2, GLfloat reference3)
190*35238bceSAndroid Build Coastguard Worker {
191*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
192*35238bceSAndroid Build Coastguard Worker 
193*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLboolean[4]> boolVector4;
194*35238bceSAndroid Build Coastguard Worker     glGetBooleanv(name, boolVector4);
195*35238bceSAndroid Build Coastguard Worker 
196*35238bceSAndroid Build Coastguard Worker     if (!boolVector4.verifyValidity(testCtx))
197*35238bceSAndroid Build Coastguard Worker         return;
198*35238bceSAndroid Build Coastguard Worker 
199*35238bceSAndroid Build Coastguard Worker     const GLboolean referenceAsGLBoolean[] = {
200*35238bceSAndroid Build Coastguard Worker         reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
201*35238bceSAndroid Build Coastguard Worker         reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
202*35238bceSAndroid Build Coastguard Worker         reference2 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
203*35238bceSAndroid Build Coastguard Worker         reference3 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
204*35238bceSAndroid Build Coastguard Worker     };
205*35238bceSAndroid Build Coastguard Worker 
206*35238bceSAndroid Build Coastguard Worker     if (boolVector4[0] != referenceAsGLBoolean[0] || boolVector4[1] != referenceAsGLBoolean[1] ||
207*35238bceSAndroid Build Coastguard Worker         boolVector4[2] != referenceAsGLBoolean[2] || boolVector4[3] != referenceAsGLBoolean[3])
208*35238bceSAndroid Build Coastguard Worker     {
209*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected "
210*35238bceSAndroid Build Coastguard Worker                          << (referenceAsGLBoolean[0] ? "GL_TRUE" : "GL_FALSE") << " "
211*35238bceSAndroid Build Coastguard Worker                          << (referenceAsGLBoolean[1] ? "GL_TRUE" : "GL_FALSE") << " "
212*35238bceSAndroid Build Coastguard Worker                          << (referenceAsGLBoolean[2] ? "GL_TRUE" : "GL_FALSE") << " "
213*35238bceSAndroid Build Coastguard Worker                          << (referenceAsGLBoolean[3] ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
214*35238bceSAndroid Build Coastguard Worker 
215*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
216*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
217*35238bceSAndroid Build Coastguard Worker     }
218*35238bceSAndroid Build Coastguard Worker }
219*35238bceSAndroid Build Coastguard Worker 
verifyFloatRange(tcu::TestContext & testCtx,GLenum name,GLfloat min,GLfloat max)220*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max)
221*35238bceSAndroid Build Coastguard Worker {
222*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
223*35238bceSAndroid Build Coastguard Worker 
224*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLboolean[2]> range;
225*35238bceSAndroid Build Coastguard Worker     glGetBooleanv(name, range);
226*35238bceSAndroid Build Coastguard Worker 
227*35238bceSAndroid Build Coastguard Worker     if (!range.verifyValidity(testCtx))
228*35238bceSAndroid Build Coastguard Worker         return;
229*35238bceSAndroid Build Coastguard Worker 
230*35238bceSAndroid Build Coastguard Worker     if (range[0] == GL_FALSE)
231*35238bceSAndroid Build Coastguard Worker     {
232*35238bceSAndroid Build Coastguard Worker         if (max < 0 || min < 0)
233*35238bceSAndroid Build Coastguard Worker         {
234*35238bceSAndroid Build Coastguard Worker             testCtx.getLog() << TestLog::Message << "// ERROR: range [" << min << ", " << max << "] is not in range ["
235*35238bceSAndroid Build Coastguard Worker                              << (range[0] == GL_TRUE ? "GL_TRUE" : (range[0] == GL_FALSE ? "GL_FALSE" : "non-boolean"))
236*35238bceSAndroid Build Coastguard Worker                              << ", "
237*35238bceSAndroid Build Coastguard Worker                              << (range[1] == GL_TRUE ? "GL_TRUE" : (range[1] == GL_FALSE ? "GL_FALSE" : "non-boolean"))
238*35238bceSAndroid Build Coastguard Worker                              << "]" << TestLog::EndMessage;
239*35238bceSAndroid Build Coastguard Worker             if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
240*35238bceSAndroid Build Coastguard Worker                 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean range");
241*35238bceSAndroid Build Coastguard Worker             return;
242*35238bceSAndroid Build Coastguard Worker         }
243*35238bceSAndroid Build Coastguard Worker     }
244*35238bceSAndroid Build Coastguard Worker     if (range[1] == GL_FALSE)
245*35238bceSAndroid Build Coastguard Worker     {
246*35238bceSAndroid Build Coastguard Worker         if (max > 0 || min > 0)
247*35238bceSAndroid Build Coastguard Worker         {
248*35238bceSAndroid Build Coastguard Worker             testCtx.getLog() << TestLog::Message << "// ERROR: range [" << min << ", " << max << "] is not in range ["
249*35238bceSAndroid Build Coastguard Worker                              << (range[0] == GL_TRUE ? "GL_TRUE" : (range[0] == GL_FALSE ? "GL_FALSE" : "non-boolean"))
250*35238bceSAndroid Build Coastguard Worker                              << ", "
251*35238bceSAndroid Build Coastguard Worker                              << (range[1] == GL_TRUE ? "GL_TRUE" : (range[1] == GL_FALSE ? "GL_FALSE" : "non-boolean"))
252*35238bceSAndroid Build Coastguard Worker                              << "]" << TestLog::EndMessage;
253*35238bceSAndroid Build Coastguard Worker             if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
254*35238bceSAndroid Build Coastguard Worker                 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean range");
255*35238bceSAndroid Build Coastguard Worker             return;
256*35238bceSAndroid Build Coastguard Worker         }
257*35238bceSAndroid Build Coastguard Worker     }
258*35238bceSAndroid Build Coastguard Worker }
259*35238bceSAndroid Build Coastguard Worker 
verifyFloatGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLfloat reference)260*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
261*35238bceSAndroid Build Coastguard Worker {
262*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
263*35238bceSAndroid Build Coastguard Worker 
264*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLboolean> state;
265*35238bceSAndroid Build Coastguard Worker     glGetBooleanv(name, &state);
266*35238bceSAndroid Build Coastguard Worker 
267*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
268*35238bceSAndroid Build Coastguard Worker         return;
269*35238bceSAndroid Build Coastguard Worker 
270*35238bceSAndroid Build Coastguard Worker     if (state == GL_TRUE) // state is non-zero, could be greater than reference (correct)
271*35238bceSAndroid Build Coastguard Worker         return;
272*35238bceSAndroid Build Coastguard Worker 
273*35238bceSAndroid Build Coastguard Worker     if (state == GL_FALSE) // state is zero
274*35238bceSAndroid Build Coastguard Worker     {
275*35238bceSAndroid Build Coastguard Worker         if (reference > 0) // and reference is greater than zero?
276*35238bceSAndroid Build Coastguard Worker         {
277*35238bceSAndroid Build Coastguard Worker             testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
278*35238bceSAndroid Build Coastguard Worker             if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
279*35238bceSAndroid Build Coastguard Worker                 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
280*35238bceSAndroid Build Coastguard Worker         }
281*35238bceSAndroid Build Coastguard Worker     }
282*35238bceSAndroid Build Coastguard Worker     else
283*35238bceSAndroid Build Coastguard Worker     {
284*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE or GL_FALSE" << TestLog::EndMessage;
285*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
286*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
287*35238bceSAndroid Build Coastguard Worker     }
288*35238bceSAndroid Build Coastguard Worker }
289*35238bceSAndroid Build Coastguard Worker 
290*35238bceSAndroid Build Coastguard Worker //GetIntegerVerifier
291*35238bceSAndroid Build Coastguard Worker 
292*35238bceSAndroid Build Coastguard Worker class GetIntegerVerifier : public StateVerifier
293*35238bceSAndroid Build Coastguard Worker {
294*35238bceSAndroid Build Coastguard Worker public:
295*35238bceSAndroid Build Coastguard Worker     GetIntegerVerifier(const glw::Functions &gl, tcu::TestLog &log);
296*35238bceSAndroid Build Coastguard Worker     void verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
297*35238bceSAndroid Build Coastguard Worker     void verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
298*35238bceSAndroid Build Coastguard Worker     void verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1);
299*35238bceSAndroid Build Coastguard Worker     void verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1,
300*35238bceSAndroid Build Coastguard Worker                            GLfloat reference2, GLfloat reference3);
301*35238bceSAndroid Build Coastguard Worker     void verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max);
302*35238bceSAndroid Build Coastguard Worker     void verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
303*35238bceSAndroid Build Coastguard Worker };
304*35238bceSAndroid Build Coastguard Worker 
GetIntegerVerifier(const glw::Functions & gl,tcu::TestLog & log)305*35238bceSAndroid Build Coastguard Worker GetIntegerVerifier::GetIntegerVerifier(const glw::Functions &gl, tcu::TestLog &log)
306*35238bceSAndroid Build Coastguard Worker     : StateVerifier(gl, log, "_getinteger")
307*35238bceSAndroid Build Coastguard Worker {
308*35238bceSAndroid Build Coastguard Worker }
309*35238bceSAndroid Build Coastguard Worker 
verifyFloat(tcu::TestContext & testCtx,GLenum name,GLfloat reference)310*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
311*35238bceSAndroid Build Coastguard Worker {
312*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
313*35238bceSAndroid Build Coastguard Worker 
314*35238bceSAndroid Build Coastguard Worker     const GLint expectedGLStateMax = StateQueryUtil::roundGLfloatToNearestIntegerHalfUp<GLint>(reference);
315*35238bceSAndroid Build Coastguard Worker     const GLint expectedGLStateMin = StateQueryUtil::roundGLfloatToNearestIntegerHalfDown<GLint>(reference);
316*35238bceSAndroid Build Coastguard Worker 
317*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint> state;
318*35238bceSAndroid Build Coastguard Worker     glGetIntegerv(name, &state);
319*35238bceSAndroid Build Coastguard Worker 
320*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
321*35238bceSAndroid Build Coastguard Worker         return;
322*35238bceSAndroid Build Coastguard Worker 
323*35238bceSAndroid Build Coastguard Worker     if (state < expectedGLStateMin || state > expectedGLStateMax)
324*35238bceSAndroid Build Coastguard Worker     {
325*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected rounding to the nearest integer, valid range ["
326*35238bceSAndroid Build Coastguard Worker                          << expectedGLStateMin << "," << expectedGLStateMax << "]; got " << state
327*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
328*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
329*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
330*35238bceSAndroid Build Coastguard Worker     }
331*35238bceSAndroid Build Coastguard Worker }
332*35238bceSAndroid Build Coastguard Worker 
verifyFloatExpanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference)333*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
334*35238bceSAndroid Build Coastguard Worker {
335*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference, -1.0f, 1.0f));
336*35238bceSAndroid Build Coastguard Worker 
337*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
338*35238bceSAndroid Build Coastguard Worker     using tcu::toHex;
339*35238bceSAndroid Build Coastguard Worker 
340*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint> state;
341*35238bceSAndroid Build Coastguard Worker     glGetIntegerv(name, &state);
342*35238bceSAndroid Build Coastguard Worker 
343*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
344*35238bceSAndroid Build Coastguard Worker         return;
345*35238bceSAndroid Build Coastguard Worker 
346*35238bceSAndroid Build Coastguard Worker     const GLint expectedGLStateMax = clampToGLint(expandGLFloatToInteger(reference) + FLOAT_EXPANSION_E);
347*35238bceSAndroid Build Coastguard Worker     const GLint expectedGLStateMin = clampToGLint(expandGLFloatToInteger(reference) - FLOAT_EXPANSION_E);
348*35238bceSAndroid Build Coastguard Worker 
349*35238bceSAndroid Build Coastguard Worker     if (state < expectedGLStateMin || state > expectedGLStateMax)
350*35238bceSAndroid Build Coastguard Worker     {
351*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected in range [" << toHex(expectedGLStateMin) << ","
352*35238bceSAndroid Build Coastguard Worker                          << toHex(expectedGLStateMax) << "]; got " << toHex((GLint)state) << TestLog::EndMessage;
353*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
354*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
355*35238bceSAndroid Build Coastguard Worker     }
356*35238bceSAndroid Build Coastguard Worker }
357*35238bceSAndroid Build Coastguard Worker 
verifyFloat2Expanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1)358*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
359*35238bceSAndroid Build Coastguard Worker                                               GLfloat reference1)
360*35238bceSAndroid Build Coastguard Worker {
361*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference0, -1.0f, 1.0f));
362*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference1, -1.0f, 1.0f));
363*35238bceSAndroid Build Coastguard Worker 
364*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
365*35238bceSAndroid Build Coastguard Worker     using tcu::toHex;
366*35238bceSAndroid Build Coastguard Worker 
367*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint[2]> floatVector2;
368*35238bceSAndroid Build Coastguard Worker     glGetIntegerv(name, floatVector2);
369*35238bceSAndroid Build Coastguard Worker 
370*35238bceSAndroid Build Coastguard Worker     if (!floatVector2.verifyValidity(testCtx))
371*35238bceSAndroid Build Coastguard Worker         return;
372*35238bceSAndroid Build Coastguard Worker 
373*35238bceSAndroid Build Coastguard Worker     const GLint referenceAsGLintMin[] = {clampToGLint(expandGLFloatToInteger(reference0) - FLOAT_EXPANSION_E),
374*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference1) - FLOAT_EXPANSION_E)};
375*35238bceSAndroid Build Coastguard Worker     const GLint referenceAsGLintMax[] = {clampToGLint(expandGLFloatToInteger(reference0) + FLOAT_EXPANSION_E),
376*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference1) + FLOAT_EXPANSION_E)};
377*35238bceSAndroid Build Coastguard Worker 
378*35238bceSAndroid Build Coastguard Worker     if (floatVector2[0] < referenceAsGLintMin[0] || floatVector2[0] > referenceAsGLintMax[0] ||
379*35238bceSAndroid Build Coastguard Worker         floatVector2[1] < referenceAsGLintMin[1] || floatVector2[1] > referenceAsGLintMax[1])
380*35238bceSAndroid Build Coastguard Worker     {
381*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected in ranges "
382*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[0]) << " " << toHex(referenceAsGLintMax[0]) << "], "
383*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[1]) << " " << toHex(referenceAsGLintMax[1]) << "]"
384*35238bceSAndroid Build Coastguard Worker                          << "; got " << toHex(floatVector2[0]) << ", " << toHex(floatVector2[1]) << " "
385*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
386*35238bceSAndroid Build Coastguard Worker 
387*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
388*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
389*35238bceSAndroid Build Coastguard Worker     }
390*35238bceSAndroid Build Coastguard Worker }
391*35238bceSAndroid Build Coastguard Worker 
verifyFloat4Color(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1,GLfloat reference2,GLfloat reference3)392*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
393*35238bceSAndroid Build Coastguard Worker                                            GLfloat reference1, GLfloat reference2, GLfloat reference3)
394*35238bceSAndroid Build Coastguard Worker {
395*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
396*35238bceSAndroid Build Coastguard Worker     using tcu::toHex;
397*35238bceSAndroid Build Coastguard Worker 
398*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint[4]> floatVector4;
399*35238bceSAndroid Build Coastguard Worker     glGetIntegerv(name, floatVector4);
400*35238bceSAndroid Build Coastguard Worker 
401*35238bceSAndroid Build Coastguard Worker     if (!floatVector4.verifyValidity(testCtx))
402*35238bceSAndroid Build Coastguard Worker         return;
403*35238bceSAndroid Build Coastguard Worker 
404*35238bceSAndroid Build Coastguard Worker     const GLint referenceAsGLintMin[] = {clampToGLint(expandGLFloatToInteger(reference0) - FLOAT_EXPANSION_E),
405*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference1) - FLOAT_EXPANSION_E),
406*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference2) - FLOAT_EXPANSION_E),
407*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference3) - FLOAT_EXPANSION_E)};
408*35238bceSAndroid Build Coastguard Worker     const GLint referenceAsGLintMax[] = {clampToGLint(expandGLFloatToInteger(reference0) + FLOAT_EXPANSION_E),
409*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference1) + FLOAT_EXPANSION_E),
410*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference2) + FLOAT_EXPANSION_E),
411*35238bceSAndroid Build Coastguard Worker                                          clampToGLint(expandGLFloatToInteger(reference3) + FLOAT_EXPANSION_E)};
412*35238bceSAndroid Build Coastguard Worker 
413*35238bceSAndroid Build Coastguard Worker     if (floatVector4[0] < referenceAsGLintMin[0] || floatVector4[0] > referenceAsGLintMax[0] ||
414*35238bceSAndroid Build Coastguard Worker         floatVector4[1] < referenceAsGLintMin[1] || floatVector4[1] > referenceAsGLintMax[1] ||
415*35238bceSAndroid Build Coastguard Worker         floatVector4[2] < referenceAsGLintMin[2] || floatVector4[2] > referenceAsGLintMax[2] ||
416*35238bceSAndroid Build Coastguard Worker         floatVector4[3] < referenceAsGLintMin[3] || floatVector4[3] > referenceAsGLintMax[3])
417*35238bceSAndroid Build Coastguard Worker     {
418*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected in ranges "
419*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[0]) << " " << toHex(referenceAsGLintMax[0]) << "], "
420*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[1]) << " " << toHex(referenceAsGLintMax[1]) << "], "
421*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[2]) << " " << toHex(referenceAsGLintMax[2]) << "], "
422*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[3]) << " " << toHex(referenceAsGLintMax[3]) << "]"
423*35238bceSAndroid Build Coastguard Worker                          << "; got " << toHex(floatVector4[0]) << ", " << toHex(floatVector4[1]) << ", "
424*35238bceSAndroid Build Coastguard Worker                          << toHex(floatVector4[2]) << ", " << toHex(floatVector4[3]) << " " << TestLog::EndMessage;
425*35238bceSAndroid Build Coastguard Worker 
426*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
427*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
428*35238bceSAndroid Build Coastguard Worker     }
429*35238bceSAndroid Build Coastguard Worker }
430*35238bceSAndroid Build Coastguard Worker 
verifyFloatRange(tcu::TestContext & testCtx,GLenum name,GLfloat min,GLfloat max)431*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max)
432*35238bceSAndroid Build Coastguard Worker {
433*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
434*35238bceSAndroid Build Coastguard Worker 
435*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint[2]> range;
436*35238bceSAndroid Build Coastguard Worker     glGetIntegerv(name, range);
437*35238bceSAndroid Build Coastguard Worker 
438*35238bceSAndroid Build Coastguard Worker     if (!range.verifyValidity(testCtx))
439*35238bceSAndroid Build Coastguard Worker         return;
440*35238bceSAndroid Build Coastguard Worker 
441*35238bceSAndroid Build Coastguard Worker     const GLint testRangeAsGLint[] = {StateQueryUtil::roundGLfloatToNearestIntegerHalfUp<GLint>(min),
442*35238bceSAndroid Build Coastguard Worker                                       StateQueryUtil::roundGLfloatToNearestIntegerHalfDown<GLint>(max)};
443*35238bceSAndroid Build Coastguard Worker 
444*35238bceSAndroid Build Coastguard Worker     // check if test range outside of gl state range
445*35238bceSAndroid Build Coastguard Worker     if (testRangeAsGLint[0] < range[0] || testRangeAsGLint[1] > range[1])
446*35238bceSAndroid Build Coastguard Worker     {
447*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: range [" << testRangeAsGLint[0] << ", "
448*35238bceSAndroid Build Coastguard Worker                          << testRangeAsGLint[1] << "]"
449*35238bceSAndroid Build Coastguard Worker                          << " is not in range [" << range[0] << ", " << range[1] << "]" << TestLog::EndMessage;
450*35238bceSAndroid Build Coastguard Worker 
451*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
452*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer range");
453*35238bceSAndroid Build Coastguard Worker     }
454*35238bceSAndroid Build Coastguard Worker }
455*35238bceSAndroid Build Coastguard Worker 
verifyFloatGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLfloat reference)456*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
457*35238bceSAndroid Build Coastguard Worker {
458*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
459*35238bceSAndroid Build Coastguard Worker 
460*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint> state;
461*35238bceSAndroid Build Coastguard Worker     glGetIntegerv(name, &state);
462*35238bceSAndroid Build Coastguard Worker 
463*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
464*35238bceSAndroid Build Coastguard Worker         return;
465*35238bceSAndroid Build Coastguard Worker 
466*35238bceSAndroid Build Coastguard Worker     const GLint referenceAsInt = StateQueryUtil::roundGLfloatToNearestIntegerHalfDown<GLint>(reference);
467*35238bceSAndroid Build Coastguard Worker 
468*35238bceSAndroid Build Coastguard Worker     if (state < referenceAsInt)
469*35238bceSAndroid Build Coastguard Worker     {
470*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected expected greater or equal to " << referenceAsInt
471*35238bceSAndroid Build Coastguard Worker                          << "; got " << state << TestLog::EndMessage;
472*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
473*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
474*35238bceSAndroid Build Coastguard Worker     }
475*35238bceSAndroid Build Coastguard Worker }
476*35238bceSAndroid Build Coastguard Worker 
477*35238bceSAndroid Build Coastguard Worker //GetInteger64Verifier
478*35238bceSAndroid Build Coastguard Worker 
479*35238bceSAndroid Build Coastguard Worker class GetInteger64Verifier : public StateVerifier
480*35238bceSAndroid Build Coastguard Worker {
481*35238bceSAndroid Build Coastguard Worker public:
482*35238bceSAndroid Build Coastguard Worker     GetInteger64Verifier(const glw::Functions &gl, tcu::TestLog &log);
483*35238bceSAndroid Build Coastguard Worker     void verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
484*35238bceSAndroid Build Coastguard Worker     void verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
485*35238bceSAndroid Build Coastguard Worker     void verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1);
486*35238bceSAndroid Build Coastguard Worker     void verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1,
487*35238bceSAndroid Build Coastguard Worker                            GLfloat reference2, GLfloat reference3);
488*35238bceSAndroid Build Coastguard Worker     void verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max);
489*35238bceSAndroid Build Coastguard Worker     void verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
490*35238bceSAndroid Build Coastguard Worker };
491*35238bceSAndroid Build Coastguard Worker 
GetInteger64Verifier(const glw::Functions & gl,tcu::TestLog & log)492*35238bceSAndroid Build Coastguard Worker GetInteger64Verifier::GetInteger64Verifier(const glw::Functions &gl, tcu::TestLog &log)
493*35238bceSAndroid Build Coastguard Worker     : StateVerifier(gl, log, "_getinteger64")
494*35238bceSAndroid Build Coastguard Worker {
495*35238bceSAndroid Build Coastguard Worker }
496*35238bceSAndroid Build Coastguard Worker 
verifyFloat(tcu::TestContext & testCtx,GLenum name,GLfloat reference)497*35238bceSAndroid Build Coastguard Worker void GetInteger64Verifier::verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
498*35238bceSAndroid Build Coastguard Worker {
499*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
500*35238bceSAndroid Build Coastguard Worker 
501*35238bceSAndroid Build Coastguard Worker     const GLint64 expectedGLStateMax = StateQueryUtil::roundGLfloatToNearestIntegerHalfUp<GLint64>(reference);
502*35238bceSAndroid Build Coastguard Worker     const GLint64 expectedGLStateMin = StateQueryUtil::roundGLfloatToNearestIntegerHalfDown<GLint64>(reference);
503*35238bceSAndroid Build Coastguard Worker 
504*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64> state;
505*35238bceSAndroid Build Coastguard Worker     glGetInteger64v(name, &state);
506*35238bceSAndroid Build Coastguard Worker 
507*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
508*35238bceSAndroid Build Coastguard Worker         return;
509*35238bceSAndroid Build Coastguard Worker 
510*35238bceSAndroid Build Coastguard Worker     if (state < expectedGLStateMin || state > expectedGLStateMax)
511*35238bceSAndroid Build Coastguard Worker     {
512*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected rounding to the nearest integer, valid range ["
513*35238bceSAndroid Build Coastguard Worker                          << expectedGLStateMin << "," << expectedGLStateMax << "]; got " << state
514*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
515*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
516*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
517*35238bceSAndroid Build Coastguard Worker     }
518*35238bceSAndroid Build Coastguard Worker }
519*35238bceSAndroid Build Coastguard Worker 
verifyFloatExpanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference)520*35238bceSAndroid Build Coastguard Worker void GetInteger64Verifier::verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
521*35238bceSAndroid Build Coastguard Worker {
522*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference, -1.0f, 1.0f));
523*35238bceSAndroid Build Coastguard Worker 
524*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
525*35238bceSAndroid Build Coastguard Worker     using tcu::toHex;
526*35238bceSAndroid Build Coastguard Worker 
527*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64> state;
528*35238bceSAndroid Build Coastguard Worker     glGetInteger64v(name, &state);
529*35238bceSAndroid Build Coastguard Worker 
530*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
531*35238bceSAndroid Build Coastguard Worker         return;
532*35238bceSAndroid Build Coastguard Worker 
533*35238bceSAndroid Build Coastguard Worker     const GLint64 expectedGLStateMax = expandGLFloatToInteger(reference) + FLOAT_EXPANSION_E_64;
534*35238bceSAndroid Build Coastguard Worker     const GLint64 expectedGLStateMin = expandGLFloatToInteger(reference) - FLOAT_EXPANSION_E_64;
535*35238bceSAndroid Build Coastguard Worker 
536*35238bceSAndroid Build Coastguard Worker     if (state < expectedGLStateMin || state > expectedGLStateMax)
537*35238bceSAndroid Build Coastguard Worker     {
538*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected in range [" << toHex(expectedGLStateMin) << ","
539*35238bceSAndroid Build Coastguard Worker                          << toHex(expectedGLStateMax) << "]; got " << toHex((GLint64)state) << TestLog::EndMessage;
540*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
541*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
542*35238bceSAndroid Build Coastguard Worker     }
543*35238bceSAndroid Build Coastguard Worker }
544*35238bceSAndroid Build Coastguard Worker 
verifyFloat2Expanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1)545*35238bceSAndroid Build Coastguard Worker void GetInteger64Verifier::verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
546*35238bceSAndroid Build Coastguard Worker                                                 GLfloat reference1)
547*35238bceSAndroid Build Coastguard Worker {
548*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference0, -1.0f, 1.0f));
549*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference1, -1.0f, 1.0f));
550*35238bceSAndroid Build Coastguard Worker 
551*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
552*35238bceSAndroid Build Coastguard Worker     using tcu::toHex;
553*35238bceSAndroid Build Coastguard Worker 
554*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64[2]> floatVector2;
555*35238bceSAndroid Build Coastguard Worker     glGetInteger64v(name, floatVector2);
556*35238bceSAndroid Build Coastguard Worker 
557*35238bceSAndroid Build Coastguard Worker     if (!floatVector2.verifyValidity(testCtx))
558*35238bceSAndroid Build Coastguard Worker         return;
559*35238bceSAndroid Build Coastguard Worker 
560*35238bceSAndroid Build Coastguard Worker     const GLint64 referenceAsGLintMin[] = {expandGLFloatToInteger(reference0) - FLOAT_EXPANSION_E_64,
561*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference1) - FLOAT_EXPANSION_E_64};
562*35238bceSAndroid Build Coastguard Worker     const GLint64 referenceAsGLintMax[] = {expandGLFloatToInteger(reference0) + FLOAT_EXPANSION_E_64,
563*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference1) + FLOAT_EXPANSION_E_64};
564*35238bceSAndroid Build Coastguard Worker 
565*35238bceSAndroid Build Coastguard Worker     if (floatVector2[0] < referenceAsGLintMin[0] || floatVector2[0] > referenceAsGLintMax[0] ||
566*35238bceSAndroid Build Coastguard Worker         floatVector2[1] < referenceAsGLintMin[1] || floatVector2[1] > referenceAsGLintMax[1])
567*35238bceSAndroid Build Coastguard Worker     {
568*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected in ranges "
569*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[0]) << " " << toHex(referenceAsGLintMax[0]) << "], "
570*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[1]) << " " << toHex(referenceAsGLintMax[1]) << "]"
571*35238bceSAndroid Build Coastguard Worker                          << "; got " << toHex(floatVector2[0]) << ", " << toHex(floatVector2[1]) << " "
572*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
573*35238bceSAndroid Build Coastguard Worker 
574*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
575*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
576*35238bceSAndroid Build Coastguard Worker     }
577*35238bceSAndroid Build Coastguard Worker }
578*35238bceSAndroid Build Coastguard Worker 
verifyFloat4Color(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1,GLfloat reference2,GLfloat reference3)579*35238bceSAndroid Build Coastguard Worker void GetInteger64Verifier::verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
580*35238bceSAndroid Build Coastguard Worker                                              GLfloat reference1, GLfloat reference2, GLfloat reference3)
581*35238bceSAndroid Build Coastguard Worker {
582*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
583*35238bceSAndroid Build Coastguard Worker     using tcu::toHex;
584*35238bceSAndroid Build Coastguard Worker 
585*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64[4]> floatVector4;
586*35238bceSAndroid Build Coastguard Worker     glGetInteger64v(name, floatVector4);
587*35238bceSAndroid Build Coastguard Worker 
588*35238bceSAndroid Build Coastguard Worker     if (!floatVector4.verifyValidity(testCtx))
589*35238bceSAndroid Build Coastguard Worker         return;
590*35238bceSAndroid Build Coastguard Worker 
591*35238bceSAndroid Build Coastguard Worker     const GLint64 referenceAsGLintMin[] = {expandGLFloatToInteger(reference0) - FLOAT_EXPANSION_E_64,
592*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference1) - FLOAT_EXPANSION_E_64,
593*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference2) - FLOAT_EXPANSION_E_64,
594*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference3) - FLOAT_EXPANSION_E_64};
595*35238bceSAndroid Build Coastguard Worker     const GLint64 referenceAsGLintMax[] = {expandGLFloatToInteger(reference0) + FLOAT_EXPANSION_E_64,
596*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference1) + FLOAT_EXPANSION_E_64,
597*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference2) + FLOAT_EXPANSION_E_64,
598*35238bceSAndroid Build Coastguard Worker                                            expandGLFloatToInteger(reference3) + FLOAT_EXPANSION_E_64};
599*35238bceSAndroid Build Coastguard Worker 
600*35238bceSAndroid Build Coastguard Worker     if (floatVector4[0] < referenceAsGLintMin[0] || floatVector4[0] > referenceAsGLintMax[0] ||
601*35238bceSAndroid Build Coastguard Worker         floatVector4[1] < referenceAsGLintMin[1] || floatVector4[1] > referenceAsGLintMax[1] ||
602*35238bceSAndroid Build Coastguard Worker         floatVector4[2] < referenceAsGLintMin[2] || floatVector4[2] > referenceAsGLintMax[2] ||
603*35238bceSAndroid Build Coastguard Worker         floatVector4[3] < referenceAsGLintMin[3] || floatVector4[3] > referenceAsGLintMax[3])
604*35238bceSAndroid Build Coastguard Worker     {
605*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected in ranges "
606*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[0]) << " " << toHex(referenceAsGLintMax[0]) << "], "
607*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[1]) << " " << toHex(referenceAsGLintMax[1]) << "], "
608*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[2]) << " " << toHex(referenceAsGLintMax[2]) << "], "
609*35238bceSAndroid Build Coastguard Worker                          << "[" << toHex(referenceAsGLintMin[3]) << " " << toHex(referenceAsGLintMax[3]) << "]"
610*35238bceSAndroid Build Coastguard Worker                          << "; got " << toHex(floatVector4[0]) << ", " << toHex(floatVector4[1]) << ", "
611*35238bceSAndroid Build Coastguard Worker                          << toHex(floatVector4[2]) << ", " << toHex(floatVector4[3]) << " " << TestLog::EndMessage;
612*35238bceSAndroid Build Coastguard Worker 
613*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
614*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
615*35238bceSAndroid Build Coastguard Worker     }
616*35238bceSAndroid Build Coastguard Worker }
617*35238bceSAndroid Build Coastguard Worker 
verifyFloatRange(tcu::TestContext & testCtx,GLenum name,GLfloat min,GLfloat max)618*35238bceSAndroid Build Coastguard Worker void GetInteger64Verifier::verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max)
619*35238bceSAndroid Build Coastguard Worker {
620*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
621*35238bceSAndroid Build Coastguard Worker 
622*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64[2]> range;
623*35238bceSAndroid Build Coastguard Worker     glGetInteger64v(name, range);
624*35238bceSAndroid Build Coastguard Worker 
625*35238bceSAndroid Build Coastguard Worker     if (!range.verifyValidity(testCtx))
626*35238bceSAndroid Build Coastguard Worker         return;
627*35238bceSAndroid Build Coastguard Worker 
628*35238bceSAndroid Build Coastguard Worker     const GLint64 testRangeAsGLint[] = {StateQueryUtil::roundGLfloatToNearestIntegerHalfUp<GLint64>(min),
629*35238bceSAndroid Build Coastguard Worker                                         StateQueryUtil::roundGLfloatToNearestIntegerHalfDown<GLint64>(max)};
630*35238bceSAndroid Build Coastguard Worker 
631*35238bceSAndroid Build Coastguard Worker     // check if test range outside of gl state range
632*35238bceSAndroid Build Coastguard Worker     if (testRangeAsGLint[0] < range[0] || testRangeAsGLint[1] > range[1])
633*35238bceSAndroid Build Coastguard Worker     {
634*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: range [" << testRangeAsGLint[0] << ", "
635*35238bceSAndroid Build Coastguard Worker                          << testRangeAsGLint[1] << "]"
636*35238bceSAndroid Build Coastguard Worker                          << " is not in range [" << range[0] << ", " << range[1] << "]" << TestLog::EndMessage;
637*35238bceSAndroid Build Coastguard Worker 
638*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
639*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer range");
640*35238bceSAndroid Build Coastguard Worker     }
641*35238bceSAndroid Build Coastguard Worker }
642*35238bceSAndroid Build Coastguard Worker 
verifyFloatGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLfloat reference)643*35238bceSAndroid Build Coastguard Worker void GetInteger64Verifier::verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
644*35238bceSAndroid Build Coastguard Worker {
645*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
646*35238bceSAndroid Build Coastguard Worker 
647*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLint64> state;
648*35238bceSAndroid Build Coastguard Worker     glGetInteger64v(name, &state);
649*35238bceSAndroid Build Coastguard Worker 
650*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
651*35238bceSAndroid Build Coastguard Worker         return;
652*35238bceSAndroid Build Coastguard Worker 
653*35238bceSAndroid Build Coastguard Worker     const GLint64 referenceAsInt = StateQueryUtil::roundGLfloatToNearestIntegerHalfDown<GLint64>(reference);
654*35238bceSAndroid Build Coastguard Worker 
655*35238bceSAndroid Build Coastguard Worker     if (state < referenceAsInt)
656*35238bceSAndroid Build Coastguard Worker     {
657*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected expected greater or equal to " << referenceAsInt
658*35238bceSAndroid Build Coastguard Worker                          << "; got " << state << TestLog::EndMessage;
659*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
660*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
661*35238bceSAndroid Build Coastguard Worker     }
662*35238bceSAndroid Build Coastguard Worker }
663*35238bceSAndroid Build Coastguard Worker 
664*35238bceSAndroid Build Coastguard Worker //GetFloatVerifier
665*35238bceSAndroid Build Coastguard Worker 
666*35238bceSAndroid Build Coastguard Worker class GetFloatVerifier : public StateVerifier
667*35238bceSAndroid Build Coastguard Worker {
668*35238bceSAndroid Build Coastguard Worker public:
669*35238bceSAndroid Build Coastguard Worker     GetFloatVerifier(const glw::Functions &gl, tcu::TestLog &log);
670*35238bceSAndroid Build Coastguard Worker     void verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
671*35238bceSAndroid Build Coastguard Worker     void verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
672*35238bceSAndroid Build Coastguard Worker     void verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1);
673*35238bceSAndroid Build Coastguard Worker     void verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1,
674*35238bceSAndroid Build Coastguard Worker                            GLfloat reference2, GLfloat reference3);
675*35238bceSAndroid Build Coastguard Worker     void verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max);
676*35238bceSAndroid Build Coastguard Worker     void verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference);
677*35238bceSAndroid Build Coastguard Worker };
678*35238bceSAndroid Build Coastguard Worker 
GetFloatVerifier(const glw::Functions & gl,tcu::TestLog & log)679*35238bceSAndroid Build Coastguard Worker GetFloatVerifier::GetFloatVerifier(const glw::Functions &gl, tcu::TestLog &log) : StateVerifier(gl, log, "_getfloat")
680*35238bceSAndroid Build Coastguard Worker {
681*35238bceSAndroid Build Coastguard Worker }
682*35238bceSAndroid Build Coastguard Worker 
verifyFloat(tcu::TestContext & testCtx,GLenum name,GLfloat reference)683*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyFloat(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
684*35238bceSAndroid Build Coastguard Worker {
685*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
686*35238bceSAndroid Build Coastguard Worker 
687*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLfloat> state;
688*35238bceSAndroid Build Coastguard Worker     glGetFloatv(name, &state);
689*35238bceSAndroid Build Coastguard Worker 
690*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
691*35238bceSAndroid Build Coastguard Worker         return;
692*35238bceSAndroid Build Coastguard Worker 
693*35238bceSAndroid Build Coastguard Worker     if (state != reference)
694*35238bceSAndroid Build Coastguard Worker     {
695*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state
696*35238bceSAndroid Build Coastguard Worker                          << TestLog::EndMessage;
697*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
698*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
699*35238bceSAndroid Build Coastguard Worker     }
700*35238bceSAndroid Build Coastguard Worker }
701*35238bceSAndroid Build Coastguard Worker 
verifyFloatExpanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference)702*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyFloatExpanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
703*35238bceSAndroid Build Coastguard Worker {
704*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference, -1.0f, 1.0f));
705*35238bceSAndroid Build Coastguard Worker     verifyFloat(testCtx, name, reference);
706*35238bceSAndroid Build Coastguard Worker }
707*35238bceSAndroid Build Coastguard Worker 
verifyFloat2Expanded(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1)708*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyFloat2Expanded(tcu::TestContext &testCtx, GLenum name, GLfloat reference0,
709*35238bceSAndroid Build Coastguard Worker                                             GLfloat reference1)
710*35238bceSAndroid Build Coastguard Worker {
711*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference0, -1.0f, 1.0f));
712*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(de::inRange(reference1, -1.0f, 1.0f));
713*35238bceSAndroid Build Coastguard Worker 
714*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
715*35238bceSAndroid Build Coastguard Worker 
716*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLfloat[2]> floatVector2;
717*35238bceSAndroid Build Coastguard Worker     glGetFloatv(name, floatVector2);
718*35238bceSAndroid Build Coastguard Worker 
719*35238bceSAndroid Build Coastguard Worker     if (!floatVector2.verifyValidity(testCtx))
720*35238bceSAndroid Build Coastguard Worker         return;
721*35238bceSAndroid Build Coastguard Worker 
722*35238bceSAndroid Build Coastguard Worker     if (floatVector2[0] != reference0 || floatVector2[1] != reference1)
723*35238bceSAndroid Build Coastguard Worker     {
724*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference0 << ", " << reference1 << "; got "
725*35238bceSAndroid Build Coastguard Worker                          << floatVector2[0] << " " << floatVector2[1] << TestLog::EndMessage;
726*35238bceSAndroid Build Coastguard Worker 
727*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
728*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
729*35238bceSAndroid Build Coastguard Worker     }
730*35238bceSAndroid Build Coastguard Worker }
731*35238bceSAndroid Build Coastguard Worker 
verifyFloat4Color(tcu::TestContext & testCtx,GLenum name,GLfloat reference0,GLfloat reference1,GLfloat reference2,GLfloat reference3)732*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyFloat4Color(tcu::TestContext &testCtx, GLenum name, GLfloat reference0, GLfloat reference1,
733*35238bceSAndroid Build Coastguard Worker                                          GLfloat reference2, GLfloat reference3)
734*35238bceSAndroid Build Coastguard Worker {
735*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
736*35238bceSAndroid Build Coastguard Worker 
737*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLfloat[4]> floatVector4;
738*35238bceSAndroid Build Coastguard Worker     glGetFloatv(name, floatVector4);
739*35238bceSAndroid Build Coastguard Worker 
740*35238bceSAndroid Build Coastguard Worker     if (!floatVector4.verifyValidity(testCtx))
741*35238bceSAndroid Build Coastguard Worker         return;
742*35238bceSAndroid Build Coastguard Worker 
743*35238bceSAndroid Build Coastguard Worker     if (floatVector4[0] != reference0 || floatVector4[1] != reference1 || floatVector4[2] != reference2 ||
744*35238bceSAndroid Build Coastguard Worker         floatVector4[3] != reference3)
745*35238bceSAndroid Build Coastguard Worker     {
746*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference0 << ", " << reference1 << ", "
747*35238bceSAndroid Build Coastguard Worker                          << reference2 << ", " << reference3 << "; got " << floatVector4[0] << ", " << floatVector4[1]
748*35238bceSAndroid Build Coastguard Worker                          << ", " << floatVector4[2] << ", " << floatVector4[3] << TestLog::EndMessage;
749*35238bceSAndroid Build Coastguard Worker 
750*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
751*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
752*35238bceSAndroid Build Coastguard Worker     }
753*35238bceSAndroid Build Coastguard Worker }
754*35238bceSAndroid Build Coastguard Worker 
verifyFloatRange(tcu::TestContext & testCtx,GLenum name,GLfloat min,GLfloat max)755*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyFloatRange(tcu::TestContext &testCtx, GLenum name, GLfloat min, GLfloat max)
756*35238bceSAndroid Build Coastguard Worker {
757*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
758*35238bceSAndroid Build Coastguard Worker 
759*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLfloat[2]> floatVector2;
760*35238bceSAndroid Build Coastguard Worker     glGetFloatv(name, floatVector2);
761*35238bceSAndroid Build Coastguard Worker 
762*35238bceSAndroid Build Coastguard Worker     if (!floatVector2.verifyValidity(testCtx))
763*35238bceSAndroid Build Coastguard Worker         return;
764*35238bceSAndroid Build Coastguard Worker 
765*35238bceSAndroid Build Coastguard Worker     if (floatVector2[0] > min || floatVector2[1] < max)
766*35238bceSAndroid Build Coastguard Worker     {
767*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected in range [" << min << ", " << max << "]; got ["
768*35238bceSAndroid Build Coastguard Worker                          << floatVector2[0] << " " << floatVector2[1] << "]" << TestLog::EndMessage;
769*35238bceSAndroid Build Coastguard Worker 
770*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
771*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float range");
772*35238bceSAndroid Build Coastguard Worker     }
773*35238bceSAndroid Build Coastguard Worker }
774*35238bceSAndroid Build Coastguard Worker 
verifyFloatGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLfloat reference)775*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyFloatGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLfloat reference)
776*35238bceSAndroid Build Coastguard Worker {
777*35238bceSAndroid Build Coastguard Worker     using tcu::TestLog;
778*35238bceSAndroid Build Coastguard Worker 
779*35238bceSAndroid Build Coastguard Worker     StateQueryMemoryWriteGuard<GLfloat> state;
780*35238bceSAndroid Build Coastguard Worker     glGetFloatv(name, &state);
781*35238bceSAndroid Build Coastguard Worker 
782*35238bceSAndroid Build Coastguard Worker     if (!state.verifyValidity(testCtx))
783*35238bceSAndroid Build Coastguard Worker         return;
784*35238bceSAndroid Build Coastguard Worker 
785*35238bceSAndroid Build Coastguard Worker     if (state < reference)
786*35238bceSAndroid Build Coastguard Worker     {
787*35238bceSAndroid Build Coastguard Worker         testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << reference << "; got "
788*35238bceSAndroid Build Coastguard Worker                          << state << TestLog::EndMessage;
789*35238bceSAndroid Build Coastguard Worker         if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
790*35238bceSAndroid Build Coastguard Worker             testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
791*35238bceSAndroid Build Coastguard Worker     }
792*35238bceSAndroid Build Coastguard Worker }
793*35238bceSAndroid Build Coastguard Worker 
794*35238bceSAndroid Build Coastguard Worker } // namespace FloatStateQueryVerifiers
795*35238bceSAndroid Build Coastguard Worker 
796*35238bceSAndroid Build Coastguard Worker namespace
797*35238bceSAndroid Build Coastguard Worker {
798*35238bceSAndroid Build Coastguard Worker 
799*35238bceSAndroid Build Coastguard Worker using namespace FloatStateQueryVerifiers;
800*35238bceSAndroid Build Coastguard Worker 
801*35238bceSAndroid Build Coastguard Worker class DepthRangeCase : public ApiCase
802*35238bceSAndroid Build Coastguard Worker {
803*35238bceSAndroid Build Coastguard Worker public:
DepthRangeCase(Context & context,StateVerifier * verifier,const char * name,const char * description)804*35238bceSAndroid Build Coastguard Worker     DepthRangeCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
805*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
806*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
807*35238bceSAndroid Build Coastguard Worker     {
808*35238bceSAndroid Build Coastguard Worker     }
809*35238bceSAndroid Build Coastguard Worker 
test(void)810*35238bceSAndroid Build Coastguard Worker     void test(void)
811*35238bceSAndroid Build Coastguard Worker     {
812*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
813*35238bceSAndroid Build Coastguard Worker 
814*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloat2Expanded(m_testCtx, GL_DEPTH_RANGE, 0.0f, 1.0f);
815*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
816*35238bceSAndroid Build Coastguard Worker 
817*35238bceSAndroid Build Coastguard Worker         const struct FixedTest
818*35238bceSAndroid Build Coastguard Worker         {
819*35238bceSAndroid Build Coastguard Worker             float n, f;
820*35238bceSAndroid Build Coastguard Worker         } fixedTests[] = {{0.5f, 1.0f}, {0.0f, 0.5f}, {0.0f, 0.0f}, {1.0f, 1.0f}};
821*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(fixedTests); ++ndx)
822*35238bceSAndroid Build Coastguard Worker         {
823*35238bceSAndroid Build Coastguard Worker             glDepthRangef(fixedTests[ndx].n, fixedTests[ndx].f);
824*35238bceSAndroid Build Coastguard Worker 
825*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat2Expanded(m_testCtx, GL_DEPTH_RANGE, fixedTests[ndx].n, fixedTests[ndx].f);
826*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
827*35238bceSAndroid Build Coastguard Worker         }
828*35238bceSAndroid Build Coastguard Worker 
829*35238bceSAndroid Build Coastguard Worker         const int numIterations = 120;
830*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
831*35238bceSAndroid Build Coastguard Worker         {
832*35238bceSAndroid Build Coastguard Worker             GLfloat n = rnd.getFloat(0, 1);
833*35238bceSAndroid Build Coastguard Worker             GLfloat f = rnd.getFloat(0, 1);
834*35238bceSAndroid Build Coastguard Worker 
835*35238bceSAndroid Build Coastguard Worker             glDepthRangef(n, f);
836*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat2Expanded(m_testCtx, GL_DEPTH_RANGE, n, f);
837*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
838*35238bceSAndroid Build Coastguard Worker         }
839*35238bceSAndroid Build Coastguard Worker     }
840*35238bceSAndroid Build Coastguard Worker 
841*35238bceSAndroid Build Coastguard Worker private:
842*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
843*35238bceSAndroid Build Coastguard Worker };
844*35238bceSAndroid Build Coastguard Worker 
845*35238bceSAndroid Build Coastguard Worker class LineWidthCase : public ApiCase
846*35238bceSAndroid Build Coastguard Worker {
847*35238bceSAndroid Build Coastguard Worker public:
LineWidthCase(Context & context,StateVerifier * verifier,const char * name,const char * description)848*35238bceSAndroid Build Coastguard Worker     LineWidthCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
849*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
850*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
851*35238bceSAndroid Build Coastguard Worker     {
852*35238bceSAndroid Build Coastguard Worker     }
853*35238bceSAndroid Build Coastguard Worker 
test(void)854*35238bceSAndroid Build Coastguard Worker     void test(void)
855*35238bceSAndroid Build Coastguard Worker     {
856*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
857*35238bceSAndroid Build Coastguard Worker 
858*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloat(m_testCtx, GL_LINE_WIDTH, 1.0f);
859*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
860*35238bceSAndroid Build Coastguard Worker 
861*35238bceSAndroid Build Coastguard Worker         GLfloat range[2] = {1};
862*35238bceSAndroid Build Coastguard Worker         glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
863*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
864*35238bceSAndroid Build Coastguard Worker 
865*35238bceSAndroid Build Coastguard Worker         const int numIterations = 120;
866*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
867*35238bceSAndroid Build Coastguard Worker         {
868*35238bceSAndroid Build Coastguard Worker             const GLfloat reference = rnd.getFloat(range[0], range[1]);
869*35238bceSAndroid Build Coastguard Worker 
870*35238bceSAndroid Build Coastguard Worker             glLineWidth(reference);
871*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat(m_testCtx, GL_LINE_WIDTH, reference);
872*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
873*35238bceSAndroid Build Coastguard Worker         }
874*35238bceSAndroid Build Coastguard Worker     }
875*35238bceSAndroid Build Coastguard Worker 
876*35238bceSAndroid Build Coastguard Worker private:
877*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
878*35238bceSAndroid Build Coastguard Worker };
879*35238bceSAndroid Build Coastguard Worker 
880*35238bceSAndroid Build Coastguard Worker class PolygonOffsetFactorCase : public ApiCase
881*35238bceSAndroid Build Coastguard Worker {
882*35238bceSAndroid Build Coastguard Worker public:
PolygonOffsetFactorCase(Context & context,StateVerifier * verifier,const char * name,const char * description)883*35238bceSAndroid Build Coastguard Worker     PolygonOffsetFactorCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
884*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
885*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
886*35238bceSAndroid Build Coastguard Worker     {
887*35238bceSAndroid Build Coastguard Worker     }
888*35238bceSAndroid Build Coastguard Worker 
test(void)889*35238bceSAndroid Build Coastguard Worker     void test(void)
890*35238bceSAndroid Build Coastguard Worker     {
891*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
892*35238bceSAndroid Build Coastguard Worker 
893*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloat(m_testCtx, GL_POLYGON_OFFSET_FACTOR, 0.0f);
894*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
895*35238bceSAndroid Build Coastguard Worker 
896*35238bceSAndroid Build Coastguard Worker         const float fixedTests[] = {0.0f, 0.5f, -0.5f, 1.5f};
897*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(fixedTests); ++ndx)
898*35238bceSAndroid Build Coastguard Worker         {
899*35238bceSAndroid Build Coastguard Worker             glPolygonOffset(fixedTests[ndx], 0);
900*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat(m_testCtx, GL_POLYGON_OFFSET_FACTOR, fixedTests[ndx]);
901*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
902*35238bceSAndroid Build Coastguard Worker         }
903*35238bceSAndroid Build Coastguard Worker 
904*35238bceSAndroid Build Coastguard Worker         const int numIterations = 120;
905*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
906*35238bceSAndroid Build Coastguard Worker         {
907*35238bceSAndroid Build Coastguard Worker             const GLfloat reference = rnd.getFloat(-64000, 64000);
908*35238bceSAndroid Build Coastguard Worker 
909*35238bceSAndroid Build Coastguard Worker             glPolygonOffset(reference, 0);
910*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat(m_testCtx, GL_POLYGON_OFFSET_FACTOR, reference);
911*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
912*35238bceSAndroid Build Coastguard Worker         }
913*35238bceSAndroid Build Coastguard Worker     }
914*35238bceSAndroid Build Coastguard Worker 
915*35238bceSAndroid Build Coastguard Worker private:
916*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
917*35238bceSAndroid Build Coastguard Worker };
918*35238bceSAndroid Build Coastguard Worker 
919*35238bceSAndroid Build Coastguard Worker class PolygonOffsetUnitsCase : public ApiCase
920*35238bceSAndroid Build Coastguard Worker {
921*35238bceSAndroid Build Coastguard Worker public:
PolygonOffsetUnitsCase(Context & context,StateVerifier * verifier,const char * name,const char * description)922*35238bceSAndroid Build Coastguard Worker     PolygonOffsetUnitsCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
923*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
924*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
925*35238bceSAndroid Build Coastguard Worker     {
926*35238bceSAndroid Build Coastguard Worker     }
927*35238bceSAndroid Build Coastguard Worker 
test(void)928*35238bceSAndroid Build Coastguard Worker     void test(void)
929*35238bceSAndroid Build Coastguard Worker     {
930*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
931*35238bceSAndroid Build Coastguard Worker 
932*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloat(m_testCtx, GL_POLYGON_OFFSET_UNITS, 0.0f);
933*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
934*35238bceSAndroid Build Coastguard Worker 
935*35238bceSAndroid Build Coastguard Worker         const float fixedTests[] = {0.0f, 0.5f, -0.5f, 1.5f};
936*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(fixedTests); ++ndx)
937*35238bceSAndroid Build Coastguard Worker         {
938*35238bceSAndroid Build Coastguard Worker             glPolygonOffset(0, fixedTests[ndx]);
939*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat(m_testCtx, GL_POLYGON_OFFSET_UNITS, fixedTests[ndx]);
940*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
941*35238bceSAndroid Build Coastguard Worker         }
942*35238bceSAndroid Build Coastguard Worker 
943*35238bceSAndroid Build Coastguard Worker         const int numIterations = 120;
944*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
945*35238bceSAndroid Build Coastguard Worker         {
946*35238bceSAndroid Build Coastguard Worker             const GLfloat reference = rnd.getFloat(-64000, 64000);
947*35238bceSAndroid Build Coastguard Worker 
948*35238bceSAndroid Build Coastguard Worker             glPolygonOffset(0, reference);
949*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat(m_testCtx, GL_POLYGON_OFFSET_UNITS, reference);
950*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
951*35238bceSAndroid Build Coastguard Worker         }
952*35238bceSAndroid Build Coastguard Worker     }
953*35238bceSAndroid Build Coastguard Worker 
954*35238bceSAndroid Build Coastguard Worker private:
955*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
956*35238bceSAndroid Build Coastguard Worker };
957*35238bceSAndroid Build Coastguard Worker 
958*35238bceSAndroid Build Coastguard Worker class SampleCoverageCase : public ApiCase
959*35238bceSAndroid Build Coastguard Worker {
960*35238bceSAndroid Build Coastguard Worker public:
SampleCoverageCase(Context & context,StateVerifier * verifier,const char * name,const char * description)961*35238bceSAndroid Build Coastguard Worker     SampleCoverageCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
962*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
963*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
964*35238bceSAndroid Build Coastguard Worker     {
965*35238bceSAndroid Build Coastguard Worker     }
966*35238bceSAndroid Build Coastguard Worker 
test(void)967*35238bceSAndroid Build Coastguard Worker     void test(void)
968*35238bceSAndroid Build Coastguard Worker     {
969*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
970*35238bceSAndroid Build Coastguard Worker 
971*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloat(m_testCtx, GL_SAMPLE_COVERAGE_VALUE, 1.0f);
972*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
973*35238bceSAndroid Build Coastguard Worker 
974*35238bceSAndroid Build Coastguard Worker         {
975*35238bceSAndroid Build Coastguard Worker             const float fixedTests[] = {0.0f, 0.5f, 0.45f, 0.55f};
976*35238bceSAndroid Build Coastguard Worker             for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(fixedTests); ++ndx)
977*35238bceSAndroid Build Coastguard Worker             {
978*35238bceSAndroid Build Coastguard Worker                 glSampleCoverage(fixedTests[ndx], GL_FALSE);
979*35238bceSAndroid Build Coastguard Worker                 m_verifier->verifyFloat(m_testCtx, GL_SAMPLE_COVERAGE_VALUE, fixedTests[ndx]);
980*35238bceSAndroid Build Coastguard Worker                 expectError(GL_NO_ERROR);
981*35238bceSAndroid Build Coastguard Worker             }
982*35238bceSAndroid Build Coastguard Worker         }
983*35238bceSAndroid Build Coastguard Worker 
984*35238bceSAndroid Build Coastguard Worker         {
985*35238bceSAndroid Build Coastguard Worker             const float clampTests[] = {-1.0f, -1.5f, 1.45f, 3.55f};
986*35238bceSAndroid Build Coastguard Worker             for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(clampTests); ++ndx)
987*35238bceSAndroid Build Coastguard Worker             {
988*35238bceSAndroid Build Coastguard Worker                 glSampleCoverage(clampTests[ndx], GL_FALSE);
989*35238bceSAndroid Build Coastguard Worker                 m_verifier->verifyFloat(m_testCtx, GL_SAMPLE_COVERAGE_VALUE, de::clamp(clampTests[ndx], 0.0f, 1.0f));
990*35238bceSAndroid Build Coastguard Worker                 expectError(GL_NO_ERROR);
991*35238bceSAndroid Build Coastguard Worker             }
992*35238bceSAndroid Build Coastguard Worker         }
993*35238bceSAndroid Build Coastguard Worker 
994*35238bceSAndroid Build Coastguard Worker         {
995*35238bceSAndroid Build Coastguard Worker             const int numIterations = 120;
996*35238bceSAndroid Build Coastguard Worker             for (int i = 0; i < numIterations; ++i)
997*35238bceSAndroid Build Coastguard Worker             {
998*35238bceSAndroid Build Coastguard Worker                 GLfloat reference = rnd.getFloat(0, 1);
999*35238bceSAndroid Build Coastguard Worker                 GLboolean invert  = rnd.getBool() ? GL_TRUE : GL_FALSE;
1000*35238bceSAndroid Build Coastguard Worker 
1001*35238bceSAndroid Build Coastguard Worker                 glSampleCoverage(reference, invert);
1002*35238bceSAndroid Build Coastguard Worker                 m_verifier->verifyFloat(m_testCtx, GL_SAMPLE_COVERAGE_VALUE, reference);
1003*35238bceSAndroid Build Coastguard Worker                 expectError(GL_NO_ERROR);
1004*35238bceSAndroid Build Coastguard Worker             }
1005*35238bceSAndroid Build Coastguard Worker         }
1006*35238bceSAndroid Build Coastguard Worker     }
1007*35238bceSAndroid Build Coastguard Worker 
1008*35238bceSAndroid Build Coastguard Worker private:
1009*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
1010*35238bceSAndroid Build Coastguard Worker };
1011*35238bceSAndroid Build Coastguard Worker 
1012*35238bceSAndroid Build Coastguard Worker class BlendColorCase : public ApiCase
1013*35238bceSAndroid Build Coastguard Worker {
1014*35238bceSAndroid Build Coastguard Worker public:
BlendColorCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1015*35238bceSAndroid Build Coastguard Worker     BlendColorCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1016*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
1017*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
1018*35238bceSAndroid Build Coastguard Worker     {
1019*35238bceSAndroid Build Coastguard Worker     }
1020*35238bceSAndroid Build Coastguard Worker 
test(void)1021*35238bceSAndroid Build Coastguard Worker     void test(void)
1022*35238bceSAndroid Build Coastguard Worker     {
1023*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
1024*35238bceSAndroid Build Coastguard Worker 
1025*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloat4Color(m_testCtx, GL_BLEND_COLOR, 0, 0, 0, 0);
1026*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
1027*35238bceSAndroid Build Coastguard Worker 
1028*35238bceSAndroid Build Coastguard Worker         const struct FixedTest
1029*35238bceSAndroid Build Coastguard Worker         {
1030*35238bceSAndroid Build Coastguard Worker             float r, g, b, a;
1031*35238bceSAndroid Build Coastguard Worker         } fixedTests[] = {
1032*35238bceSAndroid Build Coastguard Worker             {0.5f, 1.0f, 0.5f, 1.0f},
1033*35238bceSAndroid Build Coastguard Worker             {0.0f, 0.5f, 0.0f, 0.5f},
1034*35238bceSAndroid Build Coastguard Worker             {0.0f, 0.0f, 0.0f, 0.0f},
1035*35238bceSAndroid Build Coastguard Worker             {1.0f, 1.0f, 1.0f, 1.0f},
1036*35238bceSAndroid Build Coastguard Worker         };
1037*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(fixedTests); ++ndx)
1038*35238bceSAndroid Build Coastguard Worker         {
1039*35238bceSAndroid Build Coastguard Worker             glBlendColor(fixedTests[ndx].r, fixedTests[ndx].g, fixedTests[ndx].b, fixedTests[ndx].a);
1040*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat4Color(m_testCtx, GL_BLEND_COLOR, fixedTests[ndx].r, fixedTests[ndx].g,
1041*35238bceSAndroid Build Coastguard Worker                                           fixedTests[ndx].b, fixedTests[ndx].a);
1042*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
1043*35238bceSAndroid Build Coastguard Worker         }
1044*35238bceSAndroid Build Coastguard Worker 
1045*35238bceSAndroid Build Coastguard Worker         const int numIterations = 120;
1046*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
1047*35238bceSAndroid Build Coastguard Worker         {
1048*35238bceSAndroid Build Coastguard Worker             const GLfloat r = rnd.getFloat(0, 1);
1049*35238bceSAndroid Build Coastguard Worker             const GLfloat g = rnd.getFloat(0, 1);
1050*35238bceSAndroid Build Coastguard Worker             const GLfloat b = rnd.getFloat(0, 1);
1051*35238bceSAndroid Build Coastguard Worker             const GLfloat a = rnd.getFloat(0, 1);
1052*35238bceSAndroid Build Coastguard Worker 
1053*35238bceSAndroid Build Coastguard Worker             glBlendColor(r, g, b, a);
1054*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat4Color(m_testCtx, GL_BLEND_COLOR, r, g, b, a);
1055*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
1056*35238bceSAndroid Build Coastguard Worker         }
1057*35238bceSAndroid Build Coastguard Worker     }
1058*35238bceSAndroid Build Coastguard Worker 
1059*35238bceSAndroid Build Coastguard Worker private:
1060*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
1061*35238bceSAndroid Build Coastguard Worker };
1062*35238bceSAndroid Build Coastguard Worker 
1063*35238bceSAndroid Build Coastguard Worker class ColorClearCase : public ApiCase
1064*35238bceSAndroid Build Coastguard Worker {
1065*35238bceSAndroid Build Coastguard Worker public:
ColorClearCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1066*35238bceSAndroid Build Coastguard Worker     ColorClearCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1067*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
1068*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
1069*35238bceSAndroid Build Coastguard Worker     {
1070*35238bceSAndroid Build Coastguard Worker     }
1071*35238bceSAndroid Build Coastguard Worker 
test(void)1072*35238bceSAndroid Build Coastguard Worker     void test(void)
1073*35238bceSAndroid Build Coastguard Worker     {
1074*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
1075*35238bceSAndroid Build Coastguard Worker 
1076*35238bceSAndroid Build Coastguard Worker         // \note Initial color clear value check is temorarily removed. (until the framework does not alter it)
1077*35238bceSAndroid Build Coastguard Worker         //m_verifier->verifyFloat4Color(m_testCtx, GL_COLOR_CLEAR_VALUE, 0, 0, 0, 0);
1078*35238bceSAndroid Build Coastguard Worker         //expectError(GL_NO_ERROR);
1079*35238bceSAndroid Build Coastguard Worker 
1080*35238bceSAndroid Build Coastguard Worker         const struct FixedTest
1081*35238bceSAndroid Build Coastguard Worker         {
1082*35238bceSAndroid Build Coastguard Worker             float r, g, b, a;
1083*35238bceSAndroid Build Coastguard Worker         } fixedTests[] = {
1084*35238bceSAndroid Build Coastguard Worker             {0.5f, 1.0f, 0.5f, 1.0f},
1085*35238bceSAndroid Build Coastguard Worker             {0.0f, 0.5f, 0.0f, 0.5f},
1086*35238bceSAndroid Build Coastguard Worker             {0.0f, 0.0f, 0.0f, 0.0f},
1087*35238bceSAndroid Build Coastguard Worker             {1.0f, 1.0f, 1.0f, 1.0f},
1088*35238bceSAndroid Build Coastguard Worker         };
1089*35238bceSAndroid Build Coastguard Worker         for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(fixedTests); ++ndx)
1090*35238bceSAndroid Build Coastguard Worker         {
1091*35238bceSAndroid Build Coastguard Worker             glClearColor(fixedTests[ndx].r, fixedTests[ndx].g, fixedTests[ndx].b, fixedTests[ndx].a);
1092*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat4Color(m_testCtx, GL_COLOR_CLEAR_VALUE, fixedTests[ndx].r, fixedTests[ndx].g,
1093*35238bceSAndroid Build Coastguard Worker                                           fixedTests[ndx].b, fixedTests[ndx].a);
1094*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
1095*35238bceSAndroid Build Coastguard Worker         }
1096*35238bceSAndroid Build Coastguard Worker 
1097*35238bceSAndroid Build Coastguard Worker         const int numIterations = 120;
1098*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
1099*35238bceSAndroid Build Coastguard Worker         {
1100*35238bceSAndroid Build Coastguard Worker             const GLfloat r = rnd.getFloat(0, 1);
1101*35238bceSAndroid Build Coastguard Worker             const GLfloat g = rnd.getFloat(0, 1);
1102*35238bceSAndroid Build Coastguard Worker             const GLfloat b = rnd.getFloat(0, 1);
1103*35238bceSAndroid Build Coastguard Worker             const GLfloat a = rnd.getFloat(0, 1);
1104*35238bceSAndroid Build Coastguard Worker 
1105*35238bceSAndroid Build Coastguard Worker             glClearColor(r, g, b, a);
1106*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloat4Color(m_testCtx, GL_COLOR_CLEAR_VALUE, r, g, b, a);
1107*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
1108*35238bceSAndroid Build Coastguard Worker         }
1109*35238bceSAndroid Build Coastguard Worker     }
1110*35238bceSAndroid Build Coastguard Worker 
1111*35238bceSAndroid Build Coastguard Worker private:
1112*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
1113*35238bceSAndroid Build Coastguard Worker };
1114*35238bceSAndroid Build Coastguard Worker 
1115*35238bceSAndroid Build Coastguard Worker class DepthClearCase : public ApiCase
1116*35238bceSAndroid Build Coastguard Worker {
1117*35238bceSAndroid Build Coastguard Worker public:
DepthClearCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1118*35238bceSAndroid Build Coastguard Worker     DepthClearCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1119*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
1120*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
1121*35238bceSAndroid Build Coastguard Worker     {
1122*35238bceSAndroid Build Coastguard Worker     }
1123*35238bceSAndroid Build Coastguard Worker 
test(void)1124*35238bceSAndroid Build Coastguard Worker     void test(void)
1125*35238bceSAndroid Build Coastguard Worker     {
1126*35238bceSAndroid Build Coastguard Worker         de::Random rnd(0xabcdef);
1127*35238bceSAndroid Build Coastguard Worker 
1128*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloatExpanded(m_testCtx, GL_DEPTH_CLEAR_VALUE, 1);
1129*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
1130*35238bceSAndroid Build Coastguard Worker 
1131*35238bceSAndroid Build Coastguard Worker         const int numIterations = 120;
1132*35238bceSAndroid Build Coastguard Worker         for (int i = 0; i < numIterations; ++i)
1133*35238bceSAndroid Build Coastguard Worker         {
1134*35238bceSAndroid Build Coastguard Worker             const GLfloat ref = rnd.getFloat(0, 1);
1135*35238bceSAndroid Build Coastguard Worker 
1136*35238bceSAndroid Build Coastguard Worker             glClearDepthf(ref);
1137*35238bceSAndroid Build Coastguard Worker             m_verifier->verifyFloatExpanded(m_testCtx, GL_DEPTH_CLEAR_VALUE, ref);
1138*35238bceSAndroid Build Coastguard Worker             expectError(GL_NO_ERROR);
1139*35238bceSAndroid Build Coastguard Worker         }
1140*35238bceSAndroid Build Coastguard Worker     }
1141*35238bceSAndroid Build Coastguard Worker 
1142*35238bceSAndroid Build Coastguard Worker private:
1143*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
1144*35238bceSAndroid Build Coastguard Worker };
1145*35238bceSAndroid Build Coastguard Worker 
1146*35238bceSAndroid Build Coastguard Worker class MaxTextureLODBiasCase : public ApiCase
1147*35238bceSAndroid Build Coastguard Worker {
1148*35238bceSAndroid Build Coastguard Worker public:
MaxTextureLODBiasCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1149*35238bceSAndroid Build Coastguard Worker     MaxTextureLODBiasCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1150*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
1151*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
1152*35238bceSAndroid Build Coastguard Worker     {
1153*35238bceSAndroid Build Coastguard Worker     }
1154*35238bceSAndroid Build Coastguard Worker 
test(void)1155*35238bceSAndroid Build Coastguard Worker     void test(void)
1156*35238bceSAndroid Build Coastguard Worker     {
1157*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloatGreaterOrEqual(m_testCtx, GL_MAX_TEXTURE_LOD_BIAS, 2.0f);
1158*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
1159*35238bceSAndroid Build Coastguard Worker     }
1160*35238bceSAndroid Build Coastguard Worker 
1161*35238bceSAndroid Build Coastguard Worker private:
1162*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
1163*35238bceSAndroid Build Coastguard Worker };
1164*35238bceSAndroid Build Coastguard Worker 
1165*35238bceSAndroid Build Coastguard Worker class AliasedPointSizeRangeCase : public ApiCase
1166*35238bceSAndroid Build Coastguard Worker {
1167*35238bceSAndroid Build Coastguard Worker public:
AliasedPointSizeRangeCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1168*35238bceSAndroid Build Coastguard Worker     AliasedPointSizeRangeCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1169*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
1170*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
1171*35238bceSAndroid Build Coastguard Worker     {
1172*35238bceSAndroid Build Coastguard Worker     }
1173*35238bceSAndroid Build Coastguard Worker 
test(void)1174*35238bceSAndroid Build Coastguard Worker     void test(void)
1175*35238bceSAndroid Build Coastguard Worker     {
1176*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloatRange(m_testCtx, GL_ALIASED_POINT_SIZE_RANGE, 1, 1);
1177*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
1178*35238bceSAndroid Build Coastguard Worker     }
1179*35238bceSAndroid Build Coastguard Worker 
1180*35238bceSAndroid Build Coastguard Worker private:
1181*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
1182*35238bceSAndroid Build Coastguard Worker };
1183*35238bceSAndroid Build Coastguard Worker 
1184*35238bceSAndroid Build Coastguard Worker class AliasedLineWidthRangeCase : public ApiCase
1185*35238bceSAndroid Build Coastguard Worker {
1186*35238bceSAndroid Build Coastguard Worker public:
AliasedLineWidthRangeCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1187*35238bceSAndroid Build Coastguard Worker     AliasedLineWidthRangeCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1188*35238bceSAndroid Build Coastguard Worker         : ApiCase(context, name, description)
1189*35238bceSAndroid Build Coastguard Worker         , m_verifier(verifier)
1190*35238bceSAndroid Build Coastguard Worker     {
1191*35238bceSAndroid Build Coastguard Worker     }
1192*35238bceSAndroid Build Coastguard Worker 
test(void)1193*35238bceSAndroid Build Coastguard Worker     void test(void)
1194*35238bceSAndroid Build Coastguard Worker     {
1195*35238bceSAndroid Build Coastguard Worker         m_verifier->verifyFloatRange(m_testCtx, GL_ALIASED_LINE_WIDTH_RANGE, 1, 1);
1196*35238bceSAndroid Build Coastguard Worker         expectError(GL_NO_ERROR);
1197*35238bceSAndroid Build Coastguard Worker     }
1198*35238bceSAndroid Build Coastguard Worker 
1199*35238bceSAndroid Build Coastguard Worker private:
1200*35238bceSAndroid Build Coastguard Worker     StateVerifier *m_verifier;
1201*35238bceSAndroid Build Coastguard Worker };
1202*35238bceSAndroid Build Coastguard Worker 
1203*35238bceSAndroid Build Coastguard Worker #define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK)                                                 \
1204*35238bceSAndroid Build Coastguard Worker     do                                                                                           \
1205*35238bceSAndroid Build Coastguard Worker     {                                                                                            \
1206*35238bceSAndroid Build Coastguard Worker         for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++) \
1207*35238bceSAndroid Build Coastguard Worker         {                                                                                        \
1208*35238bceSAndroid Build Coastguard Worker             StateVerifier *verifier = (VERIFIERS)[_verifierNdx];                                 \
1209*35238bceSAndroid Build Coastguard Worker             CODE_BLOCK;                                                                          \
1210*35238bceSAndroid Build Coastguard Worker         }                                                                                        \
1211*35238bceSAndroid Build Coastguard Worker     } while (0)
1212*35238bceSAndroid Build Coastguard Worker 
1213*35238bceSAndroid Build Coastguard Worker } // namespace
1214*35238bceSAndroid Build Coastguard Worker 
FloatStateQueryTests(Context & context)1215*35238bceSAndroid Build Coastguard Worker FloatStateQueryTests::FloatStateQueryTests(Context &context)
1216*35238bceSAndroid Build Coastguard Worker     : TestCaseGroup(context, "floats", "Float Values")
1217*35238bceSAndroid Build Coastguard Worker     , m_verifierBoolean(DE_NULL)
1218*35238bceSAndroid Build Coastguard Worker     , m_verifierInteger(DE_NULL)
1219*35238bceSAndroid Build Coastguard Worker     , m_verifierInteger64(DE_NULL)
1220*35238bceSAndroid Build Coastguard Worker     , m_verifierFloat(DE_NULL)
1221*35238bceSAndroid Build Coastguard Worker {
1222*35238bceSAndroid Build Coastguard Worker }
1223*35238bceSAndroid Build Coastguard Worker 
~FloatStateQueryTests(void)1224*35238bceSAndroid Build Coastguard Worker FloatStateQueryTests::~FloatStateQueryTests(void)
1225*35238bceSAndroid Build Coastguard Worker {
1226*35238bceSAndroid Build Coastguard Worker     deinit();
1227*35238bceSAndroid Build Coastguard Worker }
1228*35238bceSAndroid Build Coastguard Worker 
init(void)1229*35238bceSAndroid Build Coastguard Worker void FloatStateQueryTests::init(void)
1230*35238bceSAndroid Build Coastguard Worker {
1231*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(m_verifierBoolean == DE_NULL);
1232*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(m_verifierInteger == DE_NULL);
1233*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(m_verifierInteger64 == DE_NULL);
1234*35238bceSAndroid Build Coastguard Worker     DE_ASSERT(m_verifierFloat == DE_NULL);
1235*35238bceSAndroid Build Coastguard Worker 
1236*35238bceSAndroid Build Coastguard Worker     m_verifierBoolean =
1237*35238bceSAndroid Build Coastguard Worker         new GetBooleanVerifier(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
1238*35238bceSAndroid Build Coastguard Worker     m_verifierInteger =
1239*35238bceSAndroid Build Coastguard Worker         new GetIntegerVerifier(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
1240*35238bceSAndroid Build Coastguard Worker     m_verifierInteger64 =
1241*35238bceSAndroid Build Coastguard Worker         new GetInteger64Verifier(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
1242*35238bceSAndroid Build Coastguard Worker     m_verifierFloat =
1243*35238bceSAndroid Build Coastguard Worker         new GetFloatVerifier(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
1244*35238bceSAndroid Build Coastguard Worker 
1245*35238bceSAndroid Build Coastguard Worker     StateVerifier *verifiers[] = {m_verifierBoolean, m_verifierInteger, m_verifierInteger64, m_verifierFloat};
1246*35238bceSAndroid Build Coastguard Worker 
1247*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers,
1248*35238bceSAndroid Build Coastguard Worker                       addChild(new DepthRangeCase(m_context, verifier,
1249*35238bceSAndroid Build Coastguard Worker                                                   (std::string("depth_range") + verifier->getTestNamePostfix()).c_str(),
1250*35238bceSAndroid Build Coastguard Worker                                                   "DEPTH_RANGE")));
1251*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers,
1252*35238bceSAndroid Build Coastguard Worker                       addChild(new LineWidthCase(m_context, verifier,
1253*35238bceSAndroid Build Coastguard Worker                                                  (std::string("line_width") + verifier->getTestNamePostfix()).c_str(),
1254*35238bceSAndroid Build Coastguard Worker                                                  "LINE_WIDTH")));
1255*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new PolygonOffsetFactorCase(
1256*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
1257*35238bceSAndroid Build Coastguard Worker                                      (std::string("polygon_offset_factor") + verifier->getTestNamePostfix()).c_str(),
1258*35238bceSAndroid Build Coastguard Worker                                      "POLYGON_OFFSET_FACTOR")));
1259*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new PolygonOffsetUnitsCase(
1260*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
1261*35238bceSAndroid Build Coastguard Worker                                      (std::string("polygon_offset_units") + verifier->getTestNamePostfix()).c_str(),
1262*35238bceSAndroid Build Coastguard Worker                                      "POLYGON_OFFSET_UNITS")));
1263*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new SampleCoverageCase(
1264*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
1265*35238bceSAndroid Build Coastguard Worker                                      (std::string("sample_coverage_value") + verifier->getTestNamePostfix()).c_str(),
1266*35238bceSAndroid Build Coastguard Worker                                      "SAMPLE_COVERAGE_VALUE")));
1267*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers,
1268*35238bceSAndroid Build Coastguard Worker                       addChild(new BlendColorCase(m_context, verifier,
1269*35238bceSAndroid Build Coastguard Worker                                                   (std::string("blend_color") + verifier->getTestNamePostfix()).c_str(),
1270*35238bceSAndroid Build Coastguard Worker                                                   "BLEND_COLOR")));
1271*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(
1272*35238bceSAndroid Build Coastguard Worker         verifiers, addChild(new ColorClearCase(
1273*35238bceSAndroid Build Coastguard Worker                        m_context, verifier, (std::string("color_clear_value") + verifier->getTestNamePostfix()).c_str(),
1274*35238bceSAndroid Build Coastguard Worker                        "COLOR_CLEAR_VALUE")));
1275*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(
1276*35238bceSAndroid Build Coastguard Worker         verifiers, addChild(new DepthClearCase(
1277*35238bceSAndroid Build Coastguard Worker                        m_context, verifier, (std::string("depth_clear_value") + verifier->getTestNamePostfix()).c_str(),
1278*35238bceSAndroid Build Coastguard Worker                        "DEPTH_CLEAR_VALUE")));
1279*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new MaxTextureLODBiasCase(
1280*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
1281*35238bceSAndroid Build Coastguard Worker                                      (std::string("max_texture_lod_bias") + verifier->getTestNamePostfix()).c_str(),
1282*35238bceSAndroid Build Coastguard Worker                                      "MAX_TEXTURE_LOD_BIAS")));
1283*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new AliasedPointSizeRangeCase(
1284*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
1285*35238bceSAndroid Build Coastguard Worker                                      (std::string("aliased_point_size_range") + verifier->getTestNamePostfix()).c_str(),
1286*35238bceSAndroid Build Coastguard Worker                                      "ALIASED_POINT_SIZE_RANGE")));
1287*35238bceSAndroid Build Coastguard Worker     FOR_EACH_VERIFIER(verifiers, addChild(new AliasedLineWidthRangeCase(
1288*35238bceSAndroid Build Coastguard Worker                                      m_context, verifier,
1289*35238bceSAndroid Build Coastguard Worker                                      (std::string("aliased_line_width_range") + verifier->getTestNamePostfix()).c_str(),
1290*35238bceSAndroid Build Coastguard Worker                                      "ALIASED_LINE_WIDTH_RANGE")));
1291*35238bceSAndroid Build Coastguard Worker }
1292*35238bceSAndroid Build Coastguard Worker 
deinit(void)1293*35238bceSAndroid Build Coastguard Worker void FloatStateQueryTests::deinit(void)
1294*35238bceSAndroid Build Coastguard Worker {
1295*35238bceSAndroid Build Coastguard Worker     if (m_verifierBoolean)
1296*35238bceSAndroid Build Coastguard Worker     {
1297*35238bceSAndroid Build Coastguard Worker         delete m_verifierBoolean;
1298*35238bceSAndroid Build Coastguard Worker         m_verifierBoolean = DE_NULL;
1299*35238bceSAndroid Build Coastguard Worker     }
1300*35238bceSAndroid Build Coastguard Worker     if (m_verifierInteger)
1301*35238bceSAndroid Build Coastguard Worker     {
1302*35238bceSAndroid Build Coastguard Worker         delete m_verifierInteger;
1303*35238bceSAndroid Build Coastguard Worker         m_verifierInteger = DE_NULL;
1304*35238bceSAndroid Build Coastguard Worker     }
1305*35238bceSAndroid Build Coastguard Worker     if (m_verifierInteger64)
1306*35238bceSAndroid Build Coastguard Worker     {
1307*35238bceSAndroid Build Coastguard Worker         delete m_verifierInteger64;
1308*35238bceSAndroid Build Coastguard Worker         m_verifierInteger64 = DE_NULL;
1309*35238bceSAndroid Build Coastguard Worker     }
1310*35238bceSAndroid Build Coastguard Worker     if (m_verifierFloat)
1311*35238bceSAndroid Build Coastguard Worker     {
1312*35238bceSAndroid Build Coastguard Worker         delete m_verifierFloat;
1313*35238bceSAndroid Build Coastguard Worker         m_verifierFloat = DE_NULL;
1314*35238bceSAndroid Build Coastguard Worker     }
1315*35238bceSAndroid Build Coastguard Worker 
1316*35238bceSAndroid Build Coastguard Worker     this->TestCaseGroup::deinit();
1317*35238bceSAndroid Build Coastguard Worker }
1318*35238bceSAndroid Build Coastguard Worker 
1319*35238bceSAndroid Build Coastguard Worker } // namespace Functional
1320*35238bceSAndroid Build Coastguard Worker } // namespace gles3
1321*35238bceSAndroid Build Coastguard Worker } // namespace deqp
1322