Home | History | Annotate | Download | only in functional
      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 Boolean State Query tests.
     22  *//*--------------------------------------------------------------------*/
     23 
     24 #include "es2fBooleanStateQueryTests.hpp"
     25 #include "es2fApiCase.hpp"
     26 #include "glsStateQueryUtil.hpp"
     27 #include "gluRenderContext.hpp"
     28 #include "tcuRenderTarget.hpp"
     29 #include "glwEnums.hpp"
     30 
     31 using namespace glw; // GLint and other GL types
     32 using deqp::gls::StateQueryUtil::StateQueryMemoryWriteGuard;
     33 
     34 namespace deqp
     35 {
     36 namespace gles2
     37 {
     38 namespace Functional
     39 {
     40 namespace BooleanStateQueryVerifiers
     41 {
     42 
     43 // StateVerifier
     44 
     45 class StateVerifier : protected glu::CallLogWrapper
     46 {
     47 public:
     48 						StateVerifier					(const glw::Functions& gl, tcu::TestLog& log, const char* testNamePostfix);
     49 	virtual				~StateVerifier					(); // make GCC happy
     50 
     51 	const char*			getTestNamePostfix				(void) const;
     52 
     53 	virtual void		verifyBoolean					(tcu::TestContext& testCtx, GLenum name, bool reference)														= DE_NULL;
     54 	virtual void		verifyBoolean4					(tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3)	= DE_NULL;
     55 	virtual void		verifyBooleanAnything			(tcu::TestContext& testCtx, GLenum name)																		= DE_NULL;
     56 private:
     57 	const char*	const	m_testNamePostfix;
     58 };
     59 
     60 StateVerifier::StateVerifier (const glw::Functions& gl, tcu::TestLog& log, const char* testNamePostfix)
     61 	: glu::CallLogWrapper	(gl, log)
     62 	, m_testNamePostfix		(testNamePostfix)
     63 {
     64 	enableLogging(true);
     65 }
     66 
     67 StateVerifier::~StateVerifier ()
     68 {
     69 }
     70 
     71 const char* StateVerifier::getTestNamePostfix (void) const
     72 {
     73 	return m_testNamePostfix;
     74 }
     75 
     76 // IsEnabledVerifier
     77 
     78 class IsEnabledVerifier : public StateVerifier
     79 {
     80 public:
     81 			IsEnabledVerifier		(const glw::Functions& gl, tcu::TestLog& log);
     82 	void	verifyBoolean			(tcu::TestContext& testCtx, GLenum name, bool reference);
     83 	void	verifyBoolean4			(tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3);
     84 	void	verifyBooleanAnything	(tcu::TestContext& testCtx, GLenum name);
     85 };
     86 
     87 IsEnabledVerifier::IsEnabledVerifier (const glw::Functions& gl, tcu::TestLog& log)
     88 	: StateVerifier(gl, log, "_isenabled")
     89 {
     90 }
     91 
     92 void IsEnabledVerifier::verifyBoolean (tcu::TestContext& testCtx, GLenum name, bool reference)
     93 {
     94 	using tcu::TestLog;
     95 
     96 	const GLboolean state = glIsEnabled(name);
     97 	const GLboolean expectedGLState = reference ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE;
     98 
     99 	if (state != expectedGLState)
    100 	{
    101 		testCtx.getLog() << TestLog::Message << "// ERROR: expected " << (reference ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
    102 		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
    103 			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
    104 	}
    105 }
    106 
    107 void IsEnabledVerifier::verifyBoolean4 (tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3)
    108 {
    109 	DE_UNREF(testCtx);
    110 	DE_UNREF(name);
    111 	DE_UNREF(reference0);
    112 	DE_UNREF(reference1);
    113 	DE_UNREF(reference2);
    114 	DE_UNREF(reference3);
    115 	DE_ASSERT(false && "not supported");
    116 }
    117 
    118 void IsEnabledVerifier::verifyBooleanAnything (tcu::TestContext& testCtx, GLenum name)
    119 {
    120 	DE_UNREF(testCtx);
    121 	DE_UNREF(name);
    122 	DE_ASSERT(false && "not supported");
    123 }
    124 // GetBooleanVerifier
    125 
    126 class GetBooleanVerifier : public StateVerifier
    127 {
    128 public:
    129 			GetBooleanVerifier		(const glw::Functions& gl, tcu::TestLog& log);
    130 	void	verifyBoolean			(tcu::TestContext& testCtx, GLenum name, bool reference);
    131 	void	verifyBoolean4			(tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3);
    132 	void	verifyBooleanAnything	(tcu::TestContext& testCtx, GLenum name);
    133 };
    134 
    135 GetBooleanVerifier::GetBooleanVerifier (const glw::Functions& gl, tcu::TestLog& log)
    136 	: StateVerifier(gl, log, "_getboolean")
    137 {
    138 }
    139 
    140 void GetBooleanVerifier::verifyBoolean (tcu::TestContext& testCtx, GLenum name, bool reference)
    141 {
    142 	using tcu::TestLog;
    143 
    144 	StateQueryMemoryWriteGuard<GLboolean> state;
    145 	glGetBooleanv(name, &state);
    146 
    147 	if (!state.verifyValidity(testCtx))
    148 		return;
    149 
    150 	const GLboolean expectedGLState = reference ? GL_TRUE : GL_FALSE;
    151 
    152 	if (state != expectedGLState)
    153 	{
    154 		testCtx.getLog() << TestLog::Message << "// ERROR: expected " << (reference ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
    155 		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
    156 			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
    157 	}
    158 }
    159 
    160 void GetBooleanVerifier::verifyBoolean4 (tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3)
    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 	{
    172 		reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
    173 		reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
    174 		reference2 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
    175 		reference3 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
    176 	};
    177 
    178 	if (boolVector4[0] != referenceAsGLBoolean[0] ||
    179 		boolVector4[1] != referenceAsGLBoolean[1] ||
    180 		boolVector4[2] != referenceAsGLBoolean[2] ||
    181 		boolVector4[3] != referenceAsGLBoolean[3])
    182 	{
    183 		testCtx.getLog() << TestLog::Message << "// ERROR: expected "
    184 			<< (referenceAsGLBoolean[0] ? "GL_TRUE" : "GL_FALSE") << " "
    185 			<< (referenceAsGLBoolean[1] ? "GL_TRUE" : "GL_FALSE") << " "
    186 			<< (referenceAsGLBoolean[2] ? "GL_TRUE" : "GL_FALSE") << " "
    187 			<< (referenceAsGLBoolean[3] ? "GL_TRUE" : "GL_FALSE") << 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 
    194 void GetBooleanVerifier::verifyBooleanAnything (tcu::TestContext& testCtx, GLenum name)
    195 {
    196 	using tcu::TestLog;
    197 
    198 	StateQueryMemoryWriteGuard<GLboolean> state;
    199 	glGetBooleanv(name, &state);
    200 
    201 	state.verifyValidity(testCtx);
    202 }
    203 
    204 //GetIntegerVerifier
    205 
    206 class GetIntegerVerifier : public StateVerifier
    207 {
    208 public:
    209 			GetIntegerVerifier		(const glw::Functions& gl, tcu::TestLog& log);
    210 	void	verifyBoolean			(tcu::TestContext& testCtx, GLenum name, bool reference);
    211 	void	verifyBoolean4			(tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3);
    212 	void	verifyBooleanAnything	(tcu::TestContext& testCtx, GLenum name);
    213 
    214 };
    215 
    216 GetIntegerVerifier::GetIntegerVerifier (const glw::Functions& gl, tcu::TestLog& log)
    217 	: StateVerifier(gl, log, "_getinteger")
    218 {
    219 }
    220 
    221 void GetIntegerVerifier::verifyBoolean (tcu::TestContext& testCtx, GLenum name, bool reference)
    222 {
    223 	using tcu::TestLog;
    224 
    225 	StateQueryMemoryWriteGuard<GLint> state;
    226 	glGetIntegerv(name, &state);
    227 
    228 	if (!state.verifyValidity(testCtx))
    229 		return;
    230 
    231 	const GLint expectedGLState = reference ? 1 : 0;
    232 
    233 	if (state != expectedGLState)
    234 	{
    235 		testCtx.getLog() << TestLog::Message << "// ERROR: expected " << expectedGLState << TestLog::EndMessage;
    236 		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
    237 			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
    238 	}
    239 }
    240 
    241 void GetIntegerVerifier::verifyBoolean4 (tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3)
    242 {
    243 	using tcu::TestLog;
    244 
    245 	StateQueryMemoryWriteGuard<GLint[4]> boolVector4;
    246 	glGetIntegerv(name, boolVector4);
    247 
    248 	if (!boolVector4.verifyValidity(testCtx))
    249 		return;
    250 
    251 	const GLint referenceAsGLint[] =
    252 	{
    253 		reference0 ? 1 : 0,
    254 		reference1 ? 1 : 0,
    255 		reference2 ? 1 : 0,
    256 		reference3 ? 1 : 0,
    257 	};
    258 
    259 	if (boolVector4[0] != referenceAsGLint[0] ||
    260 		boolVector4[1] != referenceAsGLint[1] ||
    261 		boolVector4[2] != referenceAsGLint[2] ||
    262 		boolVector4[3] != referenceAsGLint[3])
    263 	{
    264 		testCtx.getLog() << TestLog::Message << "// ERROR: expected "
    265 			<< referenceAsGLint[0] << " "
    266 			<< referenceAsGLint[1] << " "
    267 			<< referenceAsGLint[2] << " "
    268 			<< referenceAsGLint[3] << " " << TestLog::EndMessage;
    269 
    270 		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
    271 			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
    272 	}
    273 }
    274 
    275 void GetIntegerVerifier::verifyBooleanAnything (tcu::TestContext& testCtx, GLenum name)
    276 {
    277 	using tcu::TestLog;
    278 
    279 	StateQueryMemoryWriteGuard<GLint> state;
    280 	glGetIntegerv(name, &state);
    281 
    282 	state.verifyValidity(testCtx);
    283 }
    284 
    285 //GetFloatVerifier
    286 
    287 class GetFloatVerifier : public StateVerifier
    288 {
    289 public:
    290 			GetFloatVerifier		(const glw::Functions& gl, tcu::TestLog& log);
    291 	void	verifyBoolean			(tcu::TestContext& testCtx, GLenum name, bool reference);
    292 	void	verifyBoolean4			(tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3);
    293 	void	verifyBooleanAnything	(tcu::TestContext& testCtx, GLenum name);
    294 };
    295 
    296 GetFloatVerifier::GetFloatVerifier (const glw::Functions& gl, tcu::TestLog& log)
    297 	: StateVerifier(gl, log, "_getfloat")
    298 {
    299 }
    300 
    301 void GetFloatVerifier::verifyBoolean (tcu::TestContext& testCtx, GLenum name, bool reference)
    302 {
    303 	using tcu::TestLog;
    304 
    305 	StateQueryMemoryWriteGuard<GLfloat> state;
    306 	glGetFloatv(name, &state);
    307 
    308 	if (!state.verifyValidity(testCtx))
    309 		return;
    310 
    311 	const GLfloat expectedGLState = reference ? 1.0f : 0.0f;
    312 
    313 	if (state != expectedGLState)
    314 	{
    315 		testCtx.getLog() << TestLog::Message << "// ERROR: expected " << expectedGLState << "; got " << state << TestLog::EndMessage;
    316 		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
    317 			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
    318 	}
    319 }
    320 
    321 void GetFloatVerifier::verifyBoolean4 (tcu::TestContext& testCtx, GLenum name, bool reference0, bool reference1, bool reference2, bool reference3)
    322 {
    323 	using tcu::TestLog;
    324 
    325 	StateQueryMemoryWriteGuard<GLfloat[4]> boolVector4;
    326 	glGetFloatv(name, boolVector4);
    327 
    328 	if (!boolVector4.verifyValidity(testCtx))
    329 		return;
    330 
    331 	const GLfloat referenceAsGLfloat[] =
    332 	{
    333 		reference0 ? 1.0f : 0.0f,
    334 		reference1 ? 1.0f : 0.0f,
    335 		reference2 ? 1.0f : 0.0f,
    336 		reference3 ? 1.0f : 0.0f,
    337 	};
    338 
    339 	if (boolVector4[0] != referenceAsGLfloat[0] ||
    340 		boolVector4[1] != referenceAsGLfloat[1] ||
    341 		boolVector4[2] != referenceAsGLfloat[2] ||
    342 		boolVector4[3] != referenceAsGLfloat[3])
    343 	{
    344 		testCtx.getLog() << TestLog::Message << "// ERROR: expected "
    345 			<< referenceAsGLfloat[0] << " "
    346 			<< referenceAsGLfloat[1] << " "
    347 			<< referenceAsGLfloat[2] << " "
    348 			<< referenceAsGLfloat[3] << " " << TestLog::EndMessage;
    349 
    350 		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
    351 			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
    352 	}
    353 }
    354 
    355 void GetFloatVerifier::verifyBooleanAnything (tcu::TestContext& testCtx, GLenum name)
    356 {
    357 	using tcu::TestLog;
    358 
    359 	StateQueryMemoryWriteGuard<GLfloat> state;
    360 	glGetFloatv(name, &state);
    361 
    362 	state.verifyValidity(testCtx);
    363 }
    364 
    365 } // BooleanStateQueryVerifiers
    366 
    367 namespace
    368 {
    369 
    370 using namespace BooleanStateQueryVerifiers;
    371 
    372 class IsEnabledStateTestCase : public ApiCase
    373 {
    374 public:
    375 	IsEnabledStateTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum targetName, bool initial)
    376 		: ApiCase		(context, name, description)
    377 		, m_targetName	(targetName)
    378 		, m_initial		(initial)
    379 		, m_verifier	(verifier)
    380 	{
    381 	}
    382 
    383 	void test (void)
    384 	{
    385 		// check inital value
    386 		m_verifier->verifyBoolean(m_testCtx, m_targetName, m_initial);
    387 		expectError(GL_NO_ERROR);
    388 
    389 		// check toggle
    390 
    391 		glEnable(m_targetName);
    392 		expectError(GL_NO_ERROR);
    393 
    394 		m_verifier->verifyBoolean(m_testCtx, m_targetName, true);
    395 		expectError(GL_NO_ERROR);
    396 
    397 		glDisable(m_targetName);
    398 		expectError(GL_NO_ERROR);
    399 
    400 		m_verifier->verifyBoolean(m_testCtx, m_targetName, false);
    401 		expectError(GL_NO_ERROR);
    402 	}
    403 
    404 private:
    405 	GLenum			m_targetName;
    406 	bool			m_initial;
    407 	StateVerifier*	m_verifier;
    408 };
    409 
    410 class DepthWriteMaskTestCase : public ApiCase
    411 {
    412 public:
    413 	DepthWriteMaskTestCase	(Context& context, StateVerifier* verifier, const char* name, const char* description)
    414 		: ApiCase		(context, name, description)
    415 		, m_verifier	(verifier)
    416 	{
    417 	}
    418 
    419 	void test (void)
    420 	{
    421 		m_verifier->verifyBoolean(m_testCtx, GL_DEPTH_WRITEMASK, true);
    422 		expectError(GL_NO_ERROR);
    423 
    424 		glDepthMask(GL_FALSE);
    425 		m_verifier->verifyBoolean(m_testCtx, GL_DEPTH_WRITEMASK, false);
    426 		expectError(GL_NO_ERROR);
    427 
    428 		glDepthMask(GL_TRUE);
    429 		m_verifier->verifyBoolean(m_testCtx, GL_DEPTH_WRITEMASK, true);
    430 		expectError(GL_NO_ERROR);
    431 	}
    432 private:
    433 	StateVerifier*	m_verifier;
    434 };
    435 
    436 class SampleCoverageInvertTestCase : public ApiCase
    437 {
    438 public:
    439 	SampleCoverageInvertTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
    440 		: ApiCase		(context, name, description)
    441 		, m_verifier	(verifier)
    442 	{
    443 	}
    444 
    445 	void test (void)
    446 	{
    447 		m_verifier->verifyBoolean(m_testCtx, GL_SAMPLE_COVERAGE_INVERT, false);
    448 		expectError(GL_NO_ERROR);
    449 
    450 		glSampleCoverage(1.0f, GL_TRUE);
    451 		m_verifier->verifyBoolean(m_testCtx, GL_SAMPLE_COVERAGE_INVERT, true);
    452 		expectError(GL_NO_ERROR);
    453 
    454 		glSampleCoverage(1.0f, GL_FALSE);
    455 		m_verifier->verifyBoolean(m_testCtx, GL_SAMPLE_COVERAGE_INVERT, false);
    456 		expectError(GL_NO_ERROR);
    457 	}
    458 private:
    459 	StateVerifier*	m_verifier;
    460 };
    461 
    462 class ShaderCompilerTestCase : public ApiCase
    463 {
    464 public:
    465 	ShaderCompilerTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
    466 		: ApiCase		(context, name, description)
    467 		, m_verifier	(verifier)
    468 	{
    469 	}
    470 
    471 	void test (void)
    472 	{
    473 		m_verifier->verifyBooleanAnything(m_testCtx, GL_SHADER_COMPILER);
    474 		expectError(GL_NO_ERROR);
    475 	}
    476 
    477 private:
    478 	StateVerifier*	m_verifier;
    479 };
    480 
    481 class ColorMaskTestCase : public ApiCase
    482 {
    483 public:
    484 	ColorMaskTestCase	(Context& context, StateVerifier* verifier, const char* name, const char* description)
    485 		: ApiCase(context, name, description)
    486 		, m_verifier	(verifier)
    487 	{
    488 	}
    489 	void test (void)
    490 	{
    491 		m_verifier->verifyBoolean4(m_testCtx, GL_COLOR_WRITEMASK, true, true, true, true);
    492 		expectError(GL_NO_ERROR);
    493 
    494 		const struct ColorMask
    495 		{
    496 			GLboolean r, g, b, a;
    497 		} testMasks[] =
    498 		{
    499 			{ GL_TRUE,	GL_TRUE,	GL_TRUE,	GL_TRUE  },
    500 			{ GL_TRUE,	GL_TRUE,	GL_TRUE,	GL_FALSE },
    501 			{ GL_TRUE,	GL_TRUE,	GL_FALSE,	GL_TRUE  },
    502 			{ GL_TRUE,	GL_TRUE,	GL_FALSE,	GL_FALSE },
    503 			{ GL_TRUE,	GL_FALSE,	GL_TRUE,	GL_TRUE  },
    504 			{ GL_TRUE,	GL_FALSE,	GL_TRUE,	GL_FALSE },
    505 			{ GL_TRUE,	GL_FALSE,	GL_FALSE,	GL_TRUE  },
    506 			{ GL_TRUE,	GL_FALSE,	GL_FALSE,	GL_FALSE },
    507 			{ GL_FALSE,	GL_TRUE,	GL_TRUE,	GL_TRUE  },
    508 			{ GL_FALSE,	GL_TRUE,	GL_TRUE,	GL_FALSE },
    509 			{ GL_FALSE,	GL_TRUE,	GL_FALSE,	GL_TRUE  },
    510 			{ GL_FALSE,	GL_TRUE,	GL_FALSE,	GL_FALSE },
    511 			{ GL_FALSE,	GL_FALSE,	GL_TRUE,	GL_TRUE  },
    512 			{ GL_FALSE,	GL_FALSE,	GL_TRUE,	GL_FALSE },
    513 			{ GL_FALSE,	GL_FALSE,	GL_FALSE,	GL_TRUE  },
    514 			{ GL_FALSE,	GL_FALSE,	GL_FALSE,	GL_FALSE },
    515 		};
    516 
    517 		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(testMasks); ndx++)
    518 		{
    519 			glColorMask(testMasks[ndx].r, testMasks[ndx].g, testMasks[ndx].b, testMasks[ndx].a);
    520 			m_verifier->verifyBoolean4(m_testCtx, GL_COLOR_WRITEMASK, testMasks[ndx].r==GL_TRUE, testMasks[ndx].g==GL_TRUE, testMasks[ndx].b==GL_TRUE, testMasks[ndx].a==GL_TRUE);
    521 			expectError(GL_NO_ERROR);
    522 		}
    523 	}
    524 private:
    525 	StateVerifier*	m_verifier;
    526 };
    527 
    528 #define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK)												\
    529 	for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++)	\
    530 	{																							\
    531 		StateVerifier* verifier = VERIFIERS[_verifierNdx];										\
    532 		CODE_BLOCK;																				\
    533 	}
    534 
    535 } // anonymous
    536 
    537 BooleanStateQueryTests::BooleanStateQueryTests (Context& context)
    538 	: TestCaseGroup				(context, "boolean", "Boolean State Query tests")
    539 	, m_verifierIsEnabled		(DE_NULL)
    540 	, m_verifierBoolean			(DE_NULL)
    541 	, m_verifierInteger			(DE_NULL)
    542 	, m_verifierFloat			(DE_NULL)
    543 {
    544 }
    545 
    546 BooleanStateQueryTests::~BooleanStateQueryTests (void)
    547 {
    548 	deinit();
    549 }
    550 
    551 void BooleanStateQueryTests::init (void)
    552 {
    553 	DE_ASSERT(m_verifierIsEnabled == DE_NULL);
    554 	DE_ASSERT(m_verifierBoolean == DE_NULL);
    555 	DE_ASSERT(m_verifierInteger == DE_NULL);
    556 	DE_ASSERT(m_verifierFloat == DE_NULL);
    557 
    558 	m_verifierIsEnabled		= new IsEnabledVerifier		(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
    559 	m_verifierBoolean		= new GetBooleanVerifier	(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
    560 	m_verifierInteger		= new GetIntegerVerifier	(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
    561 	m_verifierFloat			= new GetFloatVerifier		(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
    562 
    563 	StateVerifier* isEnabledVerifiers[] = {m_verifierIsEnabled, m_verifierBoolean, m_verifierInteger, m_verifierFloat};
    564 	StateVerifier* normalVerifiers[]	= {						m_verifierBoolean, m_verifierInteger, m_verifierFloat};
    565 
    566 	struct StateBoolean
    567 	{
    568 		const char*		name;
    569 		const char*		description;
    570 		GLenum			targetName;
    571 		bool			value;
    572 	};
    573 	const StateBoolean isEnableds[] =
    574 	{
    575 		{ "cull_face",						"CULL_FACE",						GL_CULL_FACE,						false},
    576 		{ "polygon_offset_fill",			"POLYGON_OFFSET_FILL",				GL_POLYGON_OFFSET_FILL,				false},
    577 		{ "sample_alpha_to_coverage",		"SAMPLE_ALPHA_TO_COVERAGE",			GL_SAMPLE_ALPHA_TO_COVERAGE,		false},
    578 		{ "sample_coverage",				"SAMPLE_COVERAGE",					GL_SAMPLE_COVERAGE,					false},
    579 		{ "scissor_test",					"SCISSOR_TEST",						GL_SCISSOR_TEST,					false},
    580 		{ "stencil_test",					"STENCIL_TEST",						GL_STENCIL_TEST,					false},
    581 		{ "depth_test",						"DEPTH_TEST",						GL_DEPTH_TEST,						false},
    582 		{ "blend",							"BLEND",							GL_BLEND,							false},
    583 		{ "dither",							"DITHER",							GL_DITHER,							true },
    584 	};
    585 	for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(isEnableds); testNdx++)
    586 		FOR_EACH_VERIFIER(isEnabledVerifiers, addChild(new IsEnabledStateTestCase(m_context, verifier, (std::string(isEnableds[testNdx].name) + verifier->getTestNamePostfix()).c_str(), isEnableds[testNdx].description, isEnableds[testNdx].targetName, isEnableds[testNdx].value)));
    587 
    588 	FOR_EACH_VERIFIER(normalVerifiers, addChild(new SampleCoverageInvertTestCase				(m_context, verifier, (std::string("sample_coverage_invert")				+ verifier->getTestNamePostfix()).c_str(), "SAMPLE_COVERAGE_INVERT")));
    589 	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ColorMaskTestCase							(m_context, verifier, (std::string("color_writemask")						+ verifier->getTestNamePostfix()).c_str(), "COLOR_WRITEMASK")));
    590 	FOR_EACH_VERIFIER(normalVerifiers, addChild(new DepthWriteMaskTestCase						(m_context, verifier, (std::string("depth_writemask")						+ verifier->getTestNamePostfix()).c_str(), "DEPTH_WRITEMASK")));
    591 	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ShaderCompilerTestCase						(m_context, verifier, (std::string("shader_compiler")						+ verifier->getTestNamePostfix()).c_str(), "SHADER_COMPILER")));
    592 }
    593 
    594 void BooleanStateQueryTests::deinit (void)
    595 {
    596 	if (m_verifierIsEnabled)
    597 	{
    598 		delete m_verifierIsEnabled;
    599 		m_verifierIsEnabled = DE_NULL;
    600 	}
    601 	if (m_verifierBoolean)
    602 	{
    603 		delete m_verifierBoolean;
    604 		m_verifierBoolean = DE_NULL;
    605 	}
    606 	if (m_verifierInteger)
    607 	{
    608 		delete m_verifierInteger;
    609 		m_verifierInteger = DE_NULL;
    610 	}
    611 	if (m_verifierFloat)
    612 	{
    613 		delete m_verifierFloat;
    614 		m_verifierFloat = DE_NULL;
    615 	}
    616 
    617 	this->TestCaseGroup::deinit();
    618 }
    619 
    620 } // Functional
    621 } // gles2
    622 } // deqp
    623