1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 2.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 State Query tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es2fIntegerStateQueryTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "es2fApiCase.hpp"
26*35238bceSAndroid Build Coastguard Worker
27*35238bceSAndroid Build Coastguard Worker #include "glsStateQueryUtil.hpp"
28*35238bceSAndroid Build Coastguard Worker
29*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
31*35238bceSAndroid Build Coastguard Worker #include "gluStrUtil.hpp"
32*35238bceSAndroid Build Coastguard Worker
33*35238bceSAndroid Build Coastguard Worker #include "tcuRenderTarget.hpp"
34*35238bceSAndroid Build Coastguard Worker
35*35238bceSAndroid Build Coastguard Worker #include "deRandom.hpp"
36*35238bceSAndroid Build Coastguard Worker
37*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
38*35238bceSAndroid Build Coastguard Worker
39*35238bceSAndroid Build Coastguard Worker using namespace glw; // GLint and other GL types
40*35238bceSAndroid Build Coastguard Worker using deqp::gls::StateQueryUtil::StateQueryMemoryWriteGuard;
41*35238bceSAndroid Build Coastguard Worker
42*35238bceSAndroid Build Coastguard Worker #ifndef GL_SLUMINANCE_NV
43*35238bceSAndroid Build Coastguard Worker #define GL_SLUMINANCE_NV 0x8C46
44*35238bceSAndroid Build Coastguard Worker #endif
45*35238bceSAndroid Build Coastguard Worker #ifndef GL_SLUMINANCE_ALPHA_NV
46*35238bceSAndroid Build Coastguard Worker #define GL_SLUMINANCE_ALPHA_NV 0x8C44
47*35238bceSAndroid Build Coastguard Worker #endif
48*35238bceSAndroid Build Coastguard Worker #ifndef GL_BGR_NV
49*35238bceSAndroid Build Coastguard Worker #define GL_BGR_NV 0x80E0
50*35238bceSAndroid Build Coastguard Worker #endif
51*35238bceSAndroid Build Coastguard Worker
52*35238bceSAndroid Build Coastguard Worker namespace deqp
53*35238bceSAndroid Build Coastguard Worker {
54*35238bceSAndroid Build Coastguard Worker namespace gles2
55*35238bceSAndroid Build Coastguard Worker {
56*35238bceSAndroid Build Coastguard Worker namespace Functional
57*35238bceSAndroid Build Coastguard Worker {
58*35238bceSAndroid Build Coastguard Worker namespace IntegerStateQueryVerifiers
59*35238bceSAndroid Build Coastguard Worker {
60*35238bceSAndroid Build Coastguard Worker
61*35238bceSAndroid Build Coastguard Worker // StateVerifier
62*35238bceSAndroid Build Coastguard Worker
63*35238bceSAndroid Build Coastguard Worker class StateVerifier : protected glu::CallLogWrapper
64*35238bceSAndroid Build Coastguard Worker {
65*35238bceSAndroid Build Coastguard Worker public:
66*35238bceSAndroid Build Coastguard Worker StateVerifier(const glw::Functions &gl, tcu::TestLog &log, const char *testNamePostfix);
67*35238bceSAndroid Build Coastguard Worker virtual ~StateVerifier(); // make GCC happy
68*35238bceSAndroid Build Coastguard Worker
69*35238bceSAndroid Build Coastguard Worker const char *getTestNamePostfix(void) const;
70*35238bceSAndroid Build Coastguard Worker
71*35238bceSAndroid Build Coastguard Worker virtual void verifyInteger(tcu::TestContext &testCtx, GLenum name, GLint reference) = DE_NULL;
72*35238bceSAndroid Build Coastguard Worker virtual void verifyInteger4(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1,
73*35238bceSAndroid Build Coastguard Worker GLint reference2, GLint reference3) = DE_NULL;
74*35238bceSAndroid Build Coastguard Worker virtual void verifyInteger4Mask(tcu::TestContext &testCtx, GLenum name, GLint reference0, bool enableRef0,
75*35238bceSAndroid Build Coastguard Worker GLint reference1, bool enableRef1, GLint reference2, bool enableRef2,
76*35238bceSAndroid Build Coastguard Worker GLint reference3, bool enableRef3) = DE_NULL;
77*35238bceSAndroid Build Coastguard Worker virtual void verifyIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLint reference) = DE_NULL;
78*35238bceSAndroid Build Coastguard Worker virtual void verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name,
79*35238bceSAndroid Build Coastguard Worker GLuint reference) = DE_NULL;
80*35238bceSAndroid Build Coastguard Worker virtual void verifyIntegerGreaterOrEqual2(tcu::TestContext &testCtx, GLenum name, GLint reference0,
81*35238bceSAndroid Build Coastguard Worker GLint reference1) = DE_NULL;
82*35238bceSAndroid Build Coastguard Worker virtual void verifyIntegerAnyOf(tcu::TestContext &testCtx, GLenum name, const GLint references[],
83*35238bceSAndroid Build Coastguard Worker size_t referencesLength) = DE_NULL;
84*35238bceSAndroid Build Coastguard Worker virtual void verifyStencilMaskInitial(tcu::TestContext &testCtx, GLenum name, int stencilBits) = DE_NULL;
85*35238bceSAndroid Build Coastguard Worker
86*35238bceSAndroid Build Coastguard Worker private:
87*35238bceSAndroid Build Coastguard Worker const char *const m_testNamePostfix;
88*35238bceSAndroid Build Coastguard Worker };
89*35238bceSAndroid Build Coastguard Worker
StateVerifier(const glw::Functions & gl,tcu::TestLog & log,const char * testNamePostfix)90*35238bceSAndroid Build Coastguard Worker StateVerifier::StateVerifier(const glw::Functions &gl, tcu::TestLog &log, const char *testNamePostfix)
91*35238bceSAndroid Build Coastguard Worker : glu::CallLogWrapper(gl, log)
92*35238bceSAndroid Build Coastguard Worker , m_testNamePostfix(testNamePostfix)
93*35238bceSAndroid Build Coastguard Worker {
94*35238bceSAndroid Build Coastguard Worker enableLogging(true);
95*35238bceSAndroid Build Coastguard Worker }
96*35238bceSAndroid Build Coastguard Worker
~StateVerifier()97*35238bceSAndroid Build Coastguard Worker StateVerifier::~StateVerifier()
98*35238bceSAndroid Build Coastguard Worker {
99*35238bceSAndroid Build Coastguard Worker }
100*35238bceSAndroid Build Coastguard Worker
getTestNamePostfix(void) const101*35238bceSAndroid Build Coastguard Worker const char *StateVerifier::getTestNamePostfix(void) const
102*35238bceSAndroid Build Coastguard Worker {
103*35238bceSAndroid Build Coastguard Worker return m_testNamePostfix;
104*35238bceSAndroid Build Coastguard Worker }
105*35238bceSAndroid Build Coastguard Worker
106*35238bceSAndroid Build Coastguard Worker // GetBooleanVerifier
107*35238bceSAndroid Build Coastguard Worker
108*35238bceSAndroid Build Coastguard Worker class GetBooleanVerifier : public StateVerifier
109*35238bceSAndroid Build Coastguard Worker {
110*35238bceSAndroid Build Coastguard Worker public:
111*35238bceSAndroid Build Coastguard Worker GetBooleanVerifier(const glw::Functions &gl, tcu::TestLog &log);
112*35238bceSAndroid Build Coastguard Worker void verifyInteger(tcu::TestContext &testCtx, GLenum name, GLint reference);
113*35238bceSAndroid Build Coastguard Worker void verifyInteger4(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2,
114*35238bceSAndroid Build Coastguard Worker GLint reference3);
115*35238bceSAndroid Build Coastguard Worker void verifyInteger4Mask(tcu::TestContext &testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1,
116*35238bceSAndroid Build Coastguard Worker bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3);
117*35238bceSAndroid Build Coastguard Worker void verifyIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLint reference);
118*35238bceSAndroid Build Coastguard Worker void verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLuint reference);
119*35238bceSAndroid Build Coastguard Worker void verifyIntegerGreaterOrEqual2(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1);
120*35238bceSAndroid Build Coastguard Worker void verifyIntegerAnyOf(tcu::TestContext &testCtx, GLenum name, const GLint references[], size_t referencesLength);
121*35238bceSAndroid Build Coastguard Worker void verifyStencilMaskInitial(tcu::TestContext &testCtx, GLenum name, int stencilBits);
122*35238bceSAndroid Build Coastguard Worker };
123*35238bceSAndroid Build Coastguard Worker
GetBooleanVerifier(const glw::Functions & gl,tcu::TestLog & log)124*35238bceSAndroid Build Coastguard Worker GetBooleanVerifier::GetBooleanVerifier(const glw::Functions &gl, tcu::TestLog &log)
125*35238bceSAndroid Build Coastguard Worker : StateVerifier(gl, log, "_getboolean")
126*35238bceSAndroid Build Coastguard Worker {
127*35238bceSAndroid Build Coastguard Worker }
128*35238bceSAndroid Build Coastguard Worker
verifyInteger(tcu::TestContext & testCtx,GLenum name,GLint reference)129*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyInteger(tcu::TestContext &testCtx, GLenum name, GLint reference)
130*35238bceSAndroid Build Coastguard Worker {
131*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
132*35238bceSAndroid Build Coastguard Worker
133*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLboolean> state;
134*35238bceSAndroid Build Coastguard Worker glGetBooleanv(name, &state);
135*35238bceSAndroid Build Coastguard Worker
136*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
137*35238bceSAndroid Build Coastguard Worker return;
138*35238bceSAndroid Build Coastguard Worker
139*35238bceSAndroid Build Coastguard Worker const GLboolean expectedGLState = reference ? GL_TRUE : GL_FALSE;
140*35238bceSAndroid Build Coastguard Worker
141*35238bceSAndroid Build Coastguard Worker if (state != expectedGLState)
142*35238bceSAndroid Build Coastguard Worker {
143*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected "
144*35238bceSAndroid Build Coastguard Worker << (expectedGLState == GL_TRUE ? "GL_TRUE" : "GL_FALSE") << "; got "
145*35238bceSAndroid Build Coastguard Worker << (state == GL_TRUE ? "GL_TRUE" : (state == GL_FALSE ? "GL_FALSE" : "non-boolean"))
146*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
147*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
148*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
149*35238bceSAndroid Build Coastguard Worker }
150*35238bceSAndroid Build Coastguard Worker }
151*35238bceSAndroid Build Coastguard Worker
verifyInteger4(tcu::TestContext & testCtx,GLenum name,GLint reference0,GLint reference1,GLint reference2,GLint reference3)152*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyInteger4(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1,
153*35238bceSAndroid Build Coastguard Worker GLint reference2, GLint reference3)
154*35238bceSAndroid Build Coastguard Worker {
155*35238bceSAndroid Build Coastguard Worker verifyInteger4Mask(testCtx, name, reference0, true, reference1, true, reference2, true, reference3, true);
156*35238bceSAndroid Build Coastguard Worker }
157*35238bceSAndroid Build Coastguard Worker
verifyInteger4Mask(tcu::TestContext & testCtx,GLenum name,GLint reference0,bool enableRef0,GLint reference1,bool enableRef1,GLint reference2,bool enableRef2,GLint reference3,bool enableRef3)158*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyInteger4Mask(tcu::TestContext &testCtx, GLenum name, GLint reference0, bool enableRef0,
159*35238bceSAndroid Build Coastguard Worker GLint reference1, bool enableRef1, GLint reference2, bool enableRef2,
160*35238bceSAndroid Build Coastguard Worker GLint reference3, bool enableRef3)
161*35238bceSAndroid Build Coastguard Worker {
162*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
163*35238bceSAndroid Build Coastguard Worker
164*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLboolean[4]> boolVector4;
165*35238bceSAndroid Build Coastguard Worker glGetBooleanv(name, boolVector4);
166*35238bceSAndroid Build Coastguard Worker
167*35238bceSAndroid Build Coastguard Worker if (!boolVector4.verifyValidity(testCtx))
168*35238bceSAndroid Build Coastguard Worker return;
169*35238bceSAndroid Build Coastguard Worker
170*35238bceSAndroid Build Coastguard Worker const GLboolean referenceAsGLBoolean[] = {
171*35238bceSAndroid Build Coastguard Worker reference0 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
172*35238bceSAndroid Build Coastguard Worker reference1 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
173*35238bceSAndroid Build Coastguard Worker reference2 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
174*35238bceSAndroid Build Coastguard Worker reference3 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
175*35238bceSAndroid Build Coastguard Worker };
176*35238bceSAndroid Build Coastguard Worker
177*35238bceSAndroid Build Coastguard Worker if ((enableRef0 && (boolVector4[0] != referenceAsGLBoolean[0])) ||
178*35238bceSAndroid Build Coastguard Worker (enableRef1 && (boolVector4[1] != referenceAsGLBoolean[1])) ||
179*35238bceSAndroid Build Coastguard Worker (enableRef2 && (boolVector4[2] != referenceAsGLBoolean[2])) ||
180*35238bceSAndroid Build Coastguard Worker (enableRef3 && (boolVector4[3] != referenceAsGLBoolean[3])))
181*35238bceSAndroid Build Coastguard Worker {
182*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected "
183*35238bceSAndroid Build Coastguard Worker << (enableRef0 ? (referenceAsGLBoolean[0] ? "GL_TRUE" : "GL_FALSE") : " - ") << ", "
184*35238bceSAndroid Build Coastguard Worker << (enableRef1 ? (referenceAsGLBoolean[1] ? "GL_TRUE" : "GL_FALSE") : " - ") << ", "
185*35238bceSAndroid Build Coastguard Worker << (enableRef2 ? (referenceAsGLBoolean[2] ? "GL_TRUE" : "GL_FALSE") : " - ") << ", "
186*35238bceSAndroid Build Coastguard Worker << (enableRef3 ? (referenceAsGLBoolean[3] ? "GL_TRUE" : "GL_FALSE") : " - ")
187*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
188*35238bceSAndroid Build Coastguard Worker
189*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
190*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
191*35238bceSAndroid Build Coastguard Worker }
192*35238bceSAndroid Build Coastguard Worker }
193*35238bceSAndroid Build Coastguard Worker
verifyIntegerGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLint reference)194*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLint reference)
195*35238bceSAndroid Build Coastguard Worker {
196*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
197*35238bceSAndroid Build Coastguard Worker
198*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLboolean> state;
199*35238bceSAndroid Build Coastguard Worker glGetBooleanv(name, &state);
200*35238bceSAndroid Build Coastguard Worker
201*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
202*35238bceSAndroid Build Coastguard Worker return;
203*35238bceSAndroid Build Coastguard Worker
204*35238bceSAndroid Build Coastguard Worker if (state == GL_TRUE) // state is non-zero, could be greater than reference (correct)
205*35238bceSAndroid Build Coastguard Worker return;
206*35238bceSAndroid Build Coastguard Worker
207*35238bceSAndroid Build Coastguard Worker if (state == GL_FALSE) // state is zero
208*35238bceSAndroid Build Coastguard Worker {
209*35238bceSAndroid Build Coastguard Worker if (reference > 0) // and reference is greater than zero?
210*35238bceSAndroid Build Coastguard Worker {
211*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
212*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
213*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
214*35238bceSAndroid Build Coastguard Worker }
215*35238bceSAndroid Build Coastguard Worker }
216*35238bceSAndroid Build Coastguard Worker else
217*35238bceSAndroid Build Coastguard Worker {
218*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE or GL_FALSE" << TestLog::EndMessage;
219*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
220*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
221*35238bceSAndroid Build Coastguard Worker }
222*35238bceSAndroid Build Coastguard Worker }
223*35238bceSAndroid Build Coastguard Worker
verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLuint reference)224*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLuint reference)
225*35238bceSAndroid Build Coastguard Worker {
226*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
227*35238bceSAndroid Build Coastguard Worker
228*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLboolean> state;
229*35238bceSAndroid Build Coastguard Worker glGetBooleanv(name, &state);
230*35238bceSAndroid Build Coastguard Worker
231*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
232*35238bceSAndroid Build Coastguard Worker return;
233*35238bceSAndroid Build Coastguard Worker
234*35238bceSAndroid Build Coastguard Worker if (state == GL_TRUE) // state is non-zero, could be greater than reference (correct)
235*35238bceSAndroid Build Coastguard Worker return;
236*35238bceSAndroid Build Coastguard Worker
237*35238bceSAndroid Build Coastguard Worker if (state == GL_FALSE) // state is zero
238*35238bceSAndroid Build Coastguard Worker {
239*35238bceSAndroid Build Coastguard Worker if (reference > 0) // and reference is greater than zero?
240*35238bceSAndroid Build Coastguard Worker {
241*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
242*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
243*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
244*35238bceSAndroid Build Coastguard Worker }
245*35238bceSAndroid Build Coastguard Worker }
246*35238bceSAndroid Build Coastguard Worker else
247*35238bceSAndroid Build Coastguard Worker {
248*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE or GL_FALSE" << TestLog::EndMessage;
249*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
250*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
251*35238bceSAndroid Build Coastguard Worker }
252*35238bceSAndroid Build Coastguard Worker }
253*35238bceSAndroid Build Coastguard Worker
verifyIntegerGreaterOrEqual2(tcu::TestContext & testCtx,GLenum name,GLint reference0,GLint reference1)254*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyIntegerGreaterOrEqual2(tcu::TestContext &testCtx, GLenum name, GLint reference0,
255*35238bceSAndroid Build Coastguard Worker GLint reference1)
256*35238bceSAndroid Build Coastguard Worker {
257*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
258*35238bceSAndroid Build Coastguard Worker
259*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLboolean[2]> boolVector;
260*35238bceSAndroid Build Coastguard Worker glGetBooleanv(name, boolVector);
261*35238bceSAndroid Build Coastguard Worker
262*35238bceSAndroid Build Coastguard Worker if (!boolVector.verifyValidity(testCtx))
263*35238bceSAndroid Build Coastguard Worker return;
264*35238bceSAndroid Build Coastguard Worker
265*35238bceSAndroid Build Coastguard Worker const GLboolean referenceAsGLBoolean[2] = {reference0 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
266*35238bceSAndroid Build Coastguard Worker reference1 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE};
267*35238bceSAndroid Build Coastguard Worker
268*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(referenceAsGLBoolean); ++ndx)
269*35238bceSAndroid Build Coastguard Worker {
270*35238bceSAndroid Build Coastguard Worker if (boolVector[ndx] == GL_TRUE) // state is non-zero, could be greater than any integer
271*35238bceSAndroid Build Coastguard Worker {
272*35238bceSAndroid Build Coastguard Worker continue;
273*35238bceSAndroid Build Coastguard Worker }
274*35238bceSAndroid Build Coastguard Worker else if (boolVector[ndx] == GL_FALSE) // state is zero
275*35238bceSAndroid Build Coastguard Worker {
276*35238bceSAndroid Build Coastguard Worker if (referenceAsGLBoolean[ndx] > 0) // and reference is greater than zero?
277*35238bceSAndroid Build Coastguard Worker {
278*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
279*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
280*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
281*35238bceSAndroid Build Coastguard Worker }
282*35238bceSAndroid Build Coastguard Worker }
283*35238bceSAndroid Build Coastguard Worker else
284*35238bceSAndroid Build Coastguard Worker {
285*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE or GL_FALSE" << TestLog::EndMessage;
286*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
287*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
288*35238bceSAndroid Build Coastguard Worker }
289*35238bceSAndroid Build Coastguard Worker }
290*35238bceSAndroid Build Coastguard Worker }
291*35238bceSAndroid Build Coastguard Worker
verifyIntegerAnyOf(tcu::TestContext & testCtx,GLenum name,const GLint references[],size_t referencesLength)292*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyIntegerAnyOf(tcu::TestContext &testCtx, GLenum name, const GLint references[],
293*35238bceSAndroid Build Coastguard Worker size_t referencesLength)
294*35238bceSAndroid Build Coastguard Worker {
295*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
296*35238bceSAndroid Build Coastguard Worker
297*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLboolean> state;
298*35238bceSAndroid Build Coastguard Worker glGetBooleanv(name, &state);
299*35238bceSAndroid Build Coastguard Worker
300*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
301*35238bceSAndroid Build Coastguard Worker return;
302*35238bceSAndroid Build Coastguard Worker
303*35238bceSAndroid Build Coastguard Worker for (size_t ndx = 0; ndx < referencesLength; ++ndx)
304*35238bceSAndroid Build Coastguard Worker {
305*35238bceSAndroid Build Coastguard Worker const GLboolean expectedGLState = references[ndx] ? GL_TRUE : GL_FALSE;
306*35238bceSAndroid Build Coastguard Worker
307*35238bceSAndroid Build Coastguard Worker if (state == expectedGLState)
308*35238bceSAndroid Build Coastguard Worker return;
309*35238bceSAndroid Build Coastguard Worker }
310*35238bceSAndroid Build Coastguard Worker
311*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: got " << (state == GL_TRUE ? "GL_TRUE" : "GL_FALSE")
312*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
313*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
314*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
315*35238bceSAndroid Build Coastguard Worker }
316*35238bceSAndroid Build Coastguard Worker
verifyStencilMaskInitial(tcu::TestContext & testCtx,GLenum name,int stencilBits)317*35238bceSAndroid Build Coastguard Worker void GetBooleanVerifier::verifyStencilMaskInitial(tcu::TestContext &testCtx, GLenum name, int stencilBits)
318*35238bceSAndroid Build Coastguard Worker {
319*35238bceSAndroid Build Coastguard Worker // if stencilBits == 0, the mask is allowed to be either GL_TRUE or GL_FALSE
320*35238bceSAndroid Build Coastguard Worker // otherwise it must be GL_TRUE
321*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
322*35238bceSAndroid Build Coastguard Worker
323*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLboolean> state;
324*35238bceSAndroid Build Coastguard Worker glGetBooleanv(name, &state);
325*35238bceSAndroid Build Coastguard Worker
326*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
327*35238bceSAndroid Build Coastguard Worker return;
328*35238bceSAndroid Build Coastguard Worker
329*35238bceSAndroid Build Coastguard Worker if (stencilBits > 0 && state != GL_TRUE)
330*35238bceSAndroid Build Coastguard Worker {
331*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
332*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
333*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
334*35238bceSAndroid Build Coastguard Worker }
335*35238bceSAndroid Build Coastguard Worker }
336*35238bceSAndroid Build Coastguard Worker
337*35238bceSAndroid Build Coastguard Worker //GetIntegerVerifier
338*35238bceSAndroid Build Coastguard Worker
339*35238bceSAndroid Build Coastguard Worker class GetIntegerVerifier : public StateVerifier
340*35238bceSAndroid Build Coastguard Worker {
341*35238bceSAndroid Build Coastguard Worker public:
342*35238bceSAndroid Build Coastguard Worker GetIntegerVerifier(const glw::Functions &gl, tcu::TestLog &log);
343*35238bceSAndroid Build Coastguard Worker void verifyInteger(tcu::TestContext &testCtx, GLenum name, GLint reference);
344*35238bceSAndroid Build Coastguard Worker void verifyInteger4(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2,
345*35238bceSAndroid Build Coastguard Worker GLint reference3);
346*35238bceSAndroid Build Coastguard Worker void verifyInteger4Mask(tcu::TestContext &testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1,
347*35238bceSAndroid Build Coastguard Worker bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3);
348*35238bceSAndroid Build Coastguard Worker void verifyIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLint reference);
349*35238bceSAndroid Build Coastguard Worker void verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLuint reference);
350*35238bceSAndroid Build Coastguard Worker void verifyIntegerGreaterOrEqual2(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1);
351*35238bceSAndroid Build Coastguard Worker void verifyIntegerAnyOf(tcu::TestContext &testCtx, GLenum name, const GLint references[], size_t referencesLength);
352*35238bceSAndroid Build Coastguard Worker void verifyStencilMaskInitial(tcu::TestContext &testCtx, GLenum name, int stencilBits);
353*35238bceSAndroid Build Coastguard Worker };
354*35238bceSAndroid Build Coastguard Worker
GetIntegerVerifier(const glw::Functions & gl,tcu::TestLog & log)355*35238bceSAndroid Build Coastguard Worker GetIntegerVerifier::GetIntegerVerifier(const glw::Functions &gl, tcu::TestLog &log)
356*35238bceSAndroid Build Coastguard Worker : StateVerifier(gl, log, "_getinteger")
357*35238bceSAndroid Build Coastguard Worker {
358*35238bceSAndroid Build Coastguard Worker }
359*35238bceSAndroid Build Coastguard Worker
verifyInteger(tcu::TestContext & testCtx,GLenum name,GLint reference)360*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyInteger(tcu::TestContext &testCtx, GLenum name, GLint reference)
361*35238bceSAndroid Build Coastguard Worker {
362*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
363*35238bceSAndroid Build Coastguard Worker
364*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLint> state;
365*35238bceSAndroid Build Coastguard Worker glGetIntegerv(name, &state);
366*35238bceSAndroid Build Coastguard Worker
367*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
368*35238bceSAndroid Build Coastguard Worker return;
369*35238bceSAndroid Build Coastguard Worker
370*35238bceSAndroid Build Coastguard Worker if (state != reference)
371*35238bceSAndroid Build Coastguard Worker {
372*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state
373*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
374*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
375*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
376*35238bceSAndroid Build Coastguard Worker }
377*35238bceSAndroid Build Coastguard Worker }
378*35238bceSAndroid Build Coastguard Worker
verifyInteger4(tcu::TestContext & testCtx,GLenum name,GLint reference0,GLint reference1,GLint reference2,GLint reference3)379*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyInteger4(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1,
380*35238bceSAndroid Build Coastguard Worker GLint reference2, GLint reference3)
381*35238bceSAndroid Build Coastguard Worker {
382*35238bceSAndroid Build Coastguard Worker verifyInteger4Mask(testCtx, name, reference0, true, reference1, true, reference2, true, reference3, true);
383*35238bceSAndroid Build Coastguard Worker }
384*35238bceSAndroid Build Coastguard Worker
verifyInteger4Mask(tcu::TestContext & testCtx,GLenum name,GLint reference0,bool enableRef0,GLint reference1,bool enableRef1,GLint reference2,bool enableRef2,GLint reference3,bool enableRef3)385*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyInteger4Mask(tcu::TestContext &testCtx, GLenum name, GLint reference0, bool enableRef0,
386*35238bceSAndroid Build Coastguard Worker GLint reference1, bool enableRef1, GLint reference2, bool enableRef2,
387*35238bceSAndroid Build Coastguard Worker GLint reference3, bool enableRef3)
388*35238bceSAndroid Build Coastguard Worker {
389*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
390*35238bceSAndroid Build Coastguard Worker
391*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLint[4]> intVector4;
392*35238bceSAndroid Build Coastguard Worker glGetIntegerv(name, intVector4);
393*35238bceSAndroid Build Coastguard Worker
394*35238bceSAndroid Build Coastguard Worker if (!intVector4.verifyValidity(testCtx))
395*35238bceSAndroid Build Coastguard Worker return;
396*35238bceSAndroid Build Coastguard Worker
397*35238bceSAndroid Build Coastguard Worker if ((enableRef0 && (intVector4[0] != reference0)) || (enableRef1 && (intVector4[1] != reference1)) ||
398*35238bceSAndroid Build Coastguard Worker (enableRef2 && (intVector4[2] != reference2)) || (enableRef3 && (intVector4[3] != reference3)))
399*35238bceSAndroid Build Coastguard Worker {
400*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected " << (enableRef0 ? "" : "(") << reference0
401*35238bceSAndroid Build Coastguard Worker << (enableRef0 ? "" : ")") << ", " << (enableRef1 ? "" : "(") << reference1
402*35238bceSAndroid Build Coastguard Worker << (enableRef1 ? "" : ")") << ", " << (enableRef2 ? "" : "(") << reference2
403*35238bceSAndroid Build Coastguard Worker << (enableRef2 ? "" : ")") << ", " << (enableRef3 ? "" : "(") << reference3
404*35238bceSAndroid Build Coastguard Worker << (enableRef3 ? "" : ")") << TestLog::EndMessage;
405*35238bceSAndroid Build Coastguard Worker
406*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
407*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
408*35238bceSAndroid Build Coastguard Worker }
409*35238bceSAndroid Build Coastguard Worker }
410*35238bceSAndroid Build Coastguard Worker
verifyIntegerGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLint reference)411*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLint reference)
412*35238bceSAndroid Build Coastguard Worker {
413*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
414*35238bceSAndroid Build Coastguard Worker
415*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLint> state;
416*35238bceSAndroid Build Coastguard Worker glGetIntegerv(name, &state);
417*35238bceSAndroid Build Coastguard Worker
418*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
419*35238bceSAndroid Build Coastguard Worker return;
420*35238bceSAndroid Build Coastguard Worker
421*35238bceSAndroid Build Coastguard Worker if (state < reference)
422*35238bceSAndroid Build Coastguard Worker {
423*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << reference << "; got "
424*35238bceSAndroid Build Coastguard Worker << state << TestLog::EndMessage;
425*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
426*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
427*35238bceSAndroid Build Coastguard Worker }
428*35238bceSAndroid Build Coastguard Worker }
429*35238bceSAndroid Build Coastguard Worker
verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLuint reference)430*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLuint reference)
431*35238bceSAndroid Build Coastguard Worker {
432*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
433*35238bceSAndroid Build Coastguard Worker
434*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLint> state;
435*35238bceSAndroid Build Coastguard Worker glGetIntegerv(name, &state);
436*35238bceSAndroid Build Coastguard Worker
437*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
438*35238bceSAndroid Build Coastguard Worker return;
439*35238bceSAndroid Build Coastguard Worker
440*35238bceSAndroid Build Coastguard Worker if (GLuint(state) < reference)
441*35238bceSAndroid Build Coastguard Worker {
442*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << reference << "; got "
443*35238bceSAndroid Build Coastguard Worker << GLuint(state) << TestLog::EndMessage;
444*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
445*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
446*35238bceSAndroid Build Coastguard Worker }
447*35238bceSAndroid Build Coastguard Worker }
448*35238bceSAndroid Build Coastguard Worker
verifyIntegerGreaterOrEqual2(tcu::TestContext & testCtx,GLenum name,GLint reference0,GLint reference1)449*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyIntegerGreaterOrEqual2(tcu::TestContext &testCtx, GLenum name, GLint reference0,
450*35238bceSAndroid Build Coastguard Worker GLint reference1)
451*35238bceSAndroid Build Coastguard Worker {
452*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
453*35238bceSAndroid Build Coastguard Worker
454*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLint[2]> intVector2;
455*35238bceSAndroid Build Coastguard Worker glGetIntegerv(name, intVector2);
456*35238bceSAndroid Build Coastguard Worker
457*35238bceSAndroid Build Coastguard Worker if (!intVector2.verifyValidity(testCtx))
458*35238bceSAndroid Build Coastguard Worker return;
459*35238bceSAndroid Build Coastguard Worker
460*35238bceSAndroid Build Coastguard Worker if (intVector2[0] < reference0 || intVector2[1] < reference1)
461*35238bceSAndroid Build Coastguard Worker {
462*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << reference0 << ", "
463*35238bceSAndroid Build Coastguard Worker << reference1 << "; got " << intVector2[0] << ", " << intVector2[0] << TestLog::EndMessage;
464*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
465*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
466*35238bceSAndroid Build Coastguard Worker }
467*35238bceSAndroid Build Coastguard Worker }
468*35238bceSAndroid Build Coastguard Worker
verifyIntegerAnyOf(tcu::TestContext & testCtx,GLenum name,const GLint references[],size_t referencesLength)469*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyIntegerAnyOf(tcu::TestContext &testCtx, GLenum name, const GLint references[],
470*35238bceSAndroid Build Coastguard Worker size_t referencesLength)
471*35238bceSAndroid Build Coastguard Worker {
472*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
473*35238bceSAndroid Build Coastguard Worker
474*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLint> state;
475*35238bceSAndroid Build Coastguard Worker glGetIntegerv(name, &state);
476*35238bceSAndroid Build Coastguard Worker
477*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
478*35238bceSAndroid Build Coastguard Worker return;
479*35238bceSAndroid Build Coastguard Worker
480*35238bceSAndroid Build Coastguard Worker for (size_t ndx = 0; ndx < referencesLength; ++ndx)
481*35238bceSAndroid Build Coastguard Worker {
482*35238bceSAndroid Build Coastguard Worker const GLint expectedGLState = references[ndx];
483*35238bceSAndroid Build Coastguard Worker
484*35238bceSAndroid Build Coastguard Worker if (state == expectedGLState)
485*35238bceSAndroid Build Coastguard Worker return;
486*35238bceSAndroid Build Coastguard Worker }
487*35238bceSAndroid Build Coastguard Worker
488*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: got " << state << TestLog::EndMessage;
489*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
490*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
491*35238bceSAndroid Build Coastguard Worker }
492*35238bceSAndroid Build Coastguard Worker
verifyStencilMaskInitial(tcu::TestContext & testCtx,GLenum name,int stencilBits)493*35238bceSAndroid Build Coastguard Worker void GetIntegerVerifier::verifyStencilMaskInitial(tcu::TestContext &testCtx, GLenum name, int stencilBits)
494*35238bceSAndroid Build Coastguard Worker {
495*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
496*35238bceSAndroid Build Coastguard Worker
497*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLint> state;
498*35238bceSAndroid Build Coastguard Worker glGetIntegerv(name, &state);
499*35238bceSAndroid Build Coastguard Worker
500*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
501*35238bceSAndroid Build Coastguard Worker return;
502*35238bceSAndroid Build Coastguard Worker
503*35238bceSAndroid Build Coastguard Worker const GLint reference = (1 << stencilBits) - 1;
504*35238bceSAndroid Build Coastguard Worker
505*35238bceSAndroid Build Coastguard Worker if ((state & reference) != reference) // the least significant stencilBits bits should be on
506*35238bceSAndroid Build Coastguard Worker {
507*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected minimum mask of " << reference << "; got " << state
508*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
509*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
510*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid mask value");
511*35238bceSAndroid Build Coastguard Worker }
512*35238bceSAndroid Build Coastguard Worker }
513*35238bceSAndroid Build Coastguard Worker
514*35238bceSAndroid Build Coastguard Worker //GetFloatVerifier
515*35238bceSAndroid Build Coastguard Worker
516*35238bceSAndroid Build Coastguard Worker class GetFloatVerifier : public StateVerifier
517*35238bceSAndroid Build Coastguard Worker {
518*35238bceSAndroid Build Coastguard Worker public:
519*35238bceSAndroid Build Coastguard Worker GetFloatVerifier(const glw::Functions &gl, tcu::TestLog &log);
520*35238bceSAndroid Build Coastguard Worker void verifyInteger(tcu::TestContext &testCtx, GLenum name, GLint reference);
521*35238bceSAndroid Build Coastguard Worker void verifyInteger4(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2,
522*35238bceSAndroid Build Coastguard Worker GLint reference3);
523*35238bceSAndroid Build Coastguard Worker void verifyInteger4Mask(tcu::TestContext &testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1,
524*35238bceSAndroid Build Coastguard Worker bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3);
525*35238bceSAndroid Build Coastguard Worker void verifyIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLint reference);
526*35238bceSAndroid Build Coastguard Worker void verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLuint reference);
527*35238bceSAndroid Build Coastguard Worker void verifyIntegerGreaterOrEqual2(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1);
528*35238bceSAndroid Build Coastguard Worker void verifyIntegerAnyOf(tcu::TestContext &testCtx, GLenum name, const GLint references[], size_t referencesLength);
529*35238bceSAndroid Build Coastguard Worker void verifyStencilMaskInitial(tcu::TestContext &testCtx, GLenum name, int stencilBits);
530*35238bceSAndroid Build Coastguard Worker };
531*35238bceSAndroid Build Coastguard Worker
GetFloatVerifier(const glw::Functions & gl,tcu::TestLog & log)532*35238bceSAndroid Build Coastguard Worker GetFloatVerifier::GetFloatVerifier(const glw::Functions &gl, tcu::TestLog &log) : StateVerifier(gl, log, "_getfloat")
533*35238bceSAndroid Build Coastguard Worker {
534*35238bceSAndroid Build Coastguard Worker }
535*35238bceSAndroid Build Coastguard Worker
verifyInteger(tcu::TestContext & testCtx,GLenum name,GLint reference)536*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyInteger(tcu::TestContext &testCtx, GLenum name, GLint reference)
537*35238bceSAndroid Build Coastguard Worker {
538*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
539*35238bceSAndroid Build Coastguard Worker
540*35238bceSAndroid Build Coastguard Worker const GLfloat referenceAsFloat = GLfloat(reference);
541*35238bceSAndroid Build Coastguard Worker DE_ASSERT(
542*35238bceSAndroid Build Coastguard Worker reference ==
543*35238bceSAndroid Build Coastguard Worker GLint(
544*35238bceSAndroid Build Coastguard Worker referenceAsFloat)); // reference integer must have 1:1 mapping to float for this to work. Reference value is always such value in these tests
545*35238bceSAndroid Build Coastguard Worker
546*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLfloat> state;
547*35238bceSAndroid Build Coastguard Worker glGetFloatv(name, &state);
548*35238bceSAndroid Build Coastguard Worker
549*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
550*35238bceSAndroid Build Coastguard Worker return;
551*35238bceSAndroid Build Coastguard Worker
552*35238bceSAndroid Build Coastguard Worker if (state != referenceAsFloat)
553*35238bceSAndroid Build Coastguard Worker {
554*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected " << referenceAsFloat << "; got " << state
555*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
556*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
557*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
558*35238bceSAndroid Build Coastguard Worker }
559*35238bceSAndroid Build Coastguard Worker }
560*35238bceSAndroid Build Coastguard Worker
verifyInteger4(tcu::TestContext & testCtx,GLenum name,GLint reference0,GLint reference1,GLint reference2,GLint reference3)561*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyInteger4(tcu::TestContext &testCtx, GLenum name, GLint reference0, GLint reference1,
562*35238bceSAndroid Build Coastguard Worker GLint reference2, GLint reference3)
563*35238bceSAndroid Build Coastguard Worker {
564*35238bceSAndroid Build Coastguard Worker verifyInteger4Mask(testCtx, name, reference0, true, reference1, true, reference2, true, reference3, true);
565*35238bceSAndroid Build Coastguard Worker }
566*35238bceSAndroid Build Coastguard Worker
verifyInteger4Mask(tcu::TestContext & testCtx,GLenum name,GLint reference0,bool enableRef0,GLint reference1,bool enableRef1,GLint reference2,bool enableRef2,GLint reference3,bool enableRef3)567*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyInteger4Mask(tcu::TestContext &testCtx, GLenum name, GLint reference0, bool enableRef0,
568*35238bceSAndroid Build Coastguard Worker GLint reference1, bool enableRef1, GLint reference2, bool enableRef2,
569*35238bceSAndroid Build Coastguard Worker GLint reference3, bool enableRef3)
570*35238bceSAndroid Build Coastguard Worker {
571*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
572*35238bceSAndroid Build Coastguard Worker
573*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLfloat[4]> floatVector4;
574*35238bceSAndroid Build Coastguard Worker glGetFloatv(name, floatVector4);
575*35238bceSAndroid Build Coastguard Worker
576*35238bceSAndroid Build Coastguard Worker if (!floatVector4.verifyValidity(testCtx))
577*35238bceSAndroid Build Coastguard Worker return;
578*35238bceSAndroid Build Coastguard Worker
579*35238bceSAndroid Build Coastguard Worker if ((enableRef0 && (floatVector4[0] != GLfloat(reference0))) ||
580*35238bceSAndroid Build Coastguard Worker (enableRef1 && (floatVector4[1] != GLfloat(reference1))) ||
581*35238bceSAndroid Build Coastguard Worker (enableRef2 && (floatVector4[2] != GLfloat(reference2))) ||
582*35238bceSAndroid Build Coastguard Worker (enableRef3 && (floatVector4[3] != GLfloat(reference3))))
583*35238bceSAndroid Build Coastguard Worker {
584*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected " << (enableRef0 ? "" : "(") << GLfloat(reference0)
585*35238bceSAndroid Build Coastguard Worker << (enableRef0 ? "" : ")") << ", " << (enableRef1 ? "" : "(") << GLfloat(reference1)
586*35238bceSAndroid Build Coastguard Worker << (enableRef1 ? "" : ")") << ", " << (enableRef2 ? "" : "(") << GLfloat(reference2)
587*35238bceSAndroid Build Coastguard Worker << (enableRef2 ? "" : ")") << ", " << (enableRef3 ? "" : "(") << GLfloat(reference3)
588*35238bceSAndroid Build Coastguard Worker << (enableRef3 ? "" : ")") << TestLog::EndMessage;
589*35238bceSAndroid Build Coastguard Worker
590*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
591*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
592*35238bceSAndroid Build Coastguard Worker }
593*35238bceSAndroid Build Coastguard Worker }
594*35238bceSAndroid Build Coastguard Worker
verifyIntegerGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLint reference)595*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLint reference)
596*35238bceSAndroid Build Coastguard Worker {
597*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
598*35238bceSAndroid Build Coastguard Worker
599*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLfloat> state;
600*35238bceSAndroid Build Coastguard Worker glGetFloatv(name, &state);
601*35238bceSAndroid Build Coastguard Worker
602*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
603*35238bceSAndroid Build Coastguard Worker return;
604*35238bceSAndroid Build Coastguard Worker
605*35238bceSAndroid Build Coastguard Worker if (state < GLfloat(reference))
606*35238bceSAndroid Build Coastguard Worker {
607*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << GLfloat(reference)
608*35238bceSAndroid Build Coastguard Worker << "; got " << state << TestLog::EndMessage;
609*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
610*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
611*35238bceSAndroid Build Coastguard Worker }
612*35238bceSAndroid Build Coastguard Worker }
613*35238bceSAndroid Build Coastguard Worker
verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext & testCtx,GLenum name,GLuint reference)614*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyUnsignedIntegerGreaterOrEqual(tcu::TestContext &testCtx, GLenum name, GLuint reference)
615*35238bceSAndroid Build Coastguard Worker {
616*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
617*35238bceSAndroid Build Coastguard Worker
618*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLfloat> state;
619*35238bceSAndroid Build Coastguard Worker glGetFloatv(name, &state);
620*35238bceSAndroid Build Coastguard Worker
621*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
622*35238bceSAndroid Build Coastguard Worker return;
623*35238bceSAndroid Build Coastguard Worker
624*35238bceSAndroid Build Coastguard Worker if (state < GLfloat(reference))
625*35238bceSAndroid Build Coastguard Worker {
626*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << GLfloat(reference)
627*35238bceSAndroid Build Coastguard Worker << "; got " << state << TestLog::EndMessage;
628*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
629*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
630*35238bceSAndroid Build Coastguard Worker }
631*35238bceSAndroid Build Coastguard Worker }
632*35238bceSAndroid Build Coastguard Worker
verifyIntegerGreaterOrEqual2(tcu::TestContext & testCtx,GLenum name,GLint reference0,GLint reference1)633*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyIntegerGreaterOrEqual2(tcu::TestContext &testCtx, GLenum name, GLint reference0,
634*35238bceSAndroid Build Coastguard Worker GLint reference1)
635*35238bceSAndroid Build Coastguard Worker {
636*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
637*35238bceSAndroid Build Coastguard Worker
638*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLfloat[2]> floatVector2;
639*35238bceSAndroid Build Coastguard Worker glGetFloatv(name, floatVector2);
640*35238bceSAndroid Build Coastguard Worker
641*35238bceSAndroid Build Coastguard Worker if (!floatVector2.verifyValidity(testCtx))
642*35238bceSAndroid Build Coastguard Worker return;
643*35238bceSAndroid Build Coastguard Worker
644*35238bceSAndroid Build Coastguard Worker if (floatVector2[0] < GLfloat(reference0) || floatVector2[1] < GLfloat(reference1))
645*35238bceSAndroid Build Coastguard Worker {
646*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << GLfloat(reference0) << ", "
647*35238bceSAndroid Build Coastguard Worker << GLfloat(reference1) << "; got " << floatVector2[0] << ", " << floatVector2[1]
648*35238bceSAndroid Build Coastguard Worker << TestLog::EndMessage;
649*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
650*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
651*35238bceSAndroid Build Coastguard Worker }
652*35238bceSAndroid Build Coastguard Worker }
653*35238bceSAndroid Build Coastguard Worker
verifyIntegerAnyOf(tcu::TestContext & testCtx,GLenum name,const GLint references[],size_t referencesLength)654*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyIntegerAnyOf(tcu::TestContext &testCtx, GLenum name, const GLint references[],
655*35238bceSAndroid Build Coastguard Worker size_t referencesLength)
656*35238bceSAndroid Build Coastguard Worker {
657*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
658*35238bceSAndroid Build Coastguard Worker
659*35238bceSAndroid Build Coastguard Worker StateQueryMemoryWriteGuard<GLfloat> state;
660*35238bceSAndroid Build Coastguard Worker glGetFloatv(name, &state);
661*35238bceSAndroid Build Coastguard Worker
662*35238bceSAndroid Build Coastguard Worker if (!state.verifyValidity(testCtx))
663*35238bceSAndroid Build Coastguard Worker return;
664*35238bceSAndroid Build Coastguard Worker
665*35238bceSAndroid Build Coastguard Worker for (size_t ndx = 0; ndx < referencesLength; ++ndx)
666*35238bceSAndroid Build Coastguard Worker {
667*35238bceSAndroid Build Coastguard Worker const GLfloat expectedGLState = GLfloat(references[ndx]);
668*35238bceSAndroid Build Coastguard Worker DE_ASSERT(
669*35238bceSAndroid Build Coastguard Worker references[ndx] ==
670*35238bceSAndroid Build Coastguard Worker GLint(
671*35238bceSAndroid Build Coastguard Worker expectedGLState)); // reference integer must have 1:1 mapping to float for this to work. Reference value is always such value in these tests
672*35238bceSAndroid Build Coastguard Worker
673*35238bceSAndroid Build Coastguard Worker if (state == expectedGLState)
674*35238bceSAndroid Build Coastguard Worker return;
675*35238bceSAndroid Build Coastguard Worker }
676*35238bceSAndroid Build Coastguard Worker
677*35238bceSAndroid Build Coastguard Worker testCtx.getLog() << TestLog::Message << "// ERROR: got " << state << TestLog::EndMessage;
678*35238bceSAndroid Build Coastguard Worker if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
679*35238bceSAndroid Build Coastguard Worker testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
680*35238bceSAndroid Build Coastguard Worker }
681*35238bceSAndroid Build Coastguard Worker
verifyStencilMaskInitial(tcu::TestContext & testCtx,GLenum name,int stencilBits)682*35238bceSAndroid Build Coastguard Worker void GetFloatVerifier::verifyStencilMaskInitial(tcu::TestContext &testCtx, GLenum name, int stencilBits)
683*35238bceSAndroid Build Coastguard Worker {
684*35238bceSAndroid Build Coastguard Worker // checking the mask bits with float doesn't make much sense because of conversion errors
685*35238bceSAndroid Build Coastguard Worker // just verify that the value is greater or equal to the minimum value
686*35238bceSAndroid Build Coastguard Worker const GLint reference = (1 << stencilBits) - 1;
687*35238bceSAndroid Build Coastguard Worker verifyIntegerGreaterOrEqual(testCtx, name, reference);
688*35238bceSAndroid Build Coastguard Worker }
689*35238bceSAndroid Build Coastguard Worker
690*35238bceSAndroid Build Coastguard Worker } // namespace IntegerStateQueryVerifiers
691*35238bceSAndroid Build Coastguard Worker
692*35238bceSAndroid Build Coastguard Worker namespace
693*35238bceSAndroid Build Coastguard Worker {
694*35238bceSAndroid Build Coastguard Worker
695*35238bceSAndroid Build Coastguard Worker using namespace IntegerStateQueryVerifiers;
696*35238bceSAndroid Build Coastguard Worker using namespace deqp::gls::StateQueryUtil;
697*35238bceSAndroid Build Coastguard Worker
698*35238bceSAndroid Build Coastguard Worker class ConstantMinimumValueTestCase : public ApiCase
699*35238bceSAndroid Build Coastguard Worker {
700*35238bceSAndroid Build Coastguard Worker public:
ConstantMinimumValueTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum targetName,GLint minValue)701*35238bceSAndroid Build Coastguard Worker ConstantMinimumValueTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
702*35238bceSAndroid Build Coastguard Worker GLenum targetName, GLint minValue)
703*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
704*35238bceSAndroid Build Coastguard Worker , m_targetName(targetName)
705*35238bceSAndroid Build Coastguard Worker , m_minValue(minValue)
706*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
707*35238bceSAndroid Build Coastguard Worker {
708*35238bceSAndroid Build Coastguard Worker }
709*35238bceSAndroid Build Coastguard Worker
test(void)710*35238bceSAndroid Build Coastguard Worker void test(void)
711*35238bceSAndroid Build Coastguard Worker {
712*35238bceSAndroid Build Coastguard Worker m_verifier->verifyUnsignedIntegerGreaterOrEqual(m_testCtx, m_targetName, m_minValue);
713*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
714*35238bceSAndroid Build Coastguard Worker }
715*35238bceSAndroid Build Coastguard Worker
716*35238bceSAndroid Build Coastguard Worker private:
717*35238bceSAndroid Build Coastguard Worker GLenum m_targetName;
718*35238bceSAndroid Build Coastguard Worker GLint m_minValue;
719*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
720*35238bceSAndroid Build Coastguard Worker };
721*35238bceSAndroid Build Coastguard Worker
722*35238bceSAndroid Build Coastguard Worker class SampleBuffersTestCase : public ApiCase
723*35238bceSAndroid Build Coastguard Worker {
724*35238bceSAndroid Build Coastguard Worker public:
SampleBuffersTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)725*35238bceSAndroid Build Coastguard Worker SampleBuffersTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
726*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
727*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
728*35238bceSAndroid Build Coastguard Worker {
729*35238bceSAndroid Build Coastguard Worker }
730*35238bceSAndroid Build Coastguard Worker
test(void)731*35238bceSAndroid Build Coastguard Worker void test(void)
732*35238bceSAndroid Build Coastguard Worker {
733*35238bceSAndroid Build Coastguard Worker const int expectedSampleBuffers = (m_context.getRenderTarget().getNumSamples() > 1) ? 1 : 0;
734*35238bceSAndroid Build Coastguard Worker
735*35238bceSAndroid Build Coastguard Worker m_log << tcu::TestLog::Message << "Sample count is " << (m_context.getRenderTarget().getNumSamples())
736*35238bceSAndroid Build Coastguard Worker << ", expecting GL_SAMPLE_BUFFERS to be " << expectedSampleBuffers << tcu::TestLog::EndMessage;
737*35238bceSAndroid Build Coastguard Worker
738*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_SAMPLE_BUFFERS, expectedSampleBuffers);
739*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
740*35238bceSAndroid Build Coastguard Worker }
741*35238bceSAndroid Build Coastguard Worker
742*35238bceSAndroid Build Coastguard Worker private:
743*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
744*35238bceSAndroid Build Coastguard Worker };
745*35238bceSAndroid Build Coastguard Worker
746*35238bceSAndroid Build Coastguard Worker class SamplesTestCase : public ApiCase
747*35238bceSAndroid Build Coastguard Worker {
748*35238bceSAndroid Build Coastguard Worker public:
SamplesTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)749*35238bceSAndroid Build Coastguard Worker SamplesTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
750*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
751*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
752*35238bceSAndroid Build Coastguard Worker {
753*35238bceSAndroid Build Coastguard Worker }
754*35238bceSAndroid Build Coastguard Worker
test(void)755*35238bceSAndroid Build Coastguard Worker void test(void)
756*35238bceSAndroid Build Coastguard Worker {
757*35238bceSAndroid Build Coastguard Worker // MSAA?
758*35238bceSAndroid Build Coastguard Worker if (m_context.getRenderTarget().getNumSamples() > 1)
759*35238bceSAndroid Build Coastguard Worker {
760*35238bceSAndroid Build Coastguard Worker m_log << tcu::TestLog::Message << "Sample count is " << (m_context.getRenderTarget().getNumSamples())
761*35238bceSAndroid Build Coastguard Worker << tcu::TestLog::EndMessage;
762*35238bceSAndroid Build Coastguard Worker
763*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_SAMPLES, m_context.getRenderTarget().getNumSamples());
764*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
765*35238bceSAndroid Build Coastguard Worker }
766*35238bceSAndroid Build Coastguard Worker else
767*35238bceSAndroid Build Coastguard Worker {
768*35238bceSAndroid Build Coastguard Worker const glw::GLint validSamples[] = {0, 1};
769*35238bceSAndroid Build Coastguard Worker
770*35238bceSAndroid Build Coastguard Worker m_log << tcu::TestLog::Message << "Expecting GL_SAMPLES to be 0 or 1" << tcu::TestLog::EndMessage;
771*35238bceSAndroid Build Coastguard Worker
772*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerAnyOf(m_testCtx, GL_SAMPLES, validSamples, DE_LENGTH_OF_ARRAY(validSamples));
773*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
774*35238bceSAndroid Build Coastguard Worker }
775*35238bceSAndroid Build Coastguard Worker }
776*35238bceSAndroid Build Coastguard Worker
777*35238bceSAndroid Build Coastguard Worker private:
778*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
779*35238bceSAndroid Build Coastguard Worker };
780*35238bceSAndroid Build Coastguard Worker
781*35238bceSAndroid Build Coastguard Worker class HintTestCase : public ApiCase
782*35238bceSAndroid Build Coastguard Worker {
783*35238bceSAndroid Build Coastguard Worker public:
HintTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum targetName)784*35238bceSAndroid Build Coastguard Worker HintTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
785*35238bceSAndroid Build Coastguard Worker GLenum targetName)
786*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
787*35238bceSAndroid Build Coastguard Worker , m_targetName(targetName)
788*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
789*35238bceSAndroid Build Coastguard Worker {
790*35238bceSAndroid Build Coastguard Worker }
791*35238bceSAndroid Build Coastguard Worker
test(void)792*35238bceSAndroid Build Coastguard Worker void test(void)
793*35238bceSAndroid Build Coastguard Worker {
794*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_targetName, GL_DONT_CARE);
795*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
796*35238bceSAndroid Build Coastguard Worker
797*35238bceSAndroid Build Coastguard Worker glHint(m_targetName, GL_NICEST);
798*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_targetName, GL_NICEST);
799*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
800*35238bceSAndroid Build Coastguard Worker
801*35238bceSAndroid Build Coastguard Worker glHint(m_targetName, GL_FASTEST);
802*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_targetName, GL_FASTEST);
803*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
804*35238bceSAndroid Build Coastguard Worker
805*35238bceSAndroid Build Coastguard Worker glHint(m_targetName, GL_DONT_CARE);
806*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_targetName, GL_DONT_CARE);
807*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
808*35238bceSAndroid Build Coastguard Worker }
809*35238bceSAndroid Build Coastguard Worker
810*35238bceSAndroid Build Coastguard Worker private:
811*35238bceSAndroid Build Coastguard Worker GLenum m_targetName;
812*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
813*35238bceSAndroid Build Coastguard Worker };
814*35238bceSAndroid Build Coastguard Worker
815*35238bceSAndroid Build Coastguard Worker class DepthFuncTestCase : public ApiCase
816*35238bceSAndroid Build Coastguard Worker {
817*35238bceSAndroid Build Coastguard Worker public:
DepthFuncTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)818*35238bceSAndroid Build Coastguard Worker DepthFuncTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
819*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
820*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
821*35238bceSAndroid Build Coastguard Worker {
822*35238bceSAndroid Build Coastguard Worker }
823*35238bceSAndroid Build Coastguard Worker
test(void)824*35238bceSAndroid Build Coastguard Worker void test(void)
825*35238bceSAndroid Build Coastguard Worker {
826*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_DEPTH_FUNC, GL_LESS);
827*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
828*35238bceSAndroid Build Coastguard Worker
829*35238bceSAndroid Build Coastguard Worker const GLenum depthFunctions[] = {GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL,
830*35238bceSAndroid Build Coastguard Worker GL_EQUAL, GL_GREATER, GL_GEQUAL, GL_NOTEQUAL};
831*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(depthFunctions); ndx++)
832*35238bceSAndroid Build Coastguard Worker {
833*35238bceSAndroid Build Coastguard Worker glDepthFunc(depthFunctions[ndx]);
834*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
835*35238bceSAndroid Build Coastguard Worker
836*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_DEPTH_FUNC, depthFunctions[ndx]);
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 CullFaceTestCase : public ApiCase
846*35238bceSAndroid Build Coastguard Worker {
847*35238bceSAndroid Build Coastguard Worker public:
CullFaceTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)848*35238bceSAndroid Build Coastguard Worker CullFaceTestCase(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 m_verifier->verifyInteger(m_testCtx, GL_CULL_FACE_MODE, GL_BACK);
857*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
858*35238bceSAndroid Build Coastguard Worker
859*35238bceSAndroid Build Coastguard Worker const GLenum cullFaces[] = {GL_FRONT, GL_BACK, GL_FRONT_AND_BACK};
860*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(cullFaces); ndx++)
861*35238bceSAndroid Build Coastguard Worker {
862*35238bceSAndroid Build Coastguard Worker glCullFace(cullFaces[ndx]);
863*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
864*35238bceSAndroid Build Coastguard Worker
865*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_CULL_FACE_MODE, cullFaces[ndx]);
866*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
867*35238bceSAndroid Build Coastguard Worker }
868*35238bceSAndroid Build Coastguard Worker }
869*35238bceSAndroid Build Coastguard Worker
870*35238bceSAndroid Build Coastguard Worker private:
871*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
872*35238bceSAndroid Build Coastguard Worker };
873*35238bceSAndroid Build Coastguard Worker
874*35238bceSAndroid Build Coastguard Worker class FrontFaceTestCase : public ApiCase
875*35238bceSAndroid Build Coastguard Worker {
876*35238bceSAndroid Build Coastguard Worker public:
FrontFaceTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)877*35238bceSAndroid Build Coastguard Worker FrontFaceTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
878*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
879*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
880*35238bceSAndroid Build Coastguard Worker {
881*35238bceSAndroid Build Coastguard Worker }
882*35238bceSAndroid Build Coastguard Worker
test(void)883*35238bceSAndroid Build Coastguard Worker void test(void)
884*35238bceSAndroid Build Coastguard Worker {
885*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_FRONT_FACE, GL_CCW);
886*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
887*35238bceSAndroid Build Coastguard Worker
888*35238bceSAndroid Build Coastguard Worker const GLenum frontFaces[] = {GL_CW, GL_CCW};
889*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(frontFaces); ndx++)
890*35238bceSAndroid Build Coastguard Worker {
891*35238bceSAndroid Build Coastguard Worker glFrontFace(frontFaces[ndx]);
892*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
893*35238bceSAndroid Build Coastguard Worker
894*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_FRONT_FACE, frontFaces[ndx]);
895*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
896*35238bceSAndroid Build Coastguard Worker }
897*35238bceSAndroid Build Coastguard Worker }
898*35238bceSAndroid Build Coastguard Worker
899*35238bceSAndroid Build Coastguard Worker private:
900*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
901*35238bceSAndroid Build Coastguard Worker };
902*35238bceSAndroid Build Coastguard Worker
903*35238bceSAndroid Build Coastguard Worker class ViewPortTestCase : public ApiCase
904*35238bceSAndroid Build Coastguard Worker {
905*35238bceSAndroid Build Coastguard Worker public:
ViewPortTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)906*35238bceSAndroid Build Coastguard Worker ViewPortTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
907*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
908*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
909*35238bceSAndroid Build Coastguard Worker {
910*35238bceSAndroid Build Coastguard Worker }
911*35238bceSAndroid Build Coastguard Worker
test(void)912*35238bceSAndroid Build Coastguard Worker void test(void)
913*35238bceSAndroid Build Coastguard Worker {
914*35238bceSAndroid Build Coastguard Worker de::Random rnd(0xabcdef);
915*35238bceSAndroid Build Coastguard Worker
916*35238bceSAndroid Build Coastguard Worker GLint maxViewportDimensions[2] = {0};
917*35238bceSAndroid Build Coastguard Worker GLfloat viewportBoundsRange[2] = {0.0f};
918*35238bceSAndroid Build Coastguard Worker GLboolean hasViewportArray = false;
919*35238bceSAndroid Build Coastguard Worker glGetIntegerv(GL_MAX_VIEWPORT_DIMS, maxViewportDimensions);
920*35238bceSAndroid Build Coastguard Worker hasViewportArray = m_context.getContextInfo().isExtensionSupported("GL_OES_viewport_array") ||
921*35238bceSAndroid Build Coastguard Worker m_context.getContextInfo().isExtensionSupported("GL_NV_viewport_array");
922*35238bceSAndroid Build Coastguard Worker if (hasViewportArray)
923*35238bceSAndroid Build Coastguard Worker {
924*35238bceSAndroid Build Coastguard Worker glGetFloatv(GL_VIEWPORT_BOUNDS_RANGE, viewportBoundsRange);
925*35238bceSAndroid Build Coastguard Worker }
926*35238bceSAndroid Build Coastguard Worker
927*35238bceSAndroid Build Coastguard Worker // verify initial value of first two values
928*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT, 0, 0, m_context.getRenderTarget().getWidth(),
929*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getHeight());
930*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
931*35238bceSAndroid Build Coastguard Worker
932*35238bceSAndroid Build Coastguard Worker const int numIterations = 120;
933*35238bceSAndroid Build Coastguard Worker for (int i = 0; i < numIterations; ++i)
934*35238bceSAndroid Build Coastguard Worker {
935*35238bceSAndroid Build Coastguard Worker GLint x = rnd.getInt(-64000, 64000);
936*35238bceSAndroid Build Coastguard Worker GLint y = rnd.getInt(-64000, 64000);
937*35238bceSAndroid Build Coastguard Worker GLsizei width = rnd.getInt(0, maxViewportDimensions[0]);
938*35238bceSAndroid Build Coastguard Worker GLsizei height = rnd.getInt(0, maxViewportDimensions[1]);
939*35238bceSAndroid Build Coastguard Worker
940*35238bceSAndroid Build Coastguard Worker glViewport(x, y, width, height);
941*35238bceSAndroid Build Coastguard Worker
942*35238bceSAndroid Build Coastguard Worker if (hasViewportArray)
943*35238bceSAndroid Build Coastguard Worker {
944*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT,
945*35238bceSAndroid Build Coastguard Worker de::clamp(x, deFloorFloatToInt32(viewportBoundsRange[0]),
946*35238bceSAndroid Build Coastguard Worker deFloorFloatToInt32(viewportBoundsRange[1])),
947*35238bceSAndroid Build Coastguard Worker de::clamp(y, deFloorFloatToInt32(viewportBoundsRange[0]),
948*35238bceSAndroid Build Coastguard Worker deFloorFloatToInt32(viewportBoundsRange[1])),
949*35238bceSAndroid Build Coastguard Worker width, height);
950*35238bceSAndroid Build Coastguard Worker }
951*35238bceSAndroid Build Coastguard Worker else
952*35238bceSAndroid Build Coastguard Worker {
953*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT, x, y, width, height);
954*35238bceSAndroid Build Coastguard Worker }
955*35238bceSAndroid Build Coastguard Worker
956*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
957*35238bceSAndroid Build Coastguard Worker }
958*35238bceSAndroid Build Coastguard Worker }
959*35238bceSAndroid Build Coastguard Worker
960*35238bceSAndroid Build Coastguard Worker private:
961*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
962*35238bceSAndroid Build Coastguard Worker };
963*35238bceSAndroid Build Coastguard Worker
964*35238bceSAndroid Build Coastguard Worker class ScissorBoxTestCase : public ApiCase
965*35238bceSAndroid Build Coastguard Worker {
966*35238bceSAndroid Build Coastguard Worker public:
ScissorBoxTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)967*35238bceSAndroid Build Coastguard Worker ScissorBoxTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
968*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
969*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
970*35238bceSAndroid Build Coastguard Worker {
971*35238bceSAndroid Build Coastguard Worker }
972*35238bceSAndroid Build Coastguard Worker
test(void)973*35238bceSAndroid Build Coastguard Worker void test(void)
974*35238bceSAndroid Build Coastguard Worker {
975*35238bceSAndroid Build Coastguard Worker de::Random rnd(0xabcdef);
976*35238bceSAndroid Build Coastguard Worker
977*35238bceSAndroid Build Coastguard Worker // verify initial value
978*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger4(m_testCtx, GL_SCISSOR_BOX, 0, 0, m_context.getRenderTarget().getWidth(),
979*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getHeight());
980*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
981*35238bceSAndroid Build Coastguard Worker
982*35238bceSAndroid Build Coastguard Worker const int numIterations = 120;
983*35238bceSAndroid Build Coastguard Worker for (int i = 0; i < numIterations; ++i)
984*35238bceSAndroid Build Coastguard Worker {
985*35238bceSAndroid Build Coastguard Worker GLint left = rnd.getInt(-64000, 64000);
986*35238bceSAndroid Build Coastguard Worker GLint bottom = rnd.getInt(-64000, 64000);
987*35238bceSAndroid Build Coastguard Worker GLsizei width = rnd.getInt(0, 64000);
988*35238bceSAndroid Build Coastguard Worker GLsizei height = rnd.getInt(0, 64000);
989*35238bceSAndroid Build Coastguard Worker
990*35238bceSAndroid Build Coastguard Worker glScissor(left, bottom, width, height);
991*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger4(m_testCtx, GL_SCISSOR_BOX, left, bottom, width, height);
992*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
993*35238bceSAndroid Build Coastguard Worker }
994*35238bceSAndroid Build Coastguard Worker }
995*35238bceSAndroid Build Coastguard Worker
996*35238bceSAndroid Build Coastguard Worker private:
997*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
998*35238bceSAndroid Build Coastguard Worker };
999*35238bceSAndroid Build Coastguard Worker
1000*35238bceSAndroid Build Coastguard Worker class MaxViewportDimsTestCase : public ApiCase
1001*35238bceSAndroid Build Coastguard Worker {
1002*35238bceSAndroid Build Coastguard Worker public:
MaxViewportDimsTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1003*35238bceSAndroid Build Coastguard Worker MaxViewportDimsTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1004*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1005*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1006*35238bceSAndroid Build Coastguard Worker {
1007*35238bceSAndroid Build Coastguard Worker }
1008*35238bceSAndroid Build Coastguard Worker
test(void)1009*35238bceSAndroid Build Coastguard Worker void test(void)
1010*35238bceSAndroid Build Coastguard Worker {
1011*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual2(m_testCtx, GL_MAX_VIEWPORT_DIMS,
1012*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getWidth(),
1013*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getHeight());
1014*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1015*35238bceSAndroid Build Coastguard Worker }
1016*35238bceSAndroid Build Coastguard Worker
1017*35238bceSAndroid Build Coastguard Worker private:
1018*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1019*35238bceSAndroid Build Coastguard Worker };
1020*35238bceSAndroid Build Coastguard Worker
1021*35238bceSAndroid Build Coastguard Worker class StencilRefTestCase : public ApiCase
1022*35238bceSAndroid Build Coastguard Worker {
1023*35238bceSAndroid Build Coastguard Worker public:
StencilRefTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName)1024*35238bceSAndroid Build Coastguard Worker StencilRefTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1025*35238bceSAndroid Build Coastguard Worker GLenum testTargetName)
1026*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1027*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1028*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1029*35238bceSAndroid Build Coastguard Worker {
1030*35238bceSAndroid Build Coastguard Worker }
1031*35238bceSAndroid Build Coastguard Worker
test(void)1032*35238bceSAndroid Build Coastguard Worker void test(void)
1033*35238bceSAndroid Build Coastguard Worker {
1034*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, 0);
1035*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1036*35238bceSAndroid Build Coastguard Worker
1037*35238bceSAndroid Build Coastguard Worker const int stencilBits = m_context.getRenderTarget().getStencilBits();
1038*35238bceSAndroid Build Coastguard Worker
1039*35238bceSAndroid Build Coastguard Worker for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
1040*35238bceSAndroid Build Coastguard Worker {
1041*35238bceSAndroid Build Coastguard Worker const int ref = 1 << stencilBit;
1042*35238bceSAndroid Build Coastguard Worker
1043*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, ref, 0); // mask should not affect the REF
1044*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1045*35238bceSAndroid Build Coastguard Worker
1046*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
1047*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1048*35238bceSAndroid Build Coastguard Worker
1049*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, ref, ref);
1050*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1051*35238bceSAndroid Build Coastguard Worker
1052*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
1053*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1054*35238bceSAndroid Build Coastguard Worker }
1055*35238bceSAndroid Build Coastguard Worker }
1056*35238bceSAndroid Build Coastguard Worker
1057*35238bceSAndroid Build Coastguard Worker private:
1058*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1059*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1060*35238bceSAndroid Build Coastguard Worker };
1061*35238bceSAndroid Build Coastguard Worker
1062*35238bceSAndroid Build Coastguard Worker class StencilRefSeparateTestCase : public ApiCase
1063*35238bceSAndroid Build Coastguard Worker {
1064*35238bceSAndroid Build Coastguard Worker public:
StencilRefSeparateTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,GLenum stencilFuncTargetFace)1065*35238bceSAndroid Build Coastguard Worker StencilRefSeparateTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1066*35238bceSAndroid Build Coastguard Worker GLenum testTargetName, GLenum stencilFuncTargetFace)
1067*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1068*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1069*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1070*35238bceSAndroid Build Coastguard Worker , m_stencilFuncTargetFace(stencilFuncTargetFace)
1071*35238bceSAndroid Build Coastguard Worker {
1072*35238bceSAndroid Build Coastguard Worker }
1073*35238bceSAndroid Build Coastguard Worker
test(void)1074*35238bceSAndroid Build Coastguard Worker void test(void)
1075*35238bceSAndroid Build Coastguard Worker {
1076*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, 0);
1077*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1078*35238bceSAndroid Build Coastguard Worker
1079*35238bceSAndroid Build Coastguard Worker const int stencilBits = m_context.getRenderTarget().getStencilBits();
1080*35238bceSAndroid Build Coastguard Worker
1081*35238bceSAndroid Build Coastguard Worker for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
1082*35238bceSAndroid Build Coastguard Worker {
1083*35238bceSAndroid Build Coastguard Worker const int ref = 1 << stencilBit;
1084*35238bceSAndroid Build Coastguard Worker
1085*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(m_stencilFuncTargetFace, GL_ALWAYS, ref, 0);
1086*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1087*35238bceSAndroid Build Coastguard Worker
1088*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
1089*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1090*35238bceSAndroid Build Coastguard Worker
1091*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(m_stencilFuncTargetFace, GL_ALWAYS, ref, ref);
1092*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1093*35238bceSAndroid Build Coastguard Worker
1094*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
1095*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1096*35238bceSAndroid Build Coastguard Worker }
1097*35238bceSAndroid Build Coastguard Worker }
1098*35238bceSAndroid Build Coastguard Worker
1099*35238bceSAndroid Build Coastguard Worker private:
1100*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1101*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1102*35238bceSAndroid Build Coastguard Worker GLenum m_stencilFuncTargetFace;
1103*35238bceSAndroid Build Coastguard Worker };
1104*35238bceSAndroid Build Coastguard Worker
1105*35238bceSAndroid Build Coastguard Worker class StencilOpTestCase : public ApiCase
1106*35238bceSAndroid Build Coastguard Worker {
1107*35238bceSAndroid Build Coastguard Worker public:
StencilOpTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum stencilOpName)1108*35238bceSAndroid Build Coastguard Worker StencilOpTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1109*35238bceSAndroid Build Coastguard Worker GLenum stencilOpName)
1110*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1111*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1112*35238bceSAndroid Build Coastguard Worker , m_stencilOpName(stencilOpName)
1113*35238bceSAndroid Build Coastguard Worker {
1114*35238bceSAndroid Build Coastguard Worker }
1115*35238bceSAndroid Build Coastguard Worker
test(void)1116*35238bceSAndroid Build Coastguard Worker void test(void)
1117*35238bceSAndroid Build Coastguard Worker {
1118*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_stencilOpName, GL_KEEP);
1119*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1120*35238bceSAndroid Build Coastguard Worker
1121*35238bceSAndroid Build Coastguard Worker const GLenum stencilOpValues[] = {GL_KEEP, GL_ZERO, GL_REPLACE, GL_INCR,
1122*35238bceSAndroid Build Coastguard Worker GL_DECR, GL_INVERT, GL_INCR_WRAP, GL_DECR_WRAP};
1123*35238bceSAndroid Build Coastguard Worker
1124*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilOpValues); ++ndx)
1125*35238bceSAndroid Build Coastguard Worker {
1126*35238bceSAndroid Build Coastguard Worker SetStencilOp(stencilOpValues[ndx]);
1127*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1128*35238bceSAndroid Build Coastguard Worker
1129*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_stencilOpName, stencilOpValues[ndx]);
1130*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1131*35238bceSAndroid Build Coastguard Worker }
1132*35238bceSAndroid Build Coastguard Worker }
1133*35238bceSAndroid Build Coastguard Worker
1134*35238bceSAndroid Build Coastguard Worker protected:
SetStencilOp(GLenum stencilOpValue)1135*35238bceSAndroid Build Coastguard Worker virtual void SetStencilOp(GLenum stencilOpValue)
1136*35238bceSAndroid Build Coastguard Worker {
1137*35238bceSAndroid Build Coastguard Worker switch (m_stencilOpName)
1138*35238bceSAndroid Build Coastguard Worker {
1139*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_FAIL:
1140*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_BACK_FAIL:
1141*35238bceSAndroid Build Coastguard Worker glStencilOp(stencilOpValue, GL_KEEP, GL_KEEP);
1142*35238bceSAndroid Build Coastguard Worker break;
1143*35238bceSAndroid Build Coastguard Worker
1144*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_PASS_DEPTH_FAIL:
1145*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
1146*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, stencilOpValue, GL_KEEP);
1147*35238bceSAndroid Build Coastguard Worker break;
1148*35238bceSAndroid Build Coastguard Worker
1149*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_PASS_DEPTH_PASS:
1150*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_BACK_PASS_DEPTH_PASS:
1151*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_KEEP, stencilOpValue);
1152*35238bceSAndroid Build Coastguard Worker break;
1153*35238bceSAndroid Build Coastguard Worker
1154*35238bceSAndroid Build Coastguard Worker default:
1155*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false && "should not happen");
1156*35238bceSAndroid Build Coastguard Worker break;
1157*35238bceSAndroid Build Coastguard Worker }
1158*35238bceSAndroid Build Coastguard Worker }
1159*35238bceSAndroid Build Coastguard Worker
1160*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1161*35238bceSAndroid Build Coastguard Worker GLenum m_stencilOpName;
1162*35238bceSAndroid Build Coastguard Worker };
1163*35238bceSAndroid Build Coastguard Worker
1164*35238bceSAndroid Build Coastguard Worker class StencilOpSeparateTestCase : public StencilOpTestCase
1165*35238bceSAndroid Build Coastguard Worker {
1166*35238bceSAndroid Build Coastguard Worker public:
StencilOpSeparateTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum stencilOpName,GLenum stencilOpFace)1167*35238bceSAndroid Build Coastguard Worker StencilOpSeparateTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1168*35238bceSAndroid Build Coastguard Worker GLenum stencilOpName, GLenum stencilOpFace)
1169*35238bceSAndroid Build Coastguard Worker : StencilOpTestCase(context, verifier, name, description, stencilOpName)
1170*35238bceSAndroid Build Coastguard Worker , m_stencilOpFace(stencilOpFace)
1171*35238bceSAndroid Build Coastguard Worker {
1172*35238bceSAndroid Build Coastguard Worker }
1173*35238bceSAndroid Build Coastguard Worker
1174*35238bceSAndroid Build Coastguard Worker private:
SetStencilOp(GLenum stencilOpValue)1175*35238bceSAndroid Build Coastguard Worker void SetStencilOp(GLenum stencilOpValue)
1176*35238bceSAndroid Build Coastguard Worker {
1177*35238bceSAndroid Build Coastguard Worker switch (m_stencilOpName)
1178*35238bceSAndroid Build Coastguard Worker {
1179*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_FAIL:
1180*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_BACK_FAIL:
1181*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(m_stencilOpFace, stencilOpValue, GL_KEEP, GL_KEEP);
1182*35238bceSAndroid Build Coastguard Worker break;
1183*35238bceSAndroid Build Coastguard Worker
1184*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_PASS_DEPTH_FAIL:
1185*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
1186*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(m_stencilOpFace, GL_KEEP, stencilOpValue, GL_KEEP);
1187*35238bceSAndroid Build Coastguard Worker break;
1188*35238bceSAndroid Build Coastguard Worker
1189*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_PASS_DEPTH_PASS:
1190*35238bceSAndroid Build Coastguard Worker case GL_STENCIL_BACK_PASS_DEPTH_PASS:
1191*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(m_stencilOpFace, GL_KEEP, GL_KEEP, stencilOpValue);
1192*35238bceSAndroid Build Coastguard Worker break;
1193*35238bceSAndroid Build Coastguard Worker
1194*35238bceSAndroid Build Coastguard Worker default:
1195*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false && "should not happen");
1196*35238bceSAndroid Build Coastguard Worker break;
1197*35238bceSAndroid Build Coastguard Worker }
1198*35238bceSAndroid Build Coastguard Worker }
1199*35238bceSAndroid Build Coastguard Worker
1200*35238bceSAndroid Build Coastguard Worker GLenum m_stencilOpFace;
1201*35238bceSAndroid Build Coastguard Worker };
1202*35238bceSAndroid Build Coastguard Worker
1203*35238bceSAndroid Build Coastguard Worker class StencilFuncTestCase : public ApiCase
1204*35238bceSAndroid Build Coastguard Worker {
1205*35238bceSAndroid Build Coastguard Worker public:
StencilFuncTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1206*35238bceSAndroid Build Coastguard Worker StencilFuncTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1207*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1208*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1209*35238bceSAndroid Build Coastguard Worker {
1210*35238bceSAndroid Build Coastguard Worker }
1211*35238bceSAndroid Build Coastguard Worker
test(void)1212*35238bceSAndroid Build Coastguard Worker void test(void)
1213*35238bceSAndroid Build Coastguard Worker {
1214*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_STENCIL_FUNC, GL_ALWAYS);
1215*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1216*35238bceSAndroid Build Coastguard Worker
1217*35238bceSAndroid Build Coastguard Worker const GLenum stencilfuncValues[] = {GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL,
1218*35238bceSAndroid Build Coastguard Worker GL_EQUAL, GL_GEQUAL, GL_GREATER, GL_NOTEQUAL};
1219*35238bceSAndroid Build Coastguard Worker
1220*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilfuncValues); ++ndx)
1221*35238bceSAndroid Build Coastguard Worker {
1222*35238bceSAndroid Build Coastguard Worker glStencilFunc(stencilfuncValues[ndx], 0, 0);
1223*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1224*35238bceSAndroid Build Coastguard Worker
1225*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_STENCIL_FUNC, stencilfuncValues[ndx]);
1226*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1227*35238bceSAndroid Build Coastguard Worker
1228*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_STENCIL_BACK_FUNC, stencilfuncValues[ndx]);
1229*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1230*35238bceSAndroid Build Coastguard Worker }
1231*35238bceSAndroid Build Coastguard Worker }
1232*35238bceSAndroid Build Coastguard Worker
1233*35238bceSAndroid Build Coastguard Worker private:
1234*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1235*35238bceSAndroid Build Coastguard Worker };
1236*35238bceSAndroid Build Coastguard Worker
1237*35238bceSAndroid Build Coastguard Worker class StencilFuncSeparateTestCase : public ApiCase
1238*35238bceSAndroid Build Coastguard Worker {
1239*35238bceSAndroid Build Coastguard Worker public:
StencilFuncSeparateTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum stencilFuncName,GLenum stencilFuncFace)1240*35238bceSAndroid Build Coastguard Worker StencilFuncSeparateTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1241*35238bceSAndroid Build Coastguard Worker GLenum stencilFuncName, GLenum stencilFuncFace)
1242*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1243*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1244*35238bceSAndroid Build Coastguard Worker , m_stencilFuncName(stencilFuncName)
1245*35238bceSAndroid Build Coastguard Worker , m_stencilFuncFace(stencilFuncFace)
1246*35238bceSAndroid Build Coastguard Worker {
1247*35238bceSAndroid Build Coastguard Worker }
1248*35238bceSAndroid Build Coastguard Worker
test(void)1249*35238bceSAndroid Build Coastguard Worker void test(void)
1250*35238bceSAndroid Build Coastguard Worker {
1251*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_stencilFuncName, GL_ALWAYS);
1252*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1253*35238bceSAndroid Build Coastguard Worker
1254*35238bceSAndroid Build Coastguard Worker const GLenum stencilfuncValues[] = {GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL,
1255*35238bceSAndroid Build Coastguard Worker GL_EQUAL, GL_GEQUAL, GL_GREATER, GL_NOTEQUAL};
1256*35238bceSAndroid Build Coastguard Worker
1257*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilfuncValues); ++ndx)
1258*35238bceSAndroid Build Coastguard Worker {
1259*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(m_stencilFuncFace, stencilfuncValues[ndx], 0, 0);
1260*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1261*35238bceSAndroid Build Coastguard Worker
1262*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_stencilFuncName, stencilfuncValues[ndx]);
1263*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1264*35238bceSAndroid Build Coastguard Worker }
1265*35238bceSAndroid Build Coastguard Worker }
1266*35238bceSAndroid Build Coastguard Worker
1267*35238bceSAndroid Build Coastguard Worker private:
1268*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1269*35238bceSAndroid Build Coastguard Worker GLenum m_stencilFuncName;
1270*35238bceSAndroid Build Coastguard Worker GLenum m_stencilFuncFace;
1271*35238bceSAndroid Build Coastguard Worker };
1272*35238bceSAndroid Build Coastguard Worker
1273*35238bceSAndroid Build Coastguard Worker class StencilMaskTestCase : public ApiCase
1274*35238bceSAndroid Build Coastguard Worker {
1275*35238bceSAndroid Build Coastguard Worker public:
StencilMaskTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName)1276*35238bceSAndroid Build Coastguard Worker StencilMaskTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1277*35238bceSAndroid Build Coastguard Worker GLenum testTargetName)
1278*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1279*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1280*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1281*35238bceSAndroid Build Coastguard Worker {
1282*35238bceSAndroid Build Coastguard Worker }
1283*35238bceSAndroid Build Coastguard Worker
test(void)1284*35238bceSAndroid Build Coastguard Worker void test(void)
1285*35238bceSAndroid Build Coastguard Worker {
1286*35238bceSAndroid Build Coastguard Worker const int stencilBits = m_context.getRenderTarget().getStencilBits();
1287*35238bceSAndroid Build Coastguard Worker
1288*35238bceSAndroid Build Coastguard Worker m_verifier->verifyStencilMaskInitial(m_testCtx, m_testTargetName, stencilBits);
1289*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1290*35238bceSAndroid Build Coastguard Worker
1291*35238bceSAndroid Build Coastguard Worker for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
1292*35238bceSAndroid Build Coastguard Worker {
1293*35238bceSAndroid Build Coastguard Worker const int mask = 1 << stencilBit;
1294*35238bceSAndroid Build Coastguard Worker
1295*35238bceSAndroid Build Coastguard Worker glStencilFunc(GL_ALWAYS, 0, mask);
1296*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1297*35238bceSAndroid Build Coastguard Worker
1298*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
1299*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1300*35238bceSAndroid Build Coastguard Worker }
1301*35238bceSAndroid Build Coastguard Worker }
1302*35238bceSAndroid Build Coastguard Worker
1303*35238bceSAndroid Build Coastguard Worker private:
1304*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1305*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1306*35238bceSAndroid Build Coastguard Worker };
1307*35238bceSAndroid Build Coastguard Worker
1308*35238bceSAndroid Build Coastguard Worker class StencilMaskSeparateTestCase : public ApiCase
1309*35238bceSAndroid Build Coastguard Worker {
1310*35238bceSAndroid Build Coastguard Worker public:
StencilMaskSeparateTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,GLenum stencilFuncTargetFace)1311*35238bceSAndroid Build Coastguard Worker StencilMaskSeparateTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1312*35238bceSAndroid Build Coastguard Worker GLenum testTargetName, GLenum stencilFuncTargetFace)
1313*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1314*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1315*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1316*35238bceSAndroid Build Coastguard Worker , m_stencilFuncTargetFace(stencilFuncTargetFace)
1317*35238bceSAndroid Build Coastguard Worker {
1318*35238bceSAndroid Build Coastguard Worker }
1319*35238bceSAndroid Build Coastguard Worker
test(void)1320*35238bceSAndroid Build Coastguard Worker void test(void)
1321*35238bceSAndroid Build Coastguard Worker {
1322*35238bceSAndroid Build Coastguard Worker const int stencilBits = m_context.getRenderTarget().getStencilBits();
1323*35238bceSAndroid Build Coastguard Worker
1324*35238bceSAndroid Build Coastguard Worker m_verifier->verifyStencilMaskInitial(m_testCtx, m_testTargetName, stencilBits);
1325*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1326*35238bceSAndroid Build Coastguard Worker
1327*35238bceSAndroid Build Coastguard Worker for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
1328*35238bceSAndroid Build Coastguard Worker {
1329*35238bceSAndroid Build Coastguard Worker const int mask = 1 << stencilBit;
1330*35238bceSAndroid Build Coastguard Worker
1331*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(m_stencilFuncTargetFace, GL_ALWAYS, 0, mask);
1332*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1333*35238bceSAndroid Build Coastguard Worker
1334*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
1335*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1336*35238bceSAndroid Build Coastguard Worker }
1337*35238bceSAndroid Build Coastguard Worker }
1338*35238bceSAndroid Build Coastguard Worker
1339*35238bceSAndroid Build Coastguard Worker private:
1340*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1341*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1342*35238bceSAndroid Build Coastguard Worker GLenum m_stencilFuncTargetFace;
1343*35238bceSAndroid Build Coastguard Worker };
1344*35238bceSAndroid Build Coastguard Worker
1345*35238bceSAndroid Build Coastguard Worker class StencilWriteMaskTestCase : public ApiCase
1346*35238bceSAndroid Build Coastguard Worker {
1347*35238bceSAndroid Build Coastguard Worker public:
StencilWriteMaskTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName)1348*35238bceSAndroid Build Coastguard Worker StencilWriteMaskTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1349*35238bceSAndroid Build Coastguard Worker GLenum testTargetName)
1350*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1351*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1352*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1353*35238bceSAndroid Build Coastguard Worker {
1354*35238bceSAndroid Build Coastguard Worker }
1355*35238bceSAndroid Build Coastguard Worker
test(void)1356*35238bceSAndroid Build Coastguard Worker void test(void)
1357*35238bceSAndroid Build Coastguard Worker {
1358*35238bceSAndroid Build Coastguard Worker const int stencilBits = m_context.getRenderTarget().getStencilBits();
1359*35238bceSAndroid Build Coastguard Worker
1360*35238bceSAndroid Build Coastguard Worker for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
1361*35238bceSAndroid Build Coastguard Worker {
1362*35238bceSAndroid Build Coastguard Worker const int mask = 1 << stencilBit;
1363*35238bceSAndroid Build Coastguard Worker
1364*35238bceSAndroid Build Coastguard Worker glStencilMask(mask);
1365*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1366*35238bceSAndroid Build Coastguard Worker
1367*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
1368*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1369*35238bceSAndroid Build Coastguard Worker }
1370*35238bceSAndroid Build Coastguard Worker }
1371*35238bceSAndroid Build Coastguard Worker
1372*35238bceSAndroid Build Coastguard Worker private:
1373*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1374*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1375*35238bceSAndroid Build Coastguard Worker };
1376*35238bceSAndroid Build Coastguard Worker
1377*35238bceSAndroid Build Coastguard Worker class StencilWriteMaskSeparateTestCase : public ApiCase
1378*35238bceSAndroid Build Coastguard Worker {
1379*35238bceSAndroid Build Coastguard Worker public:
StencilWriteMaskSeparateTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,GLenum stencilTargetFace)1380*35238bceSAndroid Build Coastguard Worker StencilWriteMaskSeparateTestCase(Context &context, StateVerifier *verifier, const char *name,
1381*35238bceSAndroid Build Coastguard Worker const char *description, GLenum testTargetName, GLenum stencilTargetFace)
1382*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1383*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1384*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1385*35238bceSAndroid Build Coastguard Worker , m_stencilTargetFace(stencilTargetFace)
1386*35238bceSAndroid Build Coastguard Worker {
1387*35238bceSAndroid Build Coastguard Worker }
1388*35238bceSAndroid Build Coastguard Worker
test(void)1389*35238bceSAndroid Build Coastguard Worker void test(void)
1390*35238bceSAndroid Build Coastguard Worker {
1391*35238bceSAndroid Build Coastguard Worker const int stencilBits = m_context.getRenderTarget().getStencilBits();
1392*35238bceSAndroid Build Coastguard Worker
1393*35238bceSAndroid Build Coastguard Worker for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
1394*35238bceSAndroid Build Coastguard Worker {
1395*35238bceSAndroid Build Coastguard Worker const int mask = 1 << stencilBit;
1396*35238bceSAndroid Build Coastguard Worker
1397*35238bceSAndroid Build Coastguard Worker glStencilMaskSeparate(m_stencilTargetFace, mask);
1398*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1399*35238bceSAndroid Build Coastguard Worker
1400*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
1401*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1402*35238bceSAndroid Build Coastguard Worker }
1403*35238bceSAndroid Build Coastguard Worker }
1404*35238bceSAndroid Build Coastguard Worker
1405*35238bceSAndroid Build Coastguard Worker private:
1406*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1407*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1408*35238bceSAndroid Build Coastguard Worker GLenum m_stencilTargetFace;
1409*35238bceSAndroid Build Coastguard Worker };
1410*35238bceSAndroid Build Coastguard Worker
1411*35238bceSAndroid Build Coastguard Worker class PixelStoreAlignTestCase : public ApiCase
1412*35238bceSAndroid Build Coastguard Worker {
1413*35238bceSAndroid Build Coastguard Worker public:
PixelStoreAlignTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName)1414*35238bceSAndroid Build Coastguard Worker PixelStoreAlignTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1415*35238bceSAndroid Build Coastguard Worker GLenum testTargetName)
1416*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1417*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1418*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1419*35238bceSAndroid Build Coastguard Worker {
1420*35238bceSAndroid Build Coastguard Worker }
1421*35238bceSAndroid Build Coastguard Worker
test(void)1422*35238bceSAndroid Build Coastguard Worker void test(void)
1423*35238bceSAndroid Build Coastguard Worker {
1424*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, 4);
1425*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1426*35238bceSAndroid Build Coastguard Worker
1427*35238bceSAndroid Build Coastguard Worker const int alignments[] = {1, 2, 4, 8};
1428*35238bceSAndroid Build Coastguard Worker
1429*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(alignments); ++ndx)
1430*35238bceSAndroid Build Coastguard Worker {
1431*35238bceSAndroid Build Coastguard Worker const int referenceValue = alignments[ndx];
1432*35238bceSAndroid Build Coastguard Worker
1433*35238bceSAndroid Build Coastguard Worker glPixelStorei(m_testTargetName, referenceValue);
1434*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1435*35238bceSAndroid Build Coastguard Worker
1436*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, referenceValue);
1437*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1438*35238bceSAndroid Build Coastguard Worker }
1439*35238bceSAndroid Build Coastguard Worker }
1440*35238bceSAndroid Build Coastguard Worker
1441*35238bceSAndroid Build Coastguard Worker private:
1442*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1443*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1444*35238bceSAndroid Build Coastguard Worker };
1445*35238bceSAndroid Build Coastguard Worker
1446*35238bceSAndroid Build Coastguard Worker class BlendFuncTestCase : public ApiCase
1447*35238bceSAndroid Build Coastguard Worker {
1448*35238bceSAndroid Build Coastguard Worker public:
BlendFuncTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,int initialValue)1449*35238bceSAndroid Build Coastguard Worker BlendFuncTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1450*35238bceSAndroid Build Coastguard Worker GLenum testTargetName, int initialValue)
1451*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1452*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1453*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1454*35238bceSAndroid Build Coastguard Worker , m_initialValue(initialValue)
1455*35238bceSAndroid Build Coastguard Worker {
1456*35238bceSAndroid Build Coastguard Worker }
1457*35238bceSAndroid Build Coastguard Worker
test(void)1458*35238bceSAndroid Build Coastguard Worker void test(void)
1459*35238bceSAndroid Build Coastguard Worker {
1460*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, m_initialValue);
1461*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1462*35238bceSAndroid Build Coastguard Worker
1463*35238bceSAndroid Build Coastguard Worker const GLenum blendFuncValues[] = {GL_ZERO,
1464*35238bceSAndroid Build Coastguard Worker GL_ONE,
1465*35238bceSAndroid Build Coastguard Worker GL_SRC_COLOR,
1466*35238bceSAndroid Build Coastguard Worker GL_ONE_MINUS_SRC_COLOR,
1467*35238bceSAndroid Build Coastguard Worker GL_DST_COLOR,
1468*35238bceSAndroid Build Coastguard Worker GL_ONE_MINUS_DST_COLOR,
1469*35238bceSAndroid Build Coastguard Worker GL_SRC_ALPHA,
1470*35238bceSAndroid Build Coastguard Worker GL_ONE_MINUS_SRC_ALPHA,
1471*35238bceSAndroid Build Coastguard Worker GL_DST_ALPHA,
1472*35238bceSAndroid Build Coastguard Worker GL_ONE_MINUS_DST_ALPHA,
1473*35238bceSAndroid Build Coastguard Worker GL_CONSTANT_COLOR,
1474*35238bceSAndroid Build Coastguard Worker GL_ONE_MINUS_CONSTANT_COLOR,
1475*35238bceSAndroid Build Coastguard Worker GL_CONSTANT_ALPHA,
1476*35238bceSAndroid Build Coastguard Worker GL_ONE_MINUS_CONSTANT_ALPHA,
1477*35238bceSAndroid Build Coastguard Worker GL_SRC_ALPHA_SATURATE};
1478*35238bceSAndroid Build Coastguard Worker
1479*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(blendFuncValues); ++ndx)
1480*35238bceSAndroid Build Coastguard Worker {
1481*35238bceSAndroid Build Coastguard Worker const GLenum referenceValue = blendFuncValues[ndx];
1482*35238bceSAndroid Build Coastguard Worker
1483*35238bceSAndroid Build Coastguard Worker //GL_SRC_ALPHA_SATURATE is ony allowed for srcRGB or srcA
1484*35238bceSAndroid Build Coastguard Worker if (referenceValue == GL_SRC_ALPHA_SATURATE &&
1485*35238bceSAndroid Build Coastguard Worker !(m_testTargetName == GL_BLEND_SRC_RGB || m_testTargetName == GL_BLEND_SRC_ALPHA))
1486*35238bceSAndroid Build Coastguard Worker continue;
1487*35238bceSAndroid Build Coastguard Worker
1488*35238bceSAndroid Build Coastguard Worker SetBlendFunc(referenceValue);
1489*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1490*35238bceSAndroid Build Coastguard Worker
1491*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, referenceValue);
1492*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1493*35238bceSAndroid Build Coastguard Worker }
1494*35238bceSAndroid Build Coastguard Worker }
1495*35238bceSAndroid Build Coastguard Worker
1496*35238bceSAndroid Build Coastguard Worker protected:
SetBlendFunc(GLenum func)1497*35238bceSAndroid Build Coastguard Worker virtual void SetBlendFunc(GLenum func)
1498*35238bceSAndroid Build Coastguard Worker {
1499*35238bceSAndroid Build Coastguard Worker switch (m_testTargetName)
1500*35238bceSAndroid Build Coastguard Worker {
1501*35238bceSAndroid Build Coastguard Worker case GL_BLEND_SRC_RGB:
1502*35238bceSAndroid Build Coastguard Worker case GL_BLEND_SRC_ALPHA:
1503*35238bceSAndroid Build Coastguard Worker glBlendFunc(func, GL_ZERO);
1504*35238bceSAndroid Build Coastguard Worker break;
1505*35238bceSAndroid Build Coastguard Worker
1506*35238bceSAndroid Build Coastguard Worker case GL_BLEND_DST_RGB:
1507*35238bceSAndroid Build Coastguard Worker case GL_BLEND_DST_ALPHA:
1508*35238bceSAndroid Build Coastguard Worker glBlendFunc(GL_ZERO, func);
1509*35238bceSAndroid Build Coastguard Worker break;
1510*35238bceSAndroid Build Coastguard Worker
1511*35238bceSAndroid Build Coastguard Worker default:
1512*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false && "should not happen");
1513*35238bceSAndroid Build Coastguard Worker break;
1514*35238bceSAndroid Build Coastguard Worker }
1515*35238bceSAndroid Build Coastguard Worker }
1516*35238bceSAndroid Build Coastguard Worker
1517*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1518*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1519*35238bceSAndroid Build Coastguard Worker int m_initialValue;
1520*35238bceSAndroid Build Coastguard Worker };
1521*35238bceSAndroid Build Coastguard Worker
1522*35238bceSAndroid Build Coastguard Worker class BlendFuncSeparateTestCase : public BlendFuncTestCase
1523*35238bceSAndroid Build Coastguard Worker {
1524*35238bceSAndroid Build Coastguard Worker public:
BlendFuncSeparateTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,int initialValue)1525*35238bceSAndroid Build Coastguard Worker BlendFuncSeparateTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1526*35238bceSAndroid Build Coastguard Worker GLenum testTargetName, int initialValue)
1527*35238bceSAndroid Build Coastguard Worker : BlendFuncTestCase(context, verifier, name, description, testTargetName, initialValue)
1528*35238bceSAndroid Build Coastguard Worker {
1529*35238bceSAndroid Build Coastguard Worker }
1530*35238bceSAndroid Build Coastguard Worker
SetBlendFunc(GLenum func)1531*35238bceSAndroid Build Coastguard Worker void SetBlendFunc(GLenum func)
1532*35238bceSAndroid Build Coastguard Worker {
1533*35238bceSAndroid Build Coastguard Worker switch (m_testTargetName)
1534*35238bceSAndroid Build Coastguard Worker {
1535*35238bceSAndroid Build Coastguard Worker case GL_BLEND_SRC_RGB:
1536*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(func, GL_ZERO, GL_ZERO, GL_ZERO);
1537*35238bceSAndroid Build Coastguard Worker break;
1538*35238bceSAndroid Build Coastguard Worker
1539*35238bceSAndroid Build Coastguard Worker case GL_BLEND_DST_RGB:
1540*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, func, GL_ZERO, GL_ZERO);
1541*35238bceSAndroid Build Coastguard Worker break;
1542*35238bceSAndroid Build Coastguard Worker
1543*35238bceSAndroid Build Coastguard Worker case GL_BLEND_SRC_ALPHA:
1544*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, GL_ZERO, func, GL_ZERO);
1545*35238bceSAndroid Build Coastguard Worker break;
1546*35238bceSAndroid Build Coastguard Worker
1547*35238bceSAndroid Build Coastguard Worker case GL_BLEND_DST_ALPHA:
1548*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, GL_ZERO, GL_ZERO, func);
1549*35238bceSAndroid Build Coastguard Worker break;
1550*35238bceSAndroid Build Coastguard Worker
1551*35238bceSAndroid Build Coastguard Worker default:
1552*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false && "should not happen");
1553*35238bceSAndroid Build Coastguard Worker break;
1554*35238bceSAndroid Build Coastguard Worker }
1555*35238bceSAndroid Build Coastguard Worker }
1556*35238bceSAndroid Build Coastguard Worker };
1557*35238bceSAndroid Build Coastguard Worker
1558*35238bceSAndroid Build Coastguard Worker class BlendEquationTestCase : public ApiCase
1559*35238bceSAndroid Build Coastguard Worker {
1560*35238bceSAndroid Build Coastguard Worker public:
BlendEquationTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,int initialValue)1561*35238bceSAndroid Build Coastguard Worker BlendEquationTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1562*35238bceSAndroid Build Coastguard Worker GLenum testTargetName, int initialValue)
1563*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1564*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1565*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1566*35238bceSAndroid Build Coastguard Worker , m_initialValue(initialValue)
1567*35238bceSAndroid Build Coastguard Worker {
1568*35238bceSAndroid Build Coastguard Worker }
1569*35238bceSAndroid Build Coastguard Worker
test(void)1570*35238bceSAndroid Build Coastguard Worker void test(void)
1571*35238bceSAndroid Build Coastguard Worker {
1572*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, m_initialValue);
1573*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1574*35238bceSAndroid Build Coastguard Worker
1575*35238bceSAndroid Build Coastguard Worker const GLenum blendFuncValues[] = {GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT};
1576*35238bceSAndroid Build Coastguard Worker
1577*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(blendFuncValues); ++ndx)
1578*35238bceSAndroid Build Coastguard Worker {
1579*35238bceSAndroid Build Coastguard Worker const GLenum referenceValue = blendFuncValues[ndx];
1580*35238bceSAndroid Build Coastguard Worker
1581*35238bceSAndroid Build Coastguard Worker SetBlendEquation(referenceValue);
1582*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1583*35238bceSAndroid Build Coastguard Worker
1584*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, m_testTargetName, referenceValue);
1585*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1586*35238bceSAndroid Build Coastguard Worker }
1587*35238bceSAndroid Build Coastguard Worker }
1588*35238bceSAndroid Build Coastguard Worker
1589*35238bceSAndroid Build Coastguard Worker protected:
SetBlendEquation(GLenum equation)1590*35238bceSAndroid Build Coastguard Worker virtual void SetBlendEquation(GLenum equation)
1591*35238bceSAndroid Build Coastguard Worker {
1592*35238bceSAndroid Build Coastguard Worker glBlendEquation(equation);
1593*35238bceSAndroid Build Coastguard Worker }
1594*35238bceSAndroid Build Coastguard Worker
1595*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1596*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1597*35238bceSAndroid Build Coastguard Worker int m_initialValue;
1598*35238bceSAndroid Build Coastguard Worker };
1599*35238bceSAndroid Build Coastguard Worker
1600*35238bceSAndroid Build Coastguard Worker class BlendEquationSeparateTestCase : public BlendEquationTestCase
1601*35238bceSAndroid Build Coastguard Worker {
1602*35238bceSAndroid Build Coastguard Worker public:
BlendEquationSeparateTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,int initialValue)1603*35238bceSAndroid Build Coastguard Worker BlendEquationSeparateTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1604*35238bceSAndroid Build Coastguard Worker GLenum testTargetName, int initialValue)
1605*35238bceSAndroid Build Coastguard Worker : BlendEquationTestCase(context, verifier, name, description, testTargetName, initialValue)
1606*35238bceSAndroid Build Coastguard Worker {
1607*35238bceSAndroid Build Coastguard Worker }
1608*35238bceSAndroid Build Coastguard Worker
1609*35238bceSAndroid Build Coastguard Worker protected:
SetBlendEquation(GLenum equation)1610*35238bceSAndroid Build Coastguard Worker void SetBlendEquation(GLenum equation)
1611*35238bceSAndroid Build Coastguard Worker {
1612*35238bceSAndroid Build Coastguard Worker switch (m_testTargetName)
1613*35238bceSAndroid Build Coastguard Worker {
1614*35238bceSAndroid Build Coastguard Worker case GL_BLEND_EQUATION_RGB:
1615*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparate(equation, GL_FUNC_ADD);
1616*35238bceSAndroid Build Coastguard Worker break;
1617*35238bceSAndroid Build Coastguard Worker
1618*35238bceSAndroid Build Coastguard Worker case GL_BLEND_EQUATION_ALPHA:
1619*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparate(GL_FUNC_ADD, equation);
1620*35238bceSAndroid Build Coastguard Worker break;
1621*35238bceSAndroid Build Coastguard Worker
1622*35238bceSAndroid Build Coastguard Worker default:
1623*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false && "should not happen");
1624*35238bceSAndroid Build Coastguard Worker break;
1625*35238bceSAndroid Build Coastguard Worker }
1626*35238bceSAndroid Build Coastguard Worker }
1627*35238bceSAndroid Build Coastguard Worker };
1628*35238bceSAndroid Build Coastguard Worker
1629*35238bceSAndroid Build Coastguard Worker class ImplementationArrayTestCase : public ApiCase
1630*35238bceSAndroid Build Coastguard Worker {
1631*35238bceSAndroid Build Coastguard Worker public:
ImplementationArrayTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description,GLenum testTargetName,GLenum testTargetLengthTargetName,int minValue)1632*35238bceSAndroid Build Coastguard Worker ImplementationArrayTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description,
1633*35238bceSAndroid Build Coastguard Worker GLenum testTargetName, GLenum testTargetLengthTargetName, int minValue)
1634*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1635*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1636*35238bceSAndroid Build Coastguard Worker , m_testTargetName(testTargetName)
1637*35238bceSAndroid Build Coastguard Worker , m_testTargetLengthTargetName(testTargetLengthTargetName)
1638*35238bceSAndroid Build Coastguard Worker , m_minValue(minValue)
1639*35238bceSAndroid Build Coastguard Worker {
1640*35238bceSAndroid Build Coastguard Worker }
1641*35238bceSAndroid Build Coastguard Worker
test(void)1642*35238bceSAndroid Build Coastguard Worker void test(void)
1643*35238bceSAndroid Build Coastguard Worker {
1644*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, m_testTargetLengthTargetName, m_minValue);
1645*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1646*35238bceSAndroid Build Coastguard Worker
1647*35238bceSAndroid Build Coastguard Worker GLint targetArrayLength = 0;
1648*35238bceSAndroid Build Coastguard Worker glGetIntegerv(m_testTargetLengthTargetName, &targetArrayLength);
1649*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1650*35238bceSAndroid Build Coastguard Worker
1651*35238bceSAndroid Build Coastguard Worker if (targetArrayLength)
1652*35238bceSAndroid Build Coastguard Worker {
1653*35238bceSAndroid Build Coastguard Worker std::vector<GLint> queryResult;
1654*35238bceSAndroid Build Coastguard Worker queryResult.resize(targetArrayLength, 0);
1655*35238bceSAndroid Build Coastguard Worker
1656*35238bceSAndroid Build Coastguard Worker glGetIntegerv(m_testTargetName, &queryResult[0]);
1657*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1658*35238bceSAndroid Build Coastguard Worker }
1659*35238bceSAndroid Build Coastguard Worker }
1660*35238bceSAndroid Build Coastguard Worker
1661*35238bceSAndroid Build Coastguard Worker private:
1662*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1663*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetName;
1664*35238bceSAndroid Build Coastguard Worker GLenum m_testTargetLengthTargetName;
1665*35238bceSAndroid Build Coastguard Worker int m_minValue;
1666*35238bceSAndroid Build Coastguard Worker };
1667*35238bceSAndroid Build Coastguard Worker
1668*35238bceSAndroid Build Coastguard Worker class BindingTest : public TestCase
1669*35238bceSAndroid Build Coastguard Worker {
1670*35238bceSAndroid Build Coastguard Worker public:
1671*35238bceSAndroid Build Coastguard Worker BindingTest(Context &context, const char *name, const char *desc, QueryType type);
1672*35238bceSAndroid Build Coastguard Worker
1673*35238bceSAndroid Build Coastguard Worker IterateResult iterate(void);
1674*35238bceSAndroid Build Coastguard Worker
1675*35238bceSAndroid Build Coastguard Worker virtual void test(glu::CallLogWrapper &gl, tcu::ResultCollector &result) const = 0;
1676*35238bceSAndroid Build Coastguard Worker
1677*35238bceSAndroid Build Coastguard Worker protected:
1678*35238bceSAndroid Build Coastguard Worker const QueryType m_type;
1679*35238bceSAndroid Build Coastguard Worker };
1680*35238bceSAndroid Build Coastguard Worker
BindingTest(Context & context,const char * name,const char * desc,QueryType type)1681*35238bceSAndroid Build Coastguard Worker BindingTest::BindingTest(Context &context, const char *name, const char *desc, QueryType type)
1682*35238bceSAndroid Build Coastguard Worker : TestCase(context, name, desc)
1683*35238bceSAndroid Build Coastguard Worker , m_type(type)
1684*35238bceSAndroid Build Coastguard Worker {
1685*35238bceSAndroid Build Coastguard Worker }
1686*35238bceSAndroid Build Coastguard Worker
iterate(void)1687*35238bceSAndroid Build Coastguard Worker BindingTest::IterateResult BindingTest::iterate(void)
1688*35238bceSAndroid Build Coastguard Worker {
1689*35238bceSAndroid Build Coastguard Worker glu::CallLogWrapper gl(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
1690*35238bceSAndroid Build Coastguard Worker tcu::ResultCollector result(m_context.getTestContext().getLog(), " // ERROR: ");
1691*35238bceSAndroid Build Coastguard Worker
1692*35238bceSAndroid Build Coastguard Worker gl.enableLogging(true);
1693*35238bceSAndroid Build Coastguard Worker
1694*35238bceSAndroid Build Coastguard Worker test(gl, result);
1695*35238bceSAndroid Build Coastguard Worker
1696*35238bceSAndroid Build Coastguard Worker result.setTestContextResult(m_testCtx);
1697*35238bceSAndroid Build Coastguard Worker return STOP;
1698*35238bceSAndroid Build Coastguard Worker }
1699*35238bceSAndroid Build Coastguard Worker
1700*35238bceSAndroid Build Coastguard Worker class CurrentProgramBindingTestCase : public BindingTest
1701*35238bceSAndroid Build Coastguard Worker {
1702*35238bceSAndroid Build Coastguard Worker public:
CurrentProgramBindingTestCase(Context & context,QueryType type,const char * name,const char * description)1703*35238bceSAndroid Build Coastguard Worker CurrentProgramBindingTestCase(Context &context, QueryType type, const char *name, const char *description)
1704*35238bceSAndroid Build Coastguard Worker : BindingTest(context, name, description, type)
1705*35238bceSAndroid Build Coastguard Worker {
1706*35238bceSAndroid Build Coastguard Worker }
1707*35238bceSAndroid Build Coastguard Worker
test(glu::CallLogWrapper & gl,tcu::ResultCollector & result) const1708*35238bceSAndroid Build Coastguard Worker void test(glu::CallLogWrapper &gl, tcu::ResultCollector &result) const
1709*35238bceSAndroid Build Coastguard Worker {
1710*35238bceSAndroid Build Coastguard Worker static const char *testVertSource = "void main (void)\n"
1711*35238bceSAndroid Build Coastguard Worker "{\n"
1712*35238bceSAndroid Build Coastguard Worker " gl_Position = vec4(0.0);\n"
1713*35238bceSAndroid Build Coastguard Worker "}\n";
1714*35238bceSAndroid Build Coastguard Worker static const char *testFragSource = "void main (void)\n"
1715*35238bceSAndroid Build Coastguard Worker "{\n"
1716*35238bceSAndroid Build Coastguard Worker " gl_FragColor = vec4(0.0);\n"
1717*35238bceSAndroid Build Coastguard Worker "}\n";
1718*35238bceSAndroid Build Coastguard Worker
1719*35238bceSAndroid Build Coastguard Worker GLuint shaderVert;
1720*35238bceSAndroid Build Coastguard Worker GLuint shaderFrag;
1721*35238bceSAndroid Build Coastguard Worker GLuint shaderProg;
1722*35238bceSAndroid Build Coastguard Worker GLint compileStatus;
1723*35238bceSAndroid Build Coastguard Worker GLint linkStatus;
1724*35238bceSAndroid Build Coastguard Worker
1725*35238bceSAndroid Build Coastguard Worker {
1726*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(gl.getLog(), "Initial", "Initial");
1727*35238bceSAndroid Build Coastguard Worker
1728*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_CURRENT_PROGRAM, 0, m_type);
1729*35238bceSAndroid Build Coastguard Worker }
1730*35238bceSAndroid Build Coastguard Worker {
1731*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(gl.getLog(), "VertexShader", "Vertex Shader");
1732*35238bceSAndroid Build Coastguard Worker
1733*35238bceSAndroid Build Coastguard Worker shaderVert = gl.glCreateShader(GL_VERTEX_SHADER);
1734*35238bceSAndroid Build Coastguard Worker gl.glShaderSource(shaderVert, 1, &testVertSource, DE_NULL);
1735*35238bceSAndroid Build Coastguard Worker gl.glCompileShader(shaderVert);
1736*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glCompileShader");
1737*35238bceSAndroid Build Coastguard Worker
1738*35238bceSAndroid Build Coastguard Worker gl.glGetShaderiv(shaderVert, GL_COMPILE_STATUS, &compileStatus);
1739*35238bceSAndroid Build Coastguard Worker if (compileStatus != GL_TRUE)
1740*35238bceSAndroid Build Coastguard Worker result.fail("expected GL_TRUE");
1741*35238bceSAndroid Build Coastguard Worker }
1742*35238bceSAndroid Build Coastguard Worker {
1743*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(gl.getLog(), "FragmentShader", "Fragment Shader");
1744*35238bceSAndroid Build Coastguard Worker
1745*35238bceSAndroid Build Coastguard Worker shaderFrag = gl.glCreateShader(GL_FRAGMENT_SHADER);
1746*35238bceSAndroid Build Coastguard Worker gl.glShaderSource(shaderFrag, 1, &testFragSource, DE_NULL);
1747*35238bceSAndroid Build Coastguard Worker gl.glCompileShader(shaderFrag);
1748*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glCompileShader");
1749*35238bceSAndroid Build Coastguard Worker
1750*35238bceSAndroid Build Coastguard Worker gl.glGetShaderiv(shaderFrag, GL_COMPILE_STATUS, &compileStatus);
1751*35238bceSAndroid Build Coastguard Worker if (compileStatus != GL_TRUE)
1752*35238bceSAndroid Build Coastguard Worker result.fail("expected GL_TRUE");
1753*35238bceSAndroid Build Coastguard Worker }
1754*35238bceSAndroid Build Coastguard Worker {
1755*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(gl.getLog(), "Program", "Create and bind program");
1756*35238bceSAndroid Build Coastguard Worker
1757*35238bceSAndroid Build Coastguard Worker shaderProg = gl.glCreateProgram();
1758*35238bceSAndroid Build Coastguard Worker gl.glAttachShader(shaderProg, shaderVert);
1759*35238bceSAndroid Build Coastguard Worker gl.glAttachShader(shaderProg, shaderFrag);
1760*35238bceSAndroid Build Coastguard Worker gl.glLinkProgram(shaderProg);
1761*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glLinkProgram");
1762*35238bceSAndroid Build Coastguard Worker
1763*35238bceSAndroid Build Coastguard Worker gl.glGetProgramiv(shaderProg, GL_LINK_STATUS, &linkStatus);
1764*35238bceSAndroid Build Coastguard Worker if (linkStatus != GL_TRUE)
1765*35238bceSAndroid Build Coastguard Worker result.fail("expected GL_TRUE");
1766*35238bceSAndroid Build Coastguard Worker
1767*35238bceSAndroid Build Coastguard Worker gl.glUseProgram(shaderProg);
1768*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glUseProgram");
1769*35238bceSAndroid Build Coastguard Worker
1770*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_CURRENT_PROGRAM, shaderProg, m_type);
1771*35238bceSAndroid Build Coastguard Worker }
1772*35238bceSAndroid Build Coastguard Worker {
1773*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(gl.getLog(), "Delete", "Delete program while in use");
1774*35238bceSAndroid Build Coastguard Worker
1775*35238bceSAndroid Build Coastguard Worker gl.glDeleteShader(shaderVert);
1776*35238bceSAndroid Build Coastguard Worker gl.glDeleteShader(shaderFrag);
1777*35238bceSAndroid Build Coastguard Worker gl.glDeleteProgram(shaderProg);
1778*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteProgram");
1779*35238bceSAndroid Build Coastguard Worker
1780*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_CURRENT_PROGRAM, shaderProg, m_type);
1781*35238bceSAndroid Build Coastguard Worker }
1782*35238bceSAndroid Build Coastguard Worker {
1783*35238bceSAndroid Build Coastguard Worker const tcu::ScopedLogSection section(gl.getLog(), "Unbind", "Unbind program");
1784*35238bceSAndroid Build Coastguard Worker gl.glUseProgram(0);
1785*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glUseProgram");
1786*35238bceSAndroid Build Coastguard Worker
1787*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_CURRENT_PROGRAM, 0, m_type);
1788*35238bceSAndroid Build Coastguard Worker }
1789*35238bceSAndroid Build Coastguard Worker }
1790*35238bceSAndroid Build Coastguard Worker };
1791*35238bceSAndroid Build Coastguard Worker
1792*35238bceSAndroid Build Coastguard Worker class BufferBindingTestCase : public BindingTest
1793*35238bceSAndroid Build Coastguard Worker {
1794*35238bceSAndroid Build Coastguard Worker public:
BufferBindingTestCase(Context & context,QueryType type,const char * name,const char * description,GLenum bufferBindingName,GLenum bufferType)1795*35238bceSAndroid Build Coastguard Worker BufferBindingTestCase(Context &context, QueryType type, const char *name, const char *description,
1796*35238bceSAndroid Build Coastguard Worker GLenum bufferBindingName, GLenum bufferType)
1797*35238bceSAndroid Build Coastguard Worker : BindingTest(context, name, description, type)
1798*35238bceSAndroid Build Coastguard Worker , m_bufferBindingName(bufferBindingName)
1799*35238bceSAndroid Build Coastguard Worker , m_bufferType(bufferType)
1800*35238bceSAndroid Build Coastguard Worker {
1801*35238bceSAndroid Build Coastguard Worker }
1802*35238bceSAndroid Build Coastguard Worker
test(glu::CallLogWrapper & gl,tcu::ResultCollector & result) const1803*35238bceSAndroid Build Coastguard Worker void test(glu::CallLogWrapper &gl, tcu::ResultCollector &result) const
1804*35238bceSAndroid Build Coastguard Worker {
1805*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, m_bufferBindingName, 0, m_type);
1806*35238bceSAndroid Build Coastguard Worker
1807*35238bceSAndroid Build Coastguard Worker GLuint bufferObject = 0;
1808*35238bceSAndroid Build Coastguard Worker gl.glGenBuffers(1, &bufferObject);
1809*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGenBuffers");
1810*35238bceSAndroid Build Coastguard Worker
1811*35238bceSAndroid Build Coastguard Worker gl.glBindBuffer(m_bufferType, bufferObject);
1812*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, m_bufferBindingName, bufferObject, m_type);
1813*35238bceSAndroid Build Coastguard Worker
1814*35238bceSAndroid Build Coastguard Worker gl.glDeleteBuffers(1, &bufferObject);
1815*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteBuffers");
1816*35238bceSAndroid Build Coastguard Worker
1817*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, m_bufferBindingName, 0, m_type);
1818*35238bceSAndroid Build Coastguard Worker }
1819*35238bceSAndroid Build Coastguard Worker
1820*35238bceSAndroid Build Coastguard Worker private:
1821*35238bceSAndroid Build Coastguard Worker const GLenum m_bufferBindingName;
1822*35238bceSAndroid Build Coastguard Worker const GLenum m_bufferType;
1823*35238bceSAndroid Build Coastguard Worker };
1824*35238bceSAndroid Build Coastguard Worker
1825*35238bceSAndroid Build Coastguard Worker class StencilClearValueTestCase : public ApiCase
1826*35238bceSAndroid Build Coastguard Worker {
1827*35238bceSAndroid Build Coastguard Worker public:
StencilClearValueTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1828*35238bceSAndroid Build Coastguard Worker StencilClearValueTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1829*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1830*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1831*35238bceSAndroid Build Coastguard Worker {
1832*35238bceSAndroid Build Coastguard Worker }
1833*35238bceSAndroid Build Coastguard Worker
test(void)1834*35238bceSAndroid Build Coastguard Worker void test(void)
1835*35238bceSAndroid Build Coastguard Worker {
1836*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_STENCIL_CLEAR_VALUE, 0);
1837*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1838*35238bceSAndroid Build Coastguard Worker
1839*35238bceSAndroid Build Coastguard Worker const int stencilBits = m_context.getRenderTarget().getStencilBits();
1840*35238bceSAndroid Build Coastguard Worker
1841*35238bceSAndroid Build Coastguard Worker for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
1842*35238bceSAndroid Build Coastguard Worker {
1843*35238bceSAndroid Build Coastguard Worker const int ref = 1 << stencilBit;
1844*35238bceSAndroid Build Coastguard Worker
1845*35238bceSAndroid Build Coastguard Worker glClearStencil(ref);
1846*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1847*35238bceSAndroid Build Coastguard Worker
1848*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_STENCIL_CLEAR_VALUE, ref);
1849*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1850*35238bceSAndroid Build Coastguard Worker }
1851*35238bceSAndroid Build Coastguard Worker }
1852*35238bceSAndroid Build Coastguard Worker
1853*35238bceSAndroid Build Coastguard Worker private:
1854*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1855*35238bceSAndroid Build Coastguard Worker };
1856*35238bceSAndroid Build Coastguard Worker
1857*35238bceSAndroid Build Coastguard Worker class ActiveTextureTestCase : public ApiCase
1858*35238bceSAndroid Build Coastguard Worker {
1859*35238bceSAndroid Build Coastguard Worker public:
ActiveTextureTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1860*35238bceSAndroid Build Coastguard Worker ActiveTextureTestCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
1861*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1862*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1863*35238bceSAndroid Build Coastguard Worker {
1864*35238bceSAndroid Build Coastguard Worker }
1865*35238bceSAndroid Build Coastguard Worker
test(void)1866*35238bceSAndroid Build Coastguard Worker void test(void)
1867*35238bceSAndroid Build Coastguard Worker {
1868*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_ACTIVE_TEXTURE, GL_TEXTURE0);
1869*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1870*35238bceSAndroid Build Coastguard Worker
1871*35238bceSAndroid Build Coastguard Worker GLint textureUnits = 0;
1872*35238bceSAndroid Build Coastguard Worker glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &textureUnits);
1873*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1874*35238bceSAndroid Build Coastguard Worker
1875*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < textureUnits; ++ndx)
1876*35238bceSAndroid Build Coastguard Worker {
1877*35238bceSAndroid Build Coastguard Worker glActiveTexture(GL_TEXTURE0 + ndx);
1878*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1879*35238bceSAndroid Build Coastguard Worker
1880*35238bceSAndroid Build Coastguard Worker m_verifier->verifyInteger(m_testCtx, GL_ACTIVE_TEXTURE, GL_TEXTURE0 + ndx);
1881*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
1882*35238bceSAndroid Build Coastguard Worker }
1883*35238bceSAndroid Build Coastguard Worker }
1884*35238bceSAndroid Build Coastguard Worker
1885*35238bceSAndroid Build Coastguard Worker private:
1886*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
1887*35238bceSAndroid Build Coastguard Worker };
1888*35238bceSAndroid Build Coastguard Worker
1889*35238bceSAndroid Build Coastguard Worker class RenderbufferBindingTestCase : public BindingTest
1890*35238bceSAndroid Build Coastguard Worker {
1891*35238bceSAndroid Build Coastguard Worker public:
RenderbufferBindingTestCase(Context & context,QueryType type,const char * name,const char * description)1892*35238bceSAndroid Build Coastguard Worker RenderbufferBindingTestCase(Context &context, QueryType type, const char *name, const char *description)
1893*35238bceSAndroid Build Coastguard Worker : BindingTest(context, name, description, type)
1894*35238bceSAndroid Build Coastguard Worker {
1895*35238bceSAndroid Build Coastguard Worker }
1896*35238bceSAndroid Build Coastguard Worker
test(glu::CallLogWrapper & gl,tcu::ResultCollector & result) const1897*35238bceSAndroid Build Coastguard Worker void test(glu::CallLogWrapper &gl, tcu::ResultCollector &result) const
1898*35238bceSAndroid Build Coastguard Worker {
1899*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_RENDERBUFFER_BINDING, 0, m_type);
1900*35238bceSAndroid Build Coastguard Worker
1901*35238bceSAndroid Build Coastguard Worker GLuint renderBuffer = 0;
1902*35238bceSAndroid Build Coastguard Worker gl.glGenRenderbuffers(1, &renderBuffer);
1903*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGenRenderbuffers");
1904*35238bceSAndroid Build Coastguard Worker
1905*35238bceSAndroid Build Coastguard Worker gl.glBindRenderbuffer(GL_RENDERBUFFER, renderBuffer);
1906*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindRenderbuffer");
1907*35238bceSAndroid Build Coastguard Worker
1908*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_RENDERBUFFER_BINDING, renderBuffer, m_type);
1909*35238bceSAndroid Build Coastguard Worker
1910*35238bceSAndroid Build Coastguard Worker gl.glDeleteRenderbuffers(1, &renderBuffer);
1911*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteRenderbuffers");
1912*35238bceSAndroid Build Coastguard Worker
1913*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_RENDERBUFFER_BINDING, 0, m_type);
1914*35238bceSAndroid Build Coastguard Worker }
1915*35238bceSAndroid Build Coastguard Worker };
1916*35238bceSAndroid Build Coastguard Worker
1917*35238bceSAndroid Build Coastguard Worker class TextureBindingTestCase : public BindingTest
1918*35238bceSAndroid Build Coastguard Worker {
1919*35238bceSAndroid Build Coastguard Worker public:
TextureBindingTestCase(Context & context,QueryType type,const char * name,const char * description,GLenum testBindingName,GLenum textureType)1920*35238bceSAndroid Build Coastguard Worker TextureBindingTestCase(Context &context, QueryType type, const char *name, const char *description,
1921*35238bceSAndroid Build Coastguard Worker GLenum testBindingName, GLenum textureType)
1922*35238bceSAndroid Build Coastguard Worker : BindingTest(context, name, description, type)
1923*35238bceSAndroid Build Coastguard Worker , m_testBindingName(testBindingName)
1924*35238bceSAndroid Build Coastguard Worker , m_textureType(textureType)
1925*35238bceSAndroid Build Coastguard Worker {
1926*35238bceSAndroid Build Coastguard Worker }
1927*35238bceSAndroid Build Coastguard Worker
test(glu::CallLogWrapper & gl,tcu::ResultCollector & result) const1928*35238bceSAndroid Build Coastguard Worker void test(glu::CallLogWrapper &gl, tcu::ResultCollector &result) const
1929*35238bceSAndroid Build Coastguard Worker {
1930*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, m_testBindingName, 0, m_type);
1931*35238bceSAndroid Build Coastguard Worker
1932*35238bceSAndroid Build Coastguard Worker GLuint texture = 0;
1933*35238bceSAndroid Build Coastguard Worker gl.glGenTextures(1, &texture);
1934*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGenTextures");
1935*35238bceSAndroid Build Coastguard Worker
1936*35238bceSAndroid Build Coastguard Worker gl.glBindTexture(m_textureType, texture);
1937*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindTexture");
1938*35238bceSAndroid Build Coastguard Worker
1939*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, m_testBindingName, texture, m_type);
1940*35238bceSAndroid Build Coastguard Worker
1941*35238bceSAndroid Build Coastguard Worker gl.glDeleteTextures(1, &texture);
1942*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteTextures");
1943*35238bceSAndroid Build Coastguard Worker
1944*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, m_testBindingName, 0, m_type);
1945*35238bceSAndroid Build Coastguard Worker }
1946*35238bceSAndroid Build Coastguard Worker
1947*35238bceSAndroid Build Coastguard Worker private:
1948*35238bceSAndroid Build Coastguard Worker const GLenum m_testBindingName;
1949*35238bceSAndroid Build Coastguard Worker const GLenum m_textureType;
1950*35238bceSAndroid Build Coastguard Worker };
1951*35238bceSAndroid Build Coastguard Worker
1952*35238bceSAndroid Build Coastguard Worker class FrameBufferBindingTestCase : public BindingTest
1953*35238bceSAndroid Build Coastguard Worker {
1954*35238bceSAndroid Build Coastguard Worker public:
FrameBufferBindingTestCase(Context & context,QueryType type,const char * name,const char * description)1955*35238bceSAndroid Build Coastguard Worker FrameBufferBindingTestCase(Context &context, QueryType type, const char *name, const char *description)
1956*35238bceSAndroid Build Coastguard Worker : BindingTest(context, name, description, type)
1957*35238bceSAndroid Build Coastguard Worker {
1958*35238bceSAndroid Build Coastguard Worker }
1959*35238bceSAndroid Build Coastguard Worker
test(glu::CallLogWrapper & gl,tcu::ResultCollector & result) const1960*35238bceSAndroid Build Coastguard Worker void test(glu::CallLogWrapper &gl, tcu::ResultCollector &result) const
1961*35238bceSAndroid Build Coastguard Worker {
1962*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_FRAMEBUFFER_BINDING, 0, m_type);
1963*35238bceSAndroid Build Coastguard Worker
1964*35238bceSAndroid Build Coastguard Worker GLuint framebufferId = 0;
1965*35238bceSAndroid Build Coastguard Worker gl.glGenFramebuffers(1, &framebufferId);
1966*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glGenFramebuffers");
1967*35238bceSAndroid Build Coastguard Worker
1968*35238bceSAndroid Build Coastguard Worker gl.glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
1969*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindFramebuffer");
1970*35238bceSAndroid Build Coastguard Worker
1971*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_FRAMEBUFFER_BINDING, framebufferId, m_type);
1972*35238bceSAndroid Build Coastguard Worker
1973*35238bceSAndroid Build Coastguard Worker gl.glBindFramebuffer(GL_FRAMEBUFFER, 0);
1974*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glBindFramebuffer");
1975*35238bceSAndroid Build Coastguard Worker
1976*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_FRAMEBUFFER_BINDING, 0, m_type);
1977*35238bceSAndroid Build Coastguard Worker
1978*35238bceSAndroid Build Coastguard Worker gl.glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
1979*35238bceSAndroid Build Coastguard Worker gl.glDeleteFramebuffers(1, &framebufferId);
1980*35238bceSAndroid Build Coastguard Worker GLS_COLLECT_GL_ERROR(result, gl.glGetError(), "glDeleteFramebuffers");
1981*35238bceSAndroid Build Coastguard Worker
1982*35238bceSAndroid Build Coastguard Worker verifyStateInteger(result, gl, GL_FRAMEBUFFER_BINDING, 0, m_type);
1983*35238bceSAndroid Build Coastguard Worker }
1984*35238bceSAndroid Build Coastguard Worker };
1985*35238bceSAndroid Build Coastguard Worker
1986*35238bceSAndroid Build Coastguard Worker class ImplementationColorReadTestCase : public ApiCase
1987*35238bceSAndroid Build Coastguard Worker {
1988*35238bceSAndroid Build Coastguard Worker public:
ImplementationColorReadTestCase(Context & context,StateVerifier * verifier,const char * name,const char * description)1989*35238bceSAndroid Build Coastguard Worker ImplementationColorReadTestCase(Context &context, StateVerifier *verifier, const char *name,
1990*35238bceSAndroid Build Coastguard Worker const char *description)
1991*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
1992*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
1993*35238bceSAndroid Build Coastguard Worker {
1994*35238bceSAndroid Build Coastguard Worker }
1995*35238bceSAndroid Build Coastguard Worker
test(void)1996*35238bceSAndroid Build Coastguard Worker void test(void)
1997*35238bceSAndroid Build Coastguard Worker {
1998*35238bceSAndroid Build Coastguard Worker const GLint defaultColorTypes[] = {GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1,
1999*35238bceSAndroid Build Coastguard Worker GL_UNSIGNED_SHORT_5_6_5};
2000*35238bceSAndroid Build Coastguard Worker const GLint defaultColorFormats[] = {GL_RGBA, GL_RGB, GL_ALPHA};
2001*35238bceSAndroid Build Coastguard Worker
2002*35238bceSAndroid Build Coastguard Worker std::vector<GLint> validColorTypes;
2003*35238bceSAndroid Build Coastguard Worker std::vector<GLint> validColorFormats;
2004*35238bceSAndroid Build Coastguard Worker
2005*35238bceSAndroid Build Coastguard Worker // Defined by the spec
2006*35238bceSAndroid Build Coastguard Worker
2007*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(defaultColorTypes); ++ndx)
2008*35238bceSAndroid Build Coastguard Worker validColorTypes.push_back(defaultColorTypes[ndx]);
2009*35238bceSAndroid Build Coastguard Worker for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(defaultColorFormats); ++ndx)
2010*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(defaultColorFormats[ndx]);
2011*35238bceSAndroid Build Coastguard Worker
2012*35238bceSAndroid Build Coastguard Worker // Extensions
2013*35238bceSAndroid Build Coastguard Worker
2014*35238bceSAndroid Build Coastguard Worker if (m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_format_BGRA8888") ||
2015*35238bceSAndroid Build Coastguard Worker m_context.getContextInfo().isExtensionSupported("GL_APPLE_texture_format_BGRA8888"))
2016*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_BGRA);
2017*35238bceSAndroid Build Coastguard Worker
2018*35238bceSAndroid Build Coastguard Worker if (m_context.getContextInfo().isExtensionSupported("GL_EXT_read_format_bgra"))
2019*35238bceSAndroid Build Coastguard Worker {
2020*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_BGRA);
2021*35238bceSAndroid Build Coastguard Worker validColorTypes.push_back(GL_UNSIGNED_SHORT_4_4_4_4_REV);
2022*35238bceSAndroid Build Coastguard Worker validColorTypes.push_back(GL_UNSIGNED_SHORT_1_5_5_5_REV);
2023*35238bceSAndroid Build Coastguard Worker }
2024*35238bceSAndroid Build Coastguard Worker
2025*35238bceSAndroid Build Coastguard Worker if (m_context.getContextInfo().isExtensionSupported("GL_IMG_read_format"))
2026*35238bceSAndroid Build Coastguard Worker {
2027*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_BGRA);
2028*35238bceSAndroid Build Coastguard Worker validColorTypes.push_back(GL_UNSIGNED_SHORT_4_4_4_4_REV);
2029*35238bceSAndroid Build Coastguard Worker }
2030*35238bceSAndroid Build Coastguard Worker
2031*35238bceSAndroid Build Coastguard Worker if (m_context.getContextInfo().isExtensionSupported("GL_NV_sRGB_formats"))
2032*35238bceSAndroid Build Coastguard Worker {
2033*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_SLUMINANCE_NV);
2034*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_SLUMINANCE_ALPHA_NV);
2035*35238bceSAndroid Build Coastguard Worker }
2036*35238bceSAndroid Build Coastguard Worker
2037*35238bceSAndroid Build Coastguard Worker if (m_context.getContextInfo().isExtensionSupported("GL_NV_bgr"))
2038*35238bceSAndroid Build Coastguard Worker {
2039*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_BGR_NV);
2040*35238bceSAndroid Build Coastguard Worker }
2041*35238bceSAndroid Build Coastguard Worker
2042*35238bceSAndroid Build Coastguard Worker if (m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_rg"))
2043*35238bceSAndroid Build Coastguard Worker {
2044*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_RED);
2045*35238bceSAndroid Build Coastguard Worker validColorFormats.push_back(GL_RG);
2046*35238bceSAndroid Build Coastguard Worker }
2047*35238bceSAndroid Build Coastguard Worker
2048*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerAnyOf(m_testCtx, GL_IMPLEMENTATION_COLOR_READ_TYPE, &validColorTypes[0],
2049*35238bceSAndroid Build Coastguard Worker validColorTypes.size());
2050*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerAnyOf(m_testCtx, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &validColorFormats[0],
2051*35238bceSAndroid Build Coastguard Worker validColorFormats.size());
2052*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
2053*35238bceSAndroid Build Coastguard Worker }
2054*35238bceSAndroid Build Coastguard Worker
2055*35238bceSAndroid Build Coastguard Worker private:
2056*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
2057*35238bceSAndroid Build Coastguard Worker };
2058*35238bceSAndroid Build Coastguard Worker
2059*35238bceSAndroid Build Coastguard Worker class BufferComponentSizeCase : public ApiCase
2060*35238bceSAndroid Build Coastguard Worker {
2061*35238bceSAndroid Build Coastguard Worker public:
BufferComponentSizeCase(Context & context,StateVerifier * verifier,const char * name,const char * description)2062*35238bceSAndroid Build Coastguard Worker BufferComponentSizeCase(Context &context, StateVerifier *verifier, const char *name, const char *description)
2063*35238bceSAndroid Build Coastguard Worker : ApiCase(context, name, description)
2064*35238bceSAndroid Build Coastguard Worker , m_verifier(verifier)
2065*35238bceSAndroid Build Coastguard Worker {
2066*35238bceSAndroid Build Coastguard Worker }
2067*35238bceSAndroid Build Coastguard Worker
test(void)2068*35238bceSAndroid Build Coastguard Worker void test(void)
2069*35238bceSAndroid Build Coastguard Worker {
2070*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_RED_BITS,
2071*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getPixelFormat().redBits);
2072*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_BLUE_BITS,
2073*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getPixelFormat().blueBits);
2074*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_GREEN_BITS,
2075*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getPixelFormat().greenBits);
2076*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_ALPHA_BITS,
2077*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getPixelFormat().alphaBits);
2078*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
2079*35238bceSAndroid Build Coastguard Worker
2080*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_DEPTH_BITS, m_context.getRenderTarget().getDepthBits());
2081*35238bceSAndroid Build Coastguard Worker m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_STENCIL_BITS,
2082*35238bceSAndroid Build Coastguard Worker m_context.getRenderTarget().getStencilBits());
2083*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
2084*35238bceSAndroid Build Coastguard Worker }
2085*35238bceSAndroid Build Coastguard Worker
2086*35238bceSAndroid Build Coastguard Worker private:
2087*35238bceSAndroid Build Coastguard Worker StateVerifier *m_verifier;
2088*35238bceSAndroid Build Coastguard Worker };
2089*35238bceSAndroid Build Coastguard Worker
getQueryTypeSuffix(QueryType type)2090*35238bceSAndroid Build Coastguard Worker static const char *getQueryTypeSuffix(QueryType type)
2091*35238bceSAndroid Build Coastguard Worker {
2092*35238bceSAndroid Build Coastguard Worker switch (type)
2093*35238bceSAndroid Build Coastguard Worker {
2094*35238bceSAndroid Build Coastguard Worker case QUERY_BOOLEAN:
2095*35238bceSAndroid Build Coastguard Worker return "_getboolean";
2096*35238bceSAndroid Build Coastguard Worker case QUERY_INTEGER:
2097*35238bceSAndroid Build Coastguard Worker return "_getinteger";
2098*35238bceSAndroid Build Coastguard Worker case QUERY_FLOAT:
2099*35238bceSAndroid Build Coastguard Worker return "_getfloat";
2100*35238bceSAndroid Build Coastguard Worker default:
2101*35238bceSAndroid Build Coastguard Worker DE_ASSERT(false);
2102*35238bceSAndroid Build Coastguard Worker return DE_NULL;
2103*35238bceSAndroid Build Coastguard Worker }
2104*35238bceSAndroid Build Coastguard Worker }
2105*35238bceSAndroid Build Coastguard Worker
2106*35238bceSAndroid Build Coastguard Worker #define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK) \
2107*35238bceSAndroid Build Coastguard Worker do \
2108*35238bceSAndroid Build Coastguard Worker { \
2109*35238bceSAndroid Build Coastguard Worker for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++) \
2110*35238bceSAndroid Build Coastguard Worker { \
2111*35238bceSAndroid Build Coastguard Worker StateVerifier *verifier = (VERIFIERS)[_verifierNdx]; \
2112*35238bceSAndroid Build Coastguard Worker CODE_BLOCK; \
2113*35238bceSAndroid Build Coastguard Worker } \
2114*35238bceSAndroid Build Coastguard Worker } while (0)
2115*35238bceSAndroid Build Coastguard Worker
2116*35238bceSAndroid Build Coastguard Worker #define FOR_EACH_QUERYTYPE(QUERYTYPES, CODE_BLOCK) \
2117*35238bceSAndroid Build Coastguard Worker do \
2118*35238bceSAndroid Build Coastguard Worker { \
2119*35238bceSAndroid Build Coastguard Worker for (int _queryTypeNdx = 0; _queryTypeNdx < DE_LENGTH_OF_ARRAY(QUERYTYPES); _queryTypeNdx++) \
2120*35238bceSAndroid Build Coastguard Worker { \
2121*35238bceSAndroid Build Coastguard Worker const QueryType queryType = (QUERYTYPES)[_queryTypeNdx]; \
2122*35238bceSAndroid Build Coastguard Worker CODE_BLOCK; \
2123*35238bceSAndroid Build Coastguard Worker } \
2124*35238bceSAndroid Build Coastguard Worker } while (0)
2125*35238bceSAndroid Build Coastguard Worker
2126*35238bceSAndroid Build Coastguard Worker } // namespace
2127*35238bceSAndroid Build Coastguard Worker
IntegerStateQueryTests(Context & context)2128*35238bceSAndroid Build Coastguard Worker IntegerStateQueryTests::IntegerStateQueryTests(Context &context)
2129*35238bceSAndroid Build Coastguard Worker : TestCaseGroup(context, "integers", "Integer Values")
2130*35238bceSAndroid Build Coastguard Worker , m_verifierBoolean(DE_NULL)
2131*35238bceSAndroid Build Coastguard Worker , m_verifierInteger(DE_NULL)
2132*35238bceSAndroid Build Coastguard Worker , m_verifierFloat(DE_NULL)
2133*35238bceSAndroid Build Coastguard Worker {
2134*35238bceSAndroid Build Coastguard Worker }
2135*35238bceSAndroid Build Coastguard Worker
~IntegerStateQueryTests(void)2136*35238bceSAndroid Build Coastguard Worker IntegerStateQueryTests::~IntegerStateQueryTests(void)
2137*35238bceSAndroid Build Coastguard Worker {
2138*35238bceSAndroid Build Coastguard Worker deinit();
2139*35238bceSAndroid Build Coastguard Worker }
2140*35238bceSAndroid Build Coastguard Worker
init(void)2141*35238bceSAndroid Build Coastguard Worker void IntegerStateQueryTests::init(void)
2142*35238bceSAndroid Build Coastguard Worker {
2143*35238bceSAndroid Build Coastguard Worker static const QueryType queryTypes[] = {
2144*35238bceSAndroid Build Coastguard Worker QUERY_BOOLEAN,
2145*35238bceSAndroid Build Coastguard Worker QUERY_INTEGER,
2146*35238bceSAndroid Build Coastguard Worker QUERY_FLOAT,
2147*35238bceSAndroid Build Coastguard Worker };
2148*35238bceSAndroid Build Coastguard Worker
2149*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_verifierBoolean == DE_NULL);
2150*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_verifierInteger == DE_NULL);
2151*35238bceSAndroid Build Coastguard Worker DE_ASSERT(m_verifierFloat == DE_NULL);
2152*35238bceSAndroid Build Coastguard Worker
2153*35238bceSAndroid Build Coastguard Worker m_verifierBoolean =
2154*35238bceSAndroid Build Coastguard Worker new GetBooleanVerifier(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
2155*35238bceSAndroid Build Coastguard Worker m_verifierInteger =
2156*35238bceSAndroid Build Coastguard Worker new GetIntegerVerifier(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
2157*35238bceSAndroid Build Coastguard Worker m_verifierFloat =
2158*35238bceSAndroid Build Coastguard Worker new GetFloatVerifier(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
2159*35238bceSAndroid Build Coastguard Worker
2160*35238bceSAndroid Build Coastguard Worker const struct LimitedStateInteger
2161*35238bceSAndroid Build Coastguard Worker {
2162*35238bceSAndroid Build Coastguard Worker const char *name;
2163*35238bceSAndroid Build Coastguard Worker const char *description;
2164*35238bceSAndroid Build Coastguard Worker GLenum targetName;
2165*35238bceSAndroid Build Coastguard Worker GLint value;
2166*35238bceSAndroid Build Coastguard Worker } implementationMinLimits[] = {
2167*35238bceSAndroid Build Coastguard Worker {"subpixel_bits", "SUBPIXEL_BITS has a minimum value of 4", GL_SUBPIXEL_BITS, 4},
2168*35238bceSAndroid Build Coastguard Worker {"max_texture_size", "MAX_TEXTURE_SIZE has a minimum value of 64", GL_MAX_TEXTURE_SIZE, 64},
2169*35238bceSAndroid Build Coastguard Worker {"max_cube_map_texture_size", "MAX_CUBE_MAP_TEXTURE_SIZE has a minimum value of 16",
2170*35238bceSAndroid Build Coastguard Worker GL_MAX_CUBE_MAP_TEXTURE_SIZE, 16},
2171*35238bceSAndroid Build Coastguard Worker {"max_vertex_attribs", "MAX_VERTEX_ATTRIBS has a minimum value of 8", GL_MAX_VERTEX_ATTRIBS, 8},
2172*35238bceSAndroid Build Coastguard Worker {"max_vertex_uniform_vectors", "MAX_VERTEX_UNIFORM_VECTORS has a minimum value of 128",
2173*35238bceSAndroid Build Coastguard Worker GL_MAX_VERTEX_UNIFORM_VECTORS, 128},
2174*35238bceSAndroid Build Coastguard Worker {"max_varying_vectors", "MAX_VARYING_VECTORS has a minimum value of 8", GL_MAX_VARYING_VECTORS, 8},
2175*35238bceSAndroid Build Coastguard Worker {"max_combined_texture_image_units", "MAX_COMBINED_TEXTURE_IMAGE_UNITS has a minimum value of 8",
2176*35238bceSAndroid Build Coastguard Worker GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 8},
2177*35238bceSAndroid Build Coastguard Worker {"max_vertex_texture_image_units", "MAX_VERTEX_TEXTURE_IMAGE_UNITS has a minimum value of 0",
2178*35238bceSAndroid Build Coastguard Worker GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0},
2179*35238bceSAndroid Build Coastguard Worker {"max_texture_image_units", "MAX_TEXTURE_IMAGE_UNITS has a minimum value of 8", GL_MAX_TEXTURE_IMAGE_UNITS, 8},
2180*35238bceSAndroid Build Coastguard Worker {"max_fragment_uniform_vectors", "MAX_FRAGMENT_UNIFORM_VECTORS has a minimum value of 16",
2181*35238bceSAndroid Build Coastguard Worker GL_MAX_FRAGMENT_UNIFORM_VECTORS, 16},
2182*35238bceSAndroid Build Coastguard Worker {"max_renderbuffer_size", "MAX_RENDERBUFFER_SIZE has a minimum value of 1", GL_MAX_RENDERBUFFER_SIZE, 1},
2183*35238bceSAndroid Build Coastguard Worker };
2184*35238bceSAndroid Build Coastguard Worker
2185*35238bceSAndroid Build Coastguard Worker // \note implementation defined limits have their own tests so just check the conversions to boolean and float
2186*35238bceSAndroid Build Coastguard Worker StateVerifier *implementationLimitVerifiers[] = {m_verifierBoolean, m_verifierFloat};
2187*35238bceSAndroid Build Coastguard Worker StateVerifier *normalVerifiers[] = {m_verifierBoolean, m_verifierInteger, m_verifierFloat};
2188*35238bceSAndroid Build Coastguard Worker
2189*35238bceSAndroid Build Coastguard Worker for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(implementationMinLimits); testNdx++)
2190*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2191*35238bceSAndroid Build Coastguard Worker implementationLimitVerifiers,
2192*35238bceSAndroid Build Coastguard Worker addChild(new ConstantMinimumValueTestCase(
2193*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2194*35238bceSAndroid Build Coastguard Worker (std::string(implementationMinLimits[testNdx].name) + verifier->getTestNamePostfix()).c_str(),
2195*35238bceSAndroid Build Coastguard Worker implementationMinLimits[testNdx].description, implementationMinLimits[testNdx].targetName,
2196*35238bceSAndroid Build Coastguard Worker implementationMinLimits[testNdx].value)));
2197*35238bceSAndroid Build Coastguard Worker
2198*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(implementationLimitVerifiers,
2199*35238bceSAndroid Build Coastguard Worker addChild(new SampleBuffersTestCase(
2200*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("sample_buffers") + verifier->getTestNamePostfix()).c_str(),
2201*35238bceSAndroid Build Coastguard Worker "SAMPLE_BUFFERS")));
2202*35238bceSAndroid Build Coastguard Worker
2203*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2204*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2205*35238bceSAndroid Build Coastguard Worker addChild(new SamplesTestCase(m_context, verifier,
2206*35238bceSAndroid Build Coastguard Worker (std::string("samples") + verifier->getTestNamePostfix()).c_str(), "SAMPLES")));
2207*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2208*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2209*35238bceSAndroid Build Coastguard Worker addChild(new HintTestCase(m_context, verifier,
2210*35238bceSAndroid Build Coastguard Worker (std::string("generate_mipmap_hint") + verifier->getTestNamePostfix()).c_str(),
2211*35238bceSAndroid Build Coastguard Worker "GENERATE_MIPMAP_HINT", GL_GENERATE_MIPMAP_HINT)));
2212*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2213*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2214*35238bceSAndroid Build Coastguard Worker addChild(new DepthFuncTestCase(
2215*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("depth_func") + verifier->getTestNamePostfix()).c_str(), "DEPTH_FUNC")));
2216*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2217*35238bceSAndroid Build Coastguard Worker addChild(new CullFaceTestCase(
2218*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("cull_face_mode") + verifier->getTestNamePostfix()).c_str(),
2219*35238bceSAndroid Build Coastguard Worker "CULL_FACE_MODE")));
2220*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2221*35238bceSAndroid Build Coastguard Worker addChild(new FrontFaceTestCase(
2222*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2223*35238bceSAndroid Build Coastguard Worker (std::string("front_face_mode") + verifier->getTestNamePostfix()).c_str(), "FRONT_FACE")));
2224*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2225*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2226*35238bceSAndroid Build Coastguard Worker addChild(new ViewPortTestCase(m_context, verifier,
2227*35238bceSAndroid Build Coastguard Worker (std::string("viewport") + verifier->getTestNamePostfix()).c_str(), "VIEWPORT")));
2228*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2229*35238bceSAndroid Build Coastguard Worker addChild(new ScissorBoxTestCase(
2230*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("scissor_box") + verifier->getTestNamePostfix()).c_str(),
2231*35238bceSAndroid Build Coastguard Worker "SCISSOR_BOX")));
2232*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers, addChild(new MaxViewportDimsTestCase(
2233*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2234*35238bceSAndroid Build Coastguard Worker (std::string("max_viewport_dims") + verifier->getTestNamePostfix()).c_str(),
2235*35238bceSAndroid Build Coastguard Worker "MAX_VIEWPORT_DIMS")));
2236*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2237*35238bceSAndroid Build Coastguard Worker addChild(new BufferComponentSizeCase(
2238*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2239*35238bceSAndroid Build Coastguard Worker (std::string("buffer_component_size") + verifier->getTestNamePostfix()).c_str(), "x BITS")));
2240*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2241*35238bceSAndroid Build Coastguard Worker addChild(new StencilRefTestCase(
2242*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_ref") + verifier->getTestNamePostfix()).c_str(),
2243*35238bceSAndroid Build Coastguard Worker "STENCIL_REF", GL_STENCIL_REF)));
2244*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilRefTestCase(
2245*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2246*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_ref") + verifier->getTestNamePostfix()).c_str(),
2247*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_REF", GL_STENCIL_BACK_REF)));
2248*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2249*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2250*35238bceSAndroid Build Coastguard Worker addChild(new StencilRefSeparateTestCase(
2251*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_ref_separate") + verifier->getTestNamePostfix()).c_str(),
2252*35238bceSAndroid Build Coastguard Worker "STENCIL_REF (separate)", GL_STENCIL_REF, GL_FRONT)));
2253*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2254*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2255*35238bceSAndroid Build Coastguard Worker addChild(new StencilRefSeparateTestCase(
2256*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_ref_separate_both") + verifier->getTestNamePostfix()).c_str(),
2257*35238bceSAndroid Build Coastguard Worker "STENCIL_REF (separate)", GL_STENCIL_REF, GL_FRONT_AND_BACK)));
2258*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2259*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2260*35238bceSAndroid Build Coastguard Worker addChild(new StencilRefSeparateTestCase(
2261*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_back_ref_separate") + verifier->getTestNamePostfix()).c_str(),
2262*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_REF (separate)", GL_STENCIL_BACK_REF, GL_BACK)));
2263*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2264*35238bceSAndroid Build Coastguard Worker addChild(new StencilRefSeparateTestCase(
2265*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2266*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_ref_separate_both") + verifier->getTestNamePostfix()).c_str(),
2267*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_REF (separate)", GL_STENCIL_BACK_REF, GL_FRONT_AND_BACK)));
2268*35238bceSAndroid Build Coastguard Worker
2269*35238bceSAndroid Build Coastguard Worker const struct NamedStencilOp
2270*35238bceSAndroid Build Coastguard Worker {
2271*35238bceSAndroid Build Coastguard Worker const char *name;
2272*35238bceSAndroid Build Coastguard Worker
2273*35238bceSAndroid Build Coastguard Worker const char *frontDescription;
2274*35238bceSAndroid Build Coastguard Worker GLenum frontTarget;
2275*35238bceSAndroid Build Coastguard Worker const char *backDescription;
2276*35238bceSAndroid Build Coastguard Worker GLenum backTarget;
2277*35238bceSAndroid Build Coastguard Worker } stencilOps[] = {{"fail", "STENCIL_FAIL", GL_STENCIL_FAIL, "STENCIL_BACK_FAIL", GL_STENCIL_BACK_FAIL},
2278*35238bceSAndroid Build Coastguard Worker {"depth_fail", "STENCIL_PASS_DEPTH_FAIL", GL_STENCIL_PASS_DEPTH_FAIL,
2279*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_PASS_DEPTH_FAIL", GL_STENCIL_BACK_PASS_DEPTH_FAIL},
2280*35238bceSAndroid Build Coastguard Worker {"depth_pass", "STENCIL_PASS_DEPTH_PASS", GL_STENCIL_PASS_DEPTH_PASS,
2281*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_PASS_DEPTH_PASS", GL_STENCIL_BACK_PASS_DEPTH_PASS}};
2282*35238bceSAndroid Build Coastguard Worker
2283*35238bceSAndroid Build Coastguard Worker for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(stencilOps); testNdx++)
2284*35238bceSAndroid Build Coastguard Worker {
2285*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2286*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2287*35238bceSAndroid Build Coastguard Worker addChild(new StencilOpTestCase(
2288*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2289*35238bceSAndroid Build Coastguard Worker (std::string("stencil_") + stencilOps[testNdx].name + verifier->getTestNamePostfix()).c_str(),
2290*35238bceSAndroid Build Coastguard Worker stencilOps[testNdx].frontDescription, stencilOps[testNdx].frontTarget)));
2291*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2292*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2293*35238bceSAndroid Build Coastguard Worker addChild(new StencilOpTestCase(
2294*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2295*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_") + stencilOps[testNdx].name + verifier->getTestNamePostfix()).c_str(),
2296*35238bceSAndroid Build Coastguard Worker stencilOps[testNdx].backDescription, stencilOps[testNdx].backTarget)));
2297*35238bceSAndroid Build Coastguard Worker
2298*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2299*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2300*35238bceSAndroid Build Coastguard Worker addChild(new StencilOpSeparateTestCase(
2301*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2302*35238bceSAndroid Build Coastguard Worker (std::string("stencil_") + stencilOps[testNdx].name + "_separate_both" + verifier->getTestNamePostfix())
2303*35238bceSAndroid Build Coastguard Worker .c_str(),
2304*35238bceSAndroid Build Coastguard Worker stencilOps[testNdx].frontDescription, stencilOps[testNdx].frontTarget, GL_FRONT_AND_BACK)));
2305*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2306*35238bceSAndroid Build Coastguard Worker addChild(new StencilOpSeparateTestCase(
2307*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2308*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_") + stencilOps[testNdx].name + "_separate_both" +
2309*35238bceSAndroid Build Coastguard Worker verifier->getTestNamePostfix())
2310*35238bceSAndroid Build Coastguard Worker .c_str(),
2311*35238bceSAndroid Build Coastguard Worker stencilOps[testNdx].backDescription, stencilOps[testNdx].backTarget, GL_FRONT_AND_BACK)));
2312*35238bceSAndroid Build Coastguard Worker
2313*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2314*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2315*35238bceSAndroid Build Coastguard Worker addChild(new StencilOpSeparateTestCase(
2316*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2317*35238bceSAndroid Build Coastguard Worker (std::string("stencil_") + stencilOps[testNdx].name + "_separate" + verifier->getTestNamePostfix())
2318*35238bceSAndroid Build Coastguard Worker .c_str(),
2319*35238bceSAndroid Build Coastguard Worker stencilOps[testNdx].frontDescription, stencilOps[testNdx].frontTarget, GL_FRONT)));
2320*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2321*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2322*35238bceSAndroid Build Coastguard Worker addChild(new StencilOpSeparateTestCase(
2323*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2324*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_") + stencilOps[testNdx].name + "_separate" + verifier->getTestNamePostfix())
2325*35238bceSAndroid Build Coastguard Worker .c_str(),
2326*35238bceSAndroid Build Coastguard Worker stencilOps[testNdx].backDescription, stencilOps[testNdx].backTarget, GL_BACK)));
2327*35238bceSAndroid Build Coastguard Worker }
2328*35238bceSAndroid Build Coastguard Worker
2329*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2330*35238bceSAndroid Build Coastguard Worker addChild(new StencilFuncTestCase(
2331*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_func") + verifier->getTestNamePostfix()).c_str(),
2332*35238bceSAndroid Build Coastguard Worker "STENCIL_FUNC")));
2333*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2334*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2335*35238bceSAndroid Build Coastguard Worker addChild(new StencilFuncSeparateTestCase(
2336*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_func_separate") + verifier->getTestNamePostfix()).c_str(),
2337*35238bceSAndroid Build Coastguard Worker "STENCIL_FUNC (separate)", GL_STENCIL_FUNC, GL_FRONT)));
2338*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2339*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2340*35238bceSAndroid Build Coastguard Worker addChild(new StencilFuncSeparateTestCase(
2341*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_func_separate_both") + verifier->getTestNamePostfix()).c_str(),
2342*35238bceSAndroid Build Coastguard Worker "STENCIL_FUNC (separate)", GL_STENCIL_FUNC, GL_FRONT_AND_BACK)));
2343*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2344*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2345*35238bceSAndroid Build Coastguard Worker addChild(new StencilFuncSeparateTestCase(
2346*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_back_func_separate") + verifier->getTestNamePostfix()).c_str(),
2347*35238bceSAndroid Build Coastguard Worker "STENCIL_FUNC (separate)", GL_STENCIL_BACK_FUNC, GL_BACK)));
2348*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2349*35238bceSAndroid Build Coastguard Worker addChild(new StencilFuncSeparateTestCase(
2350*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2351*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_func_separate_both") + verifier->getTestNamePostfix()).c_str(),
2352*35238bceSAndroid Build Coastguard Worker "STENCIL_FUNC (separate)", GL_STENCIL_BACK_FUNC, GL_FRONT_AND_BACK)));
2353*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilMaskTestCase(
2354*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2355*35238bceSAndroid Build Coastguard Worker (std::string("stencil_value_mask") + verifier->getTestNamePostfix()).c_str(),
2356*35238bceSAndroid Build Coastguard Worker "STENCIL_VALUE_MASK", GL_STENCIL_VALUE_MASK)));
2357*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2358*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2359*35238bceSAndroid Build Coastguard Worker addChild(new StencilMaskTestCase(
2360*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_back_value_mask") + verifier->getTestNamePostfix()).c_str(),
2361*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_VALUE_MASK", GL_STENCIL_BACK_VALUE_MASK)));
2362*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2363*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2364*35238bceSAndroid Build Coastguard Worker addChild(new StencilMaskSeparateTestCase(
2365*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_value_mask_separate") + verifier->getTestNamePostfix()).c_str(),
2366*35238bceSAndroid Build Coastguard Worker "STENCIL_VALUE_MASK (separate)", GL_STENCIL_VALUE_MASK, GL_FRONT)));
2367*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2368*35238bceSAndroid Build Coastguard Worker addChild(new StencilMaskSeparateTestCase(
2369*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2370*35238bceSAndroid Build Coastguard Worker (std::string("stencil_value_mask_separate_both") + verifier->getTestNamePostfix()).c_str(),
2371*35238bceSAndroid Build Coastguard Worker "STENCIL_VALUE_MASK (separate)", GL_STENCIL_VALUE_MASK, GL_FRONT_AND_BACK)));
2372*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2373*35238bceSAndroid Build Coastguard Worker addChild(new StencilMaskSeparateTestCase(
2374*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2375*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_value_mask_separate") + verifier->getTestNamePostfix()).c_str(),
2376*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_VALUE_MASK (separate)", GL_STENCIL_BACK_VALUE_MASK, GL_BACK)));
2377*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2378*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2379*35238bceSAndroid Build Coastguard Worker addChild(new StencilMaskSeparateTestCase(
2380*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2381*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_value_mask_separate_both") + verifier->getTestNamePostfix()).c_str(),
2382*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_VALUE_MASK (separate)", GL_STENCIL_BACK_VALUE_MASK, GL_FRONT_AND_BACK)));
2383*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilWriteMaskTestCase(
2384*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2385*35238bceSAndroid Build Coastguard Worker (std::string("stencil_writemask") + verifier->getTestNamePostfix()).c_str(),
2386*35238bceSAndroid Build Coastguard Worker "STENCIL_WRITEMASK", GL_STENCIL_WRITEMASK)));
2387*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2388*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2389*35238bceSAndroid Build Coastguard Worker addChild(new StencilWriteMaskTestCase(
2390*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_back_writemask") + verifier->getTestNamePostfix()).c_str(),
2391*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_WRITEMASK", GL_STENCIL_BACK_WRITEMASK)));
2392*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2393*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2394*35238bceSAndroid Build Coastguard Worker addChild(new StencilWriteMaskSeparateTestCase(
2395*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_writemask_separate") + verifier->getTestNamePostfix()).c_str(),
2396*35238bceSAndroid Build Coastguard Worker "STENCIL_WRITEMASK (separate)", GL_STENCIL_WRITEMASK, GL_FRONT)));
2397*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2398*35238bceSAndroid Build Coastguard Worker addChild(new StencilWriteMaskSeparateTestCase(
2399*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2400*35238bceSAndroid Build Coastguard Worker (std::string("stencil_writemask_separate_both") + verifier->getTestNamePostfix()).c_str(),
2401*35238bceSAndroid Build Coastguard Worker "STENCIL_WRITEMASK (separate)", GL_STENCIL_WRITEMASK, GL_FRONT_AND_BACK)));
2402*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2403*35238bceSAndroid Build Coastguard Worker addChild(new StencilWriteMaskSeparateTestCase(
2404*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2405*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_writemask_separate") + verifier->getTestNamePostfix()).c_str(),
2406*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_WRITEMASK (separate)", GL_STENCIL_BACK_WRITEMASK, GL_BACK)));
2407*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2408*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2409*35238bceSAndroid Build Coastguard Worker addChild(new StencilWriteMaskSeparateTestCase(
2410*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2411*35238bceSAndroid Build Coastguard Worker (std::string("stencil_back_writemask_separate_both") + verifier->getTestNamePostfix()).c_str(),
2412*35238bceSAndroid Build Coastguard Worker "STENCIL_BACK_WRITEMASK (separate)", GL_STENCIL_BACK_WRITEMASK, GL_FRONT_AND_BACK)));
2413*35238bceSAndroid Build Coastguard Worker
2414*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers, addChild(new PixelStoreAlignTestCase(
2415*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2416*35238bceSAndroid Build Coastguard Worker (std::string("unpack_alignment") + verifier->getTestNamePostfix()).c_str(),
2417*35238bceSAndroid Build Coastguard Worker "UNPACK_ALIGNMENT", GL_UNPACK_ALIGNMENT)));
2418*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2419*35238bceSAndroid Build Coastguard Worker addChild(new PixelStoreAlignTestCase(
2420*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("pack_alignment") + verifier->getTestNamePostfix()).c_str(),
2421*35238bceSAndroid Build Coastguard Worker "PACK_ALIGNMENT", GL_PACK_ALIGNMENT)));
2422*35238bceSAndroid Build Coastguard Worker
2423*35238bceSAndroid Build Coastguard Worker {
2424*35238bceSAndroid Build Coastguard Worker const struct BlendColorState
2425*35238bceSAndroid Build Coastguard Worker {
2426*35238bceSAndroid Build Coastguard Worker const char *name;
2427*35238bceSAndroid Build Coastguard Worker const char *description;
2428*35238bceSAndroid Build Coastguard Worker GLenum target;
2429*35238bceSAndroid Build Coastguard Worker int initialValue;
2430*35238bceSAndroid Build Coastguard Worker } blendColorStates[] = {{"blend_src_rgb", "BLEND_SRC_RGB", GL_BLEND_SRC_RGB, GL_ONE},
2431*35238bceSAndroid Build Coastguard Worker {"blend_src_alpha", "BLEND_SRC_ALPHA", GL_BLEND_SRC_ALPHA, GL_ONE},
2432*35238bceSAndroid Build Coastguard Worker {"blend_dst_rgb", "BLEND_DST_RGB", GL_BLEND_DST_RGB, GL_ZERO},
2433*35238bceSAndroid Build Coastguard Worker {"blend_dst_alpha", "BLEND_DST_ALPHA", GL_BLEND_DST_ALPHA, GL_ZERO}};
2434*35238bceSAndroid Build Coastguard Worker for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(blendColorStates); testNdx++)
2435*35238bceSAndroid Build Coastguard Worker {
2436*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2437*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2438*35238bceSAndroid Build Coastguard Worker addChild(new BlendFuncTestCase(
2439*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2440*35238bceSAndroid Build Coastguard Worker (std::string(blendColorStates[testNdx].name) + verifier->getTestNamePostfix()).c_str(),
2441*35238bceSAndroid Build Coastguard Worker blendColorStates[testNdx].description, blendColorStates[testNdx].target,
2442*35238bceSAndroid Build Coastguard Worker blendColorStates[testNdx].initialValue)));
2443*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2444*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2445*35238bceSAndroid Build Coastguard Worker addChild(new BlendFuncSeparateTestCase(
2446*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2447*35238bceSAndroid Build Coastguard Worker (std::string(blendColorStates[testNdx].name) + "_separate" + verifier->getTestNamePostfix())
2448*35238bceSAndroid Build Coastguard Worker .c_str(),
2449*35238bceSAndroid Build Coastguard Worker blendColorStates[testNdx].description, blendColorStates[testNdx].target,
2450*35238bceSAndroid Build Coastguard Worker blendColorStates[testNdx].initialValue)));
2451*35238bceSAndroid Build Coastguard Worker }
2452*35238bceSAndroid Build Coastguard Worker }
2453*35238bceSAndroid Build Coastguard Worker
2454*35238bceSAndroid Build Coastguard Worker {
2455*35238bceSAndroid Build Coastguard Worker const struct BlendEquationState
2456*35238bceSAndroid Build Coastguard Worker {
2457*35238bceSAndroid Build Coastguard Worker const char *name;
2458*35238bceSAndroid Build Coastguard Worker const char *description;
2459*35238bceSAndroid Build Coastguard Worker GLenum target;
2460*35238bceSAndroid Build Coastguard Worker int initialValue;
2461*35238bceSAndroid Build Coastguard Worker } blendEquationStates[] = {
2462*35238bceSAndroid Build Coastguard Worker {"blend_equation_rgb", "BLEND_EQUATION_RGB", GL_BLEND_EQUATION_RGB, GL_FUNC_ADD},
2463*35238bceSAndroid Build Coastguard Worker {"blend_equation_alpha", "BLEND_EQUATION_ALPHA", GL_BLEND_EQUATION_ALPHA, GL_FUNC_ADD}};
2464*35238bceSAndroid Build Coastguard Worker for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(blendEquationStates); testNdx++)
2465*35238bceSAndroid Build Coastguard Worker {
2466*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2467*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2468*35238bceSAndroid Build Coastguard Worker addChild(new BlendEquationTestCase(
2469*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2470*35238bceSAndroid Build Coastguard Worker (std::string(blendEquationStates[testNdx].name) + +verifier->getTestNamePostfix()).c_str(),
2471*35238bceSAndroid Build Coastguard Worker blendEquationStates[testNdx].description, blendEquationStates[testNdx].target,
2472*35238bceSAndroid Build Coastguard Worker blendEquationStates[testNdx].initialValue)));
2473*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2474*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2475*35238bceSAndroid Build Coastguard Worker addChild(new BlendEquationSeparateTestCase(
2476*35238bceSAndroid Build Coastguard Worker m_context, verifier,
2477*35238bceSAndroid Build Coastguard Worker (std::string(blendEquationStates[testNdx].name) + "_separate" + verifier->getTestNamePostfix())
2478*35238bceSAndroid Build Coastguard Worker .c_str(),
2479*35238bceSAndroid Build Coastguard Worker blendEquationStates[testNdx].description, blendEquationStates[testNdx].target,
2480*35238bceSAndroid Build Coastguard Worker blendEquationStates[testNdx].initialValue)));
2481*35238bceSAndroid Build Coastguard Worker }
2482*35238bceSAndroid Build Coastguard Worker }
2483*35238bceSAndroid Build Coastguard Worker
2484*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2485*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2486*35238bceSAndroid Build Coastguard Worker addChild(new ImplementationArrayTestCase(
2487*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("compressed_texture_formats") + verifier->getTestNamePostfix()).c_str(),
2488*35238bceSAndroid Build Coastguard Worker "COMPRESSED_TEXTURE_FORMATS", GL_COMPRESSED_TEXTURE_FORMATS, GL_NUM_COMPRESSED_TEXTURE_FORMATS, 0)));
2489*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2490*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2491*35238bceSAndroid Build Coastguard Worker addChild(new ImplementationArrayTestCase(
2492*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("shader_binary_formats") + verifier->getTestNamePostfix()).c_str(),
2493*35238bceSAndroid Build Coastguard Worker "SHADER_BINARY_FORMATS", GL_SHADER_BINARY_FORMATS, GL_NUM_SHADER_BINARY_FORMATS, 0)));
2494*35238bceSAndroid Build Coastguard Worker
2495*35238bceSAndroid Build Coastguard Worker FOR_EACH_QUERYTYPE(queryTypes, addChild(new BufferBindingTestCase(
2496*35238bceSAndroid Build Coastguard Worker m_context, queryType,
2497*35238bceSAndroid Build Coastguard Worker (std::string("array_buffer_binding") + getQueryTypeSuffix(queryType)).c_str(),
2498*35238bceSAndroid Build Coastguard Worker "ARRAY_BUFFER_BINDING", GL_ARRAY_BUFFER_BINDING, GL_ARRAY_BUFFER)));
2499*35238bceSAndroid Build Coastguard Worker FOR_EACH_QUERYTYPE(
2500*35238bceSAndroid Build Coastguard Worker queryTypes,
2501*35238bceSAndroid Build Coastguard Worker addChild(new BufferBindingTestCase(
2502*35238bceSAndroid Build Coastguard Worker m_context, queryType, (std::string("element_array_buffer_binding") + getQueryTypeSuffix(queryType)).c_str(),
2503*35238bceSAndroid Build Coastguard Worker "ELEMENT_ARRAY_BUFFER_BINDING", GL_ELEMENT_ARRAY_BUFFER_BINDING, GL_ELEMENT_ARRAY_BUFFER)));
2504*35238bceSAndroid Build Coastguard Worker
2505*35238bceSAndroid Build Coastguard Worker FOR_EACH_QUERYTYPE(queryTypes, addChild(new CurrentProgramBindingTestCase(
2506*35238bceSAndroid Build Coastguard Worker m_context, queryType,
2507*35238bceSAndroid Build Coastguard Worker (std::string("current_program_binding") + getQueryTypeSuffix(queryType)).c_str(),
2508*35238bceSAndroid Build Coastguard Worker "CURRENT_PROGRAM")));
2509*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2510*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2511*35238bceSAndroid Build Coastguard Worker addChild(new StencilClearValueTestCase(
2512*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("stencil_clear_value") + verifier->getTestNamePostfix()).c_str(),
2513*35238bceSAndroid Build Coastguard Worker "STENCIL_CLEAR_VALUE")));
2514*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(normalVerifiers,
2515*35238bceSAndroid Build Coastguard Worker addChild(new ActiveTextureTestCase(
2516*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("active_texture") + verifier->getTestNamePostfix()).c_str(),
2517*35238bceSAndroid Build Coastguard Worker "ACTIVE_TEXTURE")));
2518*35238bceSAndroid Build Coastguard Worker FOR_EACH_QUERYTYPE(queryTypes, addChild(new RenderbufferBindingTestCase(
2519*35238bceSAndroid Build Coastguard Worker m_context, queryType,
2520*35238bceSAndroid Build Coastguard Worker (std::string("renderbuffer_binding") + getQueryTypeSuffix(queryType)).c_str(),
2521*35238bceSAndroid Build Coastguard Worker "RENDERBUFFER_BINDING")));
2522*35238bceSAndroid Build Coastguard Worker
2523*35238bceSAndroid Build Coastguard Worker FOR_EACH_QUERYTYPE(queryTypes, addChild(new TextureBindingTestCase(
2524*35238bceSAndroid Build Coastguard Worker m_context, queryType,
2525*35238bceSAndroid Build Coastguard Worker (std::string("texture_binding_2d") + getQueryTypeSuffix(queryType)).c_str(),
2526*35238bceSAndroid Build Coastguard Worker "TEXTURE_BINDING_2D", GL_TEXTURE_BINDING_2D, GL_TEXTURE_2D)));
2527*35238bceSAndroid Build Coastguard Worker FOR_EACH_QUERYTYPE(
2528*35238bceSAndroid Build Coastguard Worker queryTypes,
2529*35238bceSAndroid Build Coastguard Worker addChild(new TextureBindingTestCase(
2530*35238bceSAndroid Build Coastguard Worker m_context, queryType, (std::string("texture_binding_cube_map") + getQueryTypeSuffix(queryType)).c_str(),
2531*35238bceSAndroid Build Coastguard Worker "TEXTURE_BINDING_CUBE_MAP", GL_TEXTURE_BINDING_CUBE_MAP, GL_TEXTURE_CUBE_MAP)));
2532*35238bceSAndroid Build Coastguard Worker
2533*35238bceSAndroid Build Coastguard Worker FOR_EACH_QUERYTYPE(queryTypes, addChild(new FrameBufferBindingTestCase(
2534*35238bceSAndroid Build Coastguard Worker m_context, queryType,
2535*35238bceSAndroid Build Coastguard Worker (std::string("framebuffer_binding") + getQueryTypeSuffix(queryType)).c_str(),
2536*35238bceSAndroid Build Coastguard Worker "DRAW_FRAMEBUFFER_BINDING and READ_FRAMEBUFFER_BINDING")));
2537*35238bceSAndroid Build Coastguard Worker FOR_EACH_VERIFIER(
2538*35238bceSAndroid Build Coastguard Worker normalVerifiers,
2539*35238bceSAndroid Build Coastguard Worker addChild(new ImplementationColorReadTestCase(
2540*35238bceSAndroid Build Coastguard Worker m_context, verifier, (std::string("implementation_color_read") + verifier->getTestNamePostfix()).c_str(),
2541*35238bceSAndroid Build Coastguard Worker "IMPLEMENTATION_COLOR_READ_TYPE and IMPLEMENTATION_COLOR_READ_FORMAT")));
2542*35238bceSAndroid Build Coastguard Worker }
2543*35238bceSAndroid Build Coastguard Worker
deinit(void)2544*35238bceSAndroid Build Coastguard Worker void IntegerStateQueryTests::deinit(void)
2545*35238bceSAndroid Build Coastguard Worker {
2546*35238bceSAndroid Build Coastguard Worker if (m_verifierBoolean)
2547*35238bceSAndroid Build Coastguard Worker {
2548*35238bceSAndroid Build Coastguard Worker delete m_verifierBoolean;
2549*35238bceSAndroid Build Coastguard Worker m_verifierBoolean = DE_NULL;
2550*35238bceSAndroid Build Coastguard Worker }
2551*35238bceSAndroid Build Coastguard Worker if (m_verifierInteger)
2552*35238bceSAndroid Build Coastguard Worker {
2553*35238bceSAndroid Build Coastguard Worker delete m_verifierInteger;
2554*35238bceSAndroid Build Coastguard Worker m_verifierInteger = DE_NULL;
2555*35238bceSAndroid Build Coastguard Worker }
2556*35238bceSAndroid Build Coastguard Worker if (m_verifierFloat)
2557*35238bceSAndroid Build Coastguard Worker {
2558*35238bceSAndroid Build Coastguard Worker delete m_verifierFloat;
2559*35238bceSAndroid Build Coastguard Worker m_verifierFloat = DE_NULL;
2560*35238bceSAndroid Build Coastguard Worker }
2561*35238bceSAndroid Build Coastguard Worker
2562*35238bceSAndroid Build Coastguard Worker this->TestCaseGroup::deinit();
2563*35238bceSAndroid Build Coastguard Worker }
2564*35238bceSAndroid Build Coastguard Worker
2565*35238bceSAndroid Build Coastguard Worker } // namespace Functional
2566*35238bceSAndroid Build Coastguard Worker } // namespace gles2
2567*35238bceSAndroid Build Coastguard Worker } // namespace deqp
2568