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