13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 2.0 Module
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * -------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief State Query tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fIntegerStateQueryTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fApiCase.hpp"
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsStateQueryUtil.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluContextInfo.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw; // GLint and other GL types
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing deqp::gls::StateQueryUtil::StateQueryMemoryWriteGuard;
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef GL_SLUMINANCE_NV
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define	GL_SLUMINANCE_NV 0x8C46
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef GL_SLUMINANCE_ALPHA_NV
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define	GL_SLUMINANCE_ALPHA_NV 0x8C44
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef GL_BGR_NV
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define GL_BGR_NV 0x80E0
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace IntegerStateQueryVerifiers
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// StateVerifier
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StateVerifier : protected glu::CallLogWrapper
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						StateVerifier						(const glw::Functions& gl, tcu::TestLog& log, const char* testNamePostfix);
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual				~StateVerifier						(); // make GCC happy
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*			getTestNamePostfix					(void) const;
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyInteger						(tcu::TestContext& testCtx, GLenum name, GLint reference)																																= DE_NULL;
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyInteger4						(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2, GLint reference3)																		= DE_NULL;
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyInteger4Mask					(tcu::TestContext& testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1, bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3)	= DE_NULL;
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyIntegerGreaterOrEqual			(tcu::TestContext& testCtx, GLenum name, GLint reference)																																= DE_NULL;
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyUnsignedIntegerGreaterOrEqual	(tcu::TestContext& testCtx, GLenum name, GLuint reference)																																= DE_NULL;
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyIntegerGreaterOrEqual2		(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1)																											= DE_NULL;
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyIntegerAnyOf					(tcu::TestContext& testCtx, GLenum name, const GLint references[], size_t referencesLength)																								= DE_NULL;
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		verifyStencilMaskInitial			(tcu::TestContext& testCtx, GLenum name, int stencilBits)																																= DE_NULL;
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*	const	m_testNamePostfix;
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
783c827367444ee418f129b2c238299f49d3264554Jarkko PoyryStateVerifier::StateVerifier (const glw::Functions& gl, tcu::TestLog& log, const char* testNamePostfix)
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: glu::CallLogWrapper	(gl, log)
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_testNamePostfix		(testNamePostfix)
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enableLogging(true);
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
853c827367444ee418f129b2c238299f49d3264554Jarkko PoyryStateVerifier::~StateVerifier ()
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst char* StateVerifier::getTestNamePostfix (void) const
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return m_testNamePostfix;
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// GetBooleanVerifier
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass GetBooleanVerifier : public StateVerifier
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GetBooleanVerifier					(const glw::Functions& gl, tcu::TestLog& log);
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger						(tcu::TestContext& testCtx, GLenum name, GLint reference);
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger4						(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2, GLint reference3);
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger4Mask					(tcu::TestContext& testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1, bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3);
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerGreaterOrEqual			(tcu::TestContext& testCtx, GLenum name, GLint reference);
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyUnsignedIntegerGreaterOrEqual	(tcu::TestContext& testCtx, GLenum name, GLuint reference);
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerGreaterOrEqual2		(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1);
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerAnyOf					(tcu::TestContext& testCtx, GLenum name, const GLint references[], size_t referencesLength);
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyStencilMaskInitial			(tcu::TestContext& testCtx, GLenum name, int stencilBits);
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1103c827367444ee418f129b2c238299f49d3264554Jarkko PoyryGetBooleanVerifier::GetBooleanVerifier (const glw::Functions& gl, tcu::TestLog& log)
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: StateVerifier(gl, log, "_getboolean")
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyInteger (tcu::TestContext& testCtx, GLenum name, GLint reference)
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLboolean> state;
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetBooleanv(name, &state);
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const GLboolean expectedGLState = reference ? GL_TRUE : GL_FALSE;
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state != expectedGLState)
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected " << (expectedGLState==GL_TRUE ? "GL_TRUE" : "GL_FALSE") << "; got " << (state == GL_TRUE ? "GL_TRUE" : (state == GL_FALSE ? "GL_FALSE" : "non-boolean")) << TestLog::EndMessage;
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyInteger4 (tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2, GLint reference3)
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	verifyInteger4Mask(testCtx, name, reference0, true, reference1, true, reference2, true, reference3, true);
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyInteger4Mask (tcu::TestContext& testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1, bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3)
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLboolean[4]> boolVector4;
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetBooleanv(name, boolVector4);
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!boolVector4.verifyValidity(testCtx))
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const GLboolean referenceAsGLBoolean[] =
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		reference0 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		reference1 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		reference2 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		reference3 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((enableRef0 && (boolVector4[0] != referenceAsGLBoolean[0])) ||
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef1 && (boolVector4[1] != referenceAsGLBoolean[1])) ||
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef2 && (boolVector4[2] != referenceAsGLBoolean[2])) ||
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef3 && (boolVector4[3] != referenceAsGLBoolean[3])))
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected "
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef0 ? (referenceAsGLBoolean[0] ? "GL_TRUE" : "GL_FALSE") : " - ") << ", "
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef1 ? (referenceAsGLBoolean[1] ? "GL_TRUE" : "GL_FALSE") : " - ") << ", "
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef2 ? (referenceAsGLBoolean[2] ? "GL_TRUE" : "GL_FALSE") : " - ") << ", "
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef3 ? (referenceAsGLBoolean[3] ? "GL_TRUE" : "GL_FALSE") : " - ") << TestLog::EndMessage;
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyIntegerGreaterOrEqual (tcu::TestContext& testCtx, GLenum name, GLint reference)
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLboolean> state;
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetBooleanv(name, &state);
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state == GL_TRUE) // state is non-zero, could be greater than reference (correct)
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state == GL_FALSE) // state is zero
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (reference > 0) // and reference is greater than zero?
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE or GL_FALSE" << TestLog::EndMessage;
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyUnsignedIntegerGreaterOrEqual (tcu::TestContext& testCtx, GLenum name, GLuint reference)
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLboolean> state;
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetBooleanv(name, &state);
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state == GL_TRUE) // state is non-zero, could be greater than reference (correct)
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state == GL_FALSE) // state is zero
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (reference > 0) // and reference is greater than zero?
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE or GL_FALSE" << TestLog::EndMessage;
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyIntegerGreaterOrEqual2 (tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1)
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLboolean[2]> boolVector;
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetBooleanv(name, boolVector);
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!boolVector.verifyValidity(testCtx))
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const GLboolean referenceAsGLBoolean[2] =
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		reference0 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE,
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		reference1 ? (GLboolean)GL_TRUE : (GLboolean)GL_FALSE
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(referenceAsGLBoolean); ++ndx)
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (boolVector[ndx] == GL_TRUE) // state is non-zero, could be greater than any integer
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			continue;
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else if (boolVector[ndx] == GL_FALSE) // state is zero
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (referenceAsGLBoolean[ndx] > 0) // and reference is greater than zero?
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE or GL_FALSE" << TestLog::EndMessage;
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyIntegerAnyOf (tcu::TestContext& testCtx, GLenum name, const GLint references[], size_t referencesLength)
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLboolean> state;
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetBooleanv(name, &state);
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (size_t ndx = 0; ndx < referencesLength; ++ndx)
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLboolean expectedGLState = references[ndx] ? GL_TRUE : GL_FALSE;
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (state == expectedGLState)
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return;
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	testCtx.getLog() << TestLog::Message << "// ERROR: got " << (state==GL_TRUE ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetBooleanVerifier::verifyStencilMaskInitial (tcu::TestContext& testCtx, GLenum name, int stencilBits)
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// if stencilBits == 0, the mask is allowed to be either GL_TRUE or GL_FALSE
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// otherwise it must be GL_TRUE
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLboolean> state;
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetBooleanv(name, &state);
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (stencilBits > 0 && state != GL_TRUE)
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected GL_TRUE" << TestLog::EndMessage;
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid boolean value");
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry//GetIntegerVerifier
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass GetIntegerVerifier : public StateVerifier
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GetIntegerVerifier			(const glw::Functions& gl, tcu::TestLog& log);
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger						(tcu::TestContext& testCtx, GLenum name, GLint reference);
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger4						(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2, GLint reference3);
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger4Mask					(tcu::TestContext& testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1, bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3);
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerGreaterOrEqual			(tcu::TestContext& testCtx, GLenum name, GLint reference);
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyUnsignedIntegerGreaterOrEqual	(tcu::TestContext& testCtx, GLenum name, GLuint reference);
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerGreaterOrEqual2		(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1);
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerAnyOf					(tcu::TestContext& testCtx, GLenum name, const GLint references[], size_t referencesLength);
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyStencilMaskInitial			(tcu::TestContext& testCtx, GLenum name, int stencilBits);
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3333c827367444ee418f129b2c238299f49d3264554Jarkko PoyryGetIntegerVerifier::GetIntegerVerifier (const glw::Functions& gl, tcu::TestLog& log)
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: StateVerifier(gl, log, "_getinteger")
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyInteger (tcu::TestContext& testCtx, GLenum name, GLint reference)
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLint> state;
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetIntegerv(name, &state);
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state != reference)
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected " << reference << "; got " << state << TestLog::EndMessage;
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyInteger4 (tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2, GLint reference3)
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	verifyInteger4Mask(testCtx, name, reference0, true, reference1, true, reference2, true, reference3, true);
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyInteger4Mask (tcu::TestContext& testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1, bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3)
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLint[4]> intVector4;
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetIntegerv(name, intVector4);
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!intVector4.verifyValidity(testCtx))
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((enableRef0 && (intVector4[0] != reference0)) ||
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef1 && (intVector4[1] != reference1)) ||
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef2 && (intVector4[2] != reference2)) ||
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef3 && (intVector4[3] != reference3)))
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected "
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef0?"":"(") << reference0 << (enableRef0?"":")") << ", "
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef1?"":"(") << reference1 << (enableRef1?"":")") << ", "
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef2?"":"(") << reference2 << (enableRef2?"":")") << ", "
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef3?"":"(") << reference3 << (enableRef3?"":")")	<< TestLog::EndMessage;
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyIntegerGreaterOrEqual (tcu::TestContext& testCtx, GLenum name, GLint reference)
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLint> state;
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetIntegerv(name, &state);
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state < reference)
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << reference << "; got " << state << TestLog::EndMessage;
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyUnsignedIntegerGreaterOrEqual (tcu::TestContext& testCtx, GLenum name, GLuint reference)
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLint> state;
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetIntegerv(name, &state);
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (GLuint(state) < reference)
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << reference << "; got " << GLuint(state) << TestLog::EndMessage;
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyIntegerGreaterOrEqual2 (tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1)
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLint[2]> intVector2;
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetIntegerv(name, intVector2);
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!intVector2.verifyValidity(testCtx))
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (intVector2[0] < reference0 || intVector2[1] < reference1)
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << reference0 << ", " << reference1 << "; got " << intVector2[0] << ", " << intVector2[0] << TestLog::EndMessage;
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyIntegerAnyOf (tcu::TestContext& testCtx, GLenum name, const GLint references[], size_t referencesLength)
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLint> state;
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetIntegerv(name, &state);
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (size_t ndx = 0; ndx < referencesLength; ++ndx)
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLint expectedGLState = references[ndx];
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (state == expectedGLState)
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return;
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	testCtx.getLog() << TestLog::Message << "// ERROR: got " << state << TestLog::EndMessage;
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid integer value");
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetIntegerVerifier::verifyStencilMaskInitial (tcu::TestContext& testCtx, GLenum name, int stencilBits)
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLint> state;
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetIntegerv(name, &state);
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const GLint reference = (1 << stencilBits) - 1;
4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((state & reference) != reference) // the least significant stencilBits bits should be on
4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected minimum mask of " << reference << "; got " << state << TestLog::EndMessage;
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid mask value");
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry//GetFloatVerifier
4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass GetFloatVerifier : public StateVerifier
4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GetFloatVerifier					(const glw::Functions& gl, tcu::TestLog& log);
4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger						(tcu::TestContext& testCtx, GLenum name, GLint reference);
4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger4						(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2, GLint reference3);
4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyInteger4Mask					(tcu::TestContext& testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1, bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3);
4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerGreaterOrEqual			(tcu::TestContext& testCtx, GLenum name, GLint reference);
4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyUnsignedIntegerGreaterOrEqual	(tcu::TestContext& testCtx, GLenum name, GLuint reference);
4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerGreaterOrEqual2		(tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1);
4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyIntegerAnyOf					(tcu::TestContext& testCtx, GLenum name, const GLint references[], size_t referencesLength);
4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void	verifyStencilMaskInitial			(tcu::TestContext& testCtx, GLenum name, int stencilBits);
4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5013c827367444ee418f129b2c238299f49d3264554Jarkko PoyryGetFloatVerifier::GetFloatVerifier (const glw::Functions& gl, tcu::TestLog& log)
5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: StateVerifier(gl, log, "_getfloat")
5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyInteger (tcu::TestContext& testCtx, GLenum name, GLint reference)
5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const GLfloat referenceAsFloat = GLfloat(reference);
5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(reference == GLint(referenceAsFloat)); // reference integer must have 1:1 mapping to float for this to work. Reference value is always such value in these tests
5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLfloat> state;
5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetFloatv(name, &state);
5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state != referenceAsFloat)
5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected " << referenceAsFloat << "; got " << state << TestLog::EndMessage;
5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyInteger4 (tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1, GLint reference2, GLint reference3)
5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	verifyInteger4Mask(testCtx, name, reference0, true, reference1, true, reference2, true, reference3, true);
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyInteger4Mask (tcu::TestContext& testCtx, GLenum name, GLint reference0, bool enableRef0, GLint reference1, bool enableRef1, GLint reference2, bool enableRef2, GLint reference3, bool enableRef3)
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLfloat[4]> floatVector4;
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetFloatv(name, floatVector4);
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!floatVector4.verifyValidity(testCtx))
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((enableRef0 && (floatVector4[0] != GLfloat(reference0))) ||
5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef1 && (floatVector4[1] != GLfloat(reference1))) ||
5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef2 && (floatVector4[2] != GLfloat(reference2))) ||
5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		(enableRef3 && (floatVector4[3] != GLfloat(reference3))))
5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected "
5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef0?"":"(") << GLfloat(reference0) << (enableRef0?"":")") << ", "
5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef1?"":"(") << GLfloat(reference1) << (enableRef1?"":")") << ", "
5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef2?"":"(") << GLfloat(reference2) << (enableRef2?"":")") << ", "
5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (enableRef3?"":"(") << GLfloat(reference3) << (enableRef3?"":")") << TestLog::EndMessage;
5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyIntegerGreaterOrEqual (tcu::TestContext& testCtx, GLenum name, GLint reference)
5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLfloat> state;
5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetFloatv(name, &state);
5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (state < GLfloat(reference))
5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << GLfloat(reference) << "; got " << state << TestLog::EndMessage;
5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyUnsignedIntegerGreaterOrEqual (tcu::TestContext& testCtx, GLenum name, GLuint reference)
5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLfloat> state;
5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetFloatv(name, &state);
5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (GLuint(state) < GLfloat(reference))
5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << GLfloat(reference) << "; got " << GLuint(state) << TestLog::EndMessage;
5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyIntegerGreaterOrEqual2 (tcu::TestContext& testCtx, GLenum name, GLint reference0, GLint reference1)
5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLfloat[2]> floatVector2;
5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetFloatv(name, floatVector2);
6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!floatVector2.verifyValidity(testCtx))
6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (floatVector2[0] < GLfloat(reference0) || floatVector2[1] < GLfloat(reference1))
6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.getLog() << TestLog::Message << "// ERROR: expected greater or equal to " << GLfloat(reference0) << ", " << GLfloat(reference1) << "; got " << floatVector2[0] << ", " << floatVector2[1] << TestLog::EndMessage;
6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyIntegerAnyOf (tcu::TestContext& testCtx, GLenum name, const GLint references[], size_t referencesLength)
6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::TestLog;
6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateQueryMemoryWriteGuard<GLfloat> state;
6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glGetFloatv(name, &state);
6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!state.verifyValidity(testCtx))
6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return;
6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (size_t ndx = 0; ndx < referencesLength; ++ndx)
6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLfloat expectedGLState = GLfloat(references[ndx]);
6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DE_ASSERT(references[ndx] == GLint(expectedGLState)); // reference integer must have 1:1 mapping to float for this to work. Reference value is always such value in these tests
6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (state == expectedGLState)
6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return;
6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	testCtx.getLog() << TestLog::Message << "// ERROR: got " << state << TestLog::EndMessage;
6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (testCtx.getTestResult() == QP_TEST_RESULT_PASS)
6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got invalid float value");
6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid GetFloatVerifier::verifyStencilMaskInitial (tcu::TestContext& testCtx, GLenum name, int stencilBits)
6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// checking the mask bits with float doesn't make much sense because of conversion errors
6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// just verify that the value is greater or equal to the minimum value
6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const GLint reference = (1 << stencilBits) - 1;
6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	verifyIntegerGreaterOrEqual(testCtx, name, reference);
6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // IntegerStateQueryVerifiers
6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace IntegerStateQueryVerifiers;
6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* testVertSource					=	"void main (void)\n"
6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														"{\n"
6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														"	gl_Position = vec4(0.0);\n"
6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														"}\n";
6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* testFragSource					=	"void main (void)\n"
6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														"{\n"
6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														"	gl_FragColor = vec4(0.0);\n"
6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														"}\n";
6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ConstantMinimumValueTestCase : public ApiCase
6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ConstantMinimumValueTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum targetName, GLint minValue)
6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_targetName	(targetName)
6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_minValue	(minValue)
6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyUnsignedIntegerGreaterOrEqual(m_testCtx, m_targetName, m_minValue);
6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum			m_targetName;
6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLint			m_minValue;
6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SampleBuffersTestCase : public ApiCase
6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SampleBuffersTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int expectedSampleBuffers = (m_context.getRenderTarget().getNumSamples() > 1) ? 1 : 0;
6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_log << tcu::TestLog::Message << "Sample count is " << (m_context.getRenderTarget().getNumSamples()) << ", expecting GL_SAMPLE_BUFFERS to be " << expectedSampleBuffers << tcu::TestLog::EndMessage;
6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_SAMPLE_BUFFERS, expectedSampleBuffers);
6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SamplesTestCase : public ApiCase
7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SamplesTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// MSAA?
7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_context.getRenderTarget().getNumSamples() > 1)
7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_log << tcu::TestLog::Message << "Sample count is " << (m_context.getRenderTarget().getNumSamples()) << tcu::TestLog::EndMessage;
7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_SAMPLES, m_context.getRenderTarget().getNumSamples());
7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const glw::GLint validSamples[] = {0, 1};
7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_log << tcu::TestLog::Message << "Expecting GL_SAMPLES to be 0 or 1" << tcu::TestLog::EndMessage;
7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyIntegerAnyOf(m_testCtx, GL_SAMPLES, validSamples, DE_LENGTH_OF_ARRAY(validSamples));
7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass HintTestCase : public ApiCase
7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	HintTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum targetName)
7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_targetName	(targetName)
7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_targetName, GL_DONT_CARE);
7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glHint(m_targetName, GL_NICEST);
7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_targetName, GL_NICEST);
7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glHint(m_targetName, GL_FASTEST);
7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_targetName, GL_FASTEST);
7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glHint(m_targetName, GL_DONT_CARE);
7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_targetName, GL_DONT_CARE);
7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_targetName;
7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass DepthFuncTestCase : public ApiCase
7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DepthFuncTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_DEPTH_FUNC, GL_LESS);
7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum depthFunctions[] = {GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GREATER, GL_GEQUAL, GL_NOTEQUAL};
7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(depthFunctions); ndx++)
7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glDepthFunc(depthFunctions[ndx]);
7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_DEPTH_FUNC, depthFunctions[ndx]);
7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CullFaceTestCase : public ApiCase
8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8043c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CullFaceTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_CULL_FACE_MODE, GL_BACK);
8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum cullFaces[] = {GL_FRONT, GL_BACK, GL_FRONT_AND_BACK};
8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(cullFaces); ndx++)
8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glCullFace(cullFaces[ndx]);
8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
8213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_CULL_FACE_MODE, cullFaces[ndx]);
8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
8293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FrontFaceTestCase : public ApiCase
8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FrontFaceTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_FRONT_FACE, GL_CCW);
8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum frontFaces[] = {GL_CW, GL_CCW};
8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(frontFaces); ndx++)
8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glFrontFace(frontFaces[ndx]);
8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_FRONT_FACE, frontFaces[ndx]);
8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ViewPortTestCase : public ApiCase
8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
8633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ViewPortTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		de::Random rnd(0xabcdef);
8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLint maxViewportDimensions[2] = {0};
8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glGetIntegerv(GL_MAX_VIEWPORT_DIMS, maxViewportDimensions);
8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// verify initial value of first two values
8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT, 0, 0, m_context.getRenderTarget().getWidth(), m_context.getRenderTarget().getHeight());
8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int numIterations = 120;
8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int i = 0; i < numIterations; ++i)
8823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint x			= rnd.getInt(-64000, 64000);
8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint y			= rnd.getInt(-64000, 64000);
8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLsizei width	= rnd.getInt(0, maxViewportDimensions[0]);
8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLsizei height	= rnd.getInt(0, maxViewportDimensions[1]);
8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glViewport(x, y, width, height);
8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger4(m_testCtx, GL_VIEWPORT, x, y, width, height);
8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ScissorBoxTestCase : public ApiCase
8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ScissorBoxTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		de::Random rnd(0xabcdef);
9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// verify initial value
9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger4(m_testCtx, GL_SCISSOR_BOX, 0, 0, m_context.getRenderTarget().getWidth(), m_context.getRenderTarget().getHeight());
9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int numIterations = 120;
9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int i = 0; i < numIterations; ++i)
9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint left		= rnd.getInt(-64000, 64000);
9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint bottom	= rnd.getInt(-64000, 64000);
9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLsizei width	= rnd.getInt(0, 64000);
9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLsizei height	= rnd.getInt(0, 64000);
9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glScissor(left, bottom, width, height);
9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger4(m_testCtx, GL_SCISSOR_BOX, left, bottom, width, height);
9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
9303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MaxViewportDimsTestCase : public ApiCase
9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MaxViewportDimsTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual2(m_testCtx, GL_MAX_VIEWPORT_DIMS, m_context.getRenderTarget().getWidth(), m_context.getRenderTarget().getHeight());
9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilRefTestCase : public ApiCase
9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilRefTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName)
9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase			(context, name, description)
9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier		(verifier)
9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName	(testTargetName)
9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
9613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testTargetName, 0);
9633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
9643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int stencilBits = m_context.getRenderTarget().getStencilBits();
9663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
9683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
9693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int ref = 1 << stencilBit;
9703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFunc(GL_ALWAYS, ref, 0); // mask should not affect the REF
9723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
9733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
9753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
9763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFunc(GL_ALWAYS, ref, ref);
9783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
9793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
9813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
9823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
9833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
9863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
9873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testTargetName;
9883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
9893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilRefSeparateTestCase : public ApiCase
9913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9923c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
9933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilRefSeparateTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, GLenum stencilFuncTargetFace)
9943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase					(context, name, description)
9953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier				(verifier)
9963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName			(testTargetName)
9973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_stencilFuncTargetFace	(stencilFuncTargetFace)
9983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
10003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
10023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
10033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testTargetName, 0);
10043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
10053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int stencilBits = m_context.getRenderTarget().getStencilBits();
10073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
10093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
10103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int ref = 1 << stencilBit;
10113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFuncSeparate(m_stencilFuncTargetFace, GL_ALWAYS, ref, 0);
10133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
10143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
10163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
10173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFuncSeparate(m_stencilFuncTargetFace, GL_ALWAYS, ref, ref);
10193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
10203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, ref);
10223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
10233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
10243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
10253c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
10263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
10273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testTargetName;
10283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_stencilFuncTargetFace;
10293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
10303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilOpTestCase : public ApiCase
10323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
10343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilOpTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum stencilOpName)
10353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase					(context, name, description)
10363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier				(verifier)
10373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_stencilOpName			(stencilOpName)
10383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
10393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
10403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
10423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
10433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_stencilOpName, GL_KEEP);
10443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
10453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum stencilOpValues[] = {GL_KEEP, GL_ZERO, GL_REPLACE, GL_INCR, GL_DECR, GL_INVERT, GL_INCR_WRAP, GL_DECR_WRAP};
10473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilOpValues); ++ndx)
10493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
10503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			SetStencilOp(stencilOpValues[ndx]);
10513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
10523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_stencilOpName, stencilOpValues[ndx]);
10543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
10553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
10563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
10573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
10593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void SetStencilOp (GLenum stencilOpValue)
10603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
10613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		switch (m_stencilOpName)
10623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
10633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_FAIL:
10643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_BACK_FAIL:
10653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilOp(stencilOpValue, GL_KEEP, GL_KEEP);
10663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
10673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_PASS_DEPTH_FAIL:
10693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
10703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilOp(GL_KEEP, stencilOpValue, GL_KEEP);
10713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
10723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_PASS_DEPTH_PASS:
10743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_BACK_PASS_DEPTH_PASS:
10753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilOp(GL_KEEP, GL_KEEP, stencilOpValue);
10763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
10773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
10793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(false && "should not happen");
10803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
10813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
10823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
10833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*				m_verifier;
10853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum					m_stencilOpName;
10863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
10873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilOpSeparateTestCase : public StencilOpTestCase
10893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10903c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
10913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilOpSeparateTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum stencilOpName, GLenum stencilOpFace)
10923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: StencilOpTestCase		(context, verifier, name, description, stencilOpName)
10933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_stencilOpFace		(stencilOpFace)
10943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
10953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
10963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
10983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void SetStencilOp (GLenum stencilOpValue)
10993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		switch (m_stencilOpName)
11013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
11023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_FAIL:
11033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_BACK_FAIL:
11043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilOpSeparate(m_stencilOpFace, stencilOpValue, GL_KEEP, GL_KEEP);
11053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
11063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_PASS_DEPTH_FAIL:
11083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
11093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilOpSeparate(m_stencilOpFace, GL_KEEP, stencilOpValue, GL_KEEP);
11103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
11113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_PASS_DEPTH_PASS:
11133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_STENCIL_BACK_PASS_DEPTH_PASS:
11143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilOpSeparate(m_stencilOpFace, GL_KEEP, GL_KEEP, stencilOpValue);
11153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
11163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
11183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(false && "should not happen");
11193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
11203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
11213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
11223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_stencilOpFace;
11243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
11253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilFuncTestCase : public ApiCase
11273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11283c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
11293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilFuncTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
11303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
11313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
11323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
11343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
11363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_STENCIL_FUNC, GL_ALWAYS);
11383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
11393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum stencilfuncValues[] = {GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, GL_NOTEQUAL};
11413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilfuncValues); ++ndx)
11433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
11443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFunc(stencilfuncValues[ndx], 0, 0);
11453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
11463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_STENCIL_FUNC, stencilfuncValues[ndx]);
11483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
11493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_STENCIL_BACK_FUNC, stencilfuncValues[ndx]);
11513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
11523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
11533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
11543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
11553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
11563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
11573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilFuncSeparateTestCase : public ApiCase
11593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11603c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
11613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilFuncSeparateTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum stencilFuncName, GLenum stencilFuncFace)
11623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase			(context, name, description)
11633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier		(verifier)
11643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_stencilFuncName	(stencilFuncName)
11653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_stencilFuncFace	(stencilFuncFace)
11663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
11683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
11703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_stencilFuncName, GL_ALWAYS);
11723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
11733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum stencilfuncValues[] = {GL_NEVER, GL_ALWAYS, GL_LESS, GL_LEQUAL, GL_EQUAL, GL_GEQUAL, GL_GREATER, GL_NOTEQUAL};
11753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilfuncValues); ++ndx)
11773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
11783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFuncSeparate(m_stencilFuncFace, stencilfuncValues[ndx], 0, 0);
11793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
11803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_stencilFuncName, stencilfuncValues[ndx]);
11823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
11833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
11843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
11853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
11863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
11873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_stencilFuncName;
11883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_stencilFuncFace;
11893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
11903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilMaskTestCase : public ApiCase
11923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11933c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
11943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilMaskTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName)
11953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase			(context, name, description)
11963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier		(verifier)
11973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName	(testTargetName)
11983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
12023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int stencilBits = m_context.getRenderTarget().getStencilBits();
12043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyStencilMaskInitial(m_testCtx, m_testTargetName, stencilBits);
12063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
12073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
12093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
12103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int mask = 1 << stencilBit;
12113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFunc(GL_ALWAYS, 0, mask);
12133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
12143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
12163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
12173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
12183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
12203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
12213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testTargetName;
12223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
12233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12243c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilMaskSeparateTestCase : public ApiCase
12253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12263c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
12273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilMaskSeparateTestCase	(Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, GLenum stencilFuncTargetFace)
12283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase					(context, name, description)
12293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier				(verifier)
12303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName			(testTargetName)
12313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_stencilFuncTargetFace	(stencilFuncTargetFace)
12323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
12363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int stencilBits = m_context.getRenderTarget().getStencilBits();
12383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyStencilMaskInitial(m_testCtx, m_testTargetName, stencilBits);
12403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
12413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
12433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
12443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int mask = 1 << stencilBit;
12453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilFuncSeparate(m_stencilFuncTargetFace, GL_ALWAYS, 0, mask);
12473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
12483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
12503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
12513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
12523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
12543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
12553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testTargetName;
12563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_stencilFuncTargetFace;
12573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
12583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilWriteMaskTestCase : public ApiCase
12603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
12623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilWriteMaskTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName)
12633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase			(context, name, description)
12643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier		(verifier)
12653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName	(testTargetName)
12663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
12703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int stencilBits = m_context.getRenderTarget().getStencilBits();
12723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
12743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
12753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int mask = 1 << stencilBit;
12763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilMask(mask);
12783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
12793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
12813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
12823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
12833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12843c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
12853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
12863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testTargetName;
12873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
12883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilWriteMaskSeparateTestCase : public ApiCase
12903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12913c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
12923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilWriteMaskSeparateTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, GLenum stencilTargetFace)
12933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase				(context, name, description)
12943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier			(verifier)
12953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName		(testTargetName)
12963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_stencilTargetFace	(stencilTargetFace)
12973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
13013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int stencilBits = m_context.getRenderTarget().getStencilBits();
13033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
13053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
13063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int mask = 1 << stencilBit;
13073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glStencilMaskSeparate(m_stencilTargetFace, mask);
13093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
13103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, mask);
13123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
13133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
13143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
13153c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
13163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
13173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testTargetName;
13183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_stencilTargetFace;
13193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
13203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass PixelStoreAlignTestCase : public ApiCase
13223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
13233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
13243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	PixelStoreAlignTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName)
13253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase			(context, name, description)
13263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier		(verifier)
13273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName	(testTargetName)
13283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
13303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
13323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testTargetName, 4);
13343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
13353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int alignments[] = {1, 2, 4, 8};
13373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(alignments); ++ndx)
13393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
13403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int referenceValue = alignments[ndx];
13413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glPixelStorei(m_testTargetName, referenceValue);
13433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
13443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, referenceValue);
13463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
13473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
13483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
13493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
13513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
13523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testTargetName;
13533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
13543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BlendFuncTestCase : public ApiCase
13563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
13573c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
13583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	BlendFuncTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, int initialValue)
13593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase			(context, name, description)
13603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier		(verifier)
13613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName	(testTargetName)
13623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_initialValue	(initialValue)
13633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
13653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
13673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testTargetName, m_initialValue);
13693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
13703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum blendFuncValues[] =
13723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
13733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR,
13743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_CONSTANT_COLOR,
13753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GL_ONE_MINUS_CONSTANT_COLOR, GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA,
13763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GL_SRC_ALPHA_SATURATE
13773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
13783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(blendFuncValues); ++ndx)
13803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
13813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const GLenum referenceValue = blendFuncValues[ndx];
13823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			//GL_SRC_ALPHA_SATURATE is ony allowed for srcRGB or srcA
13843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (referenceValue == GL_SRC_ALPHA_SATURATE &&
13853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				!(m_testTargetName == GL_BLEND_SRC_RGB || m_testTargetName == GL_BLEND_SRC_ALPHA))
13863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				continue;
13873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			SetBlendFunc(referenceValue);
13893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
13903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, referenceValue);
13923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
13933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
13943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
13953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
13963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void SetBlendFunc (GLenum func)
13973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		switch (m_testTargetName)
13993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
14003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_SRC_RGB:
14013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_SRC_ALPHA:
14023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendFunc(func, GL_ZERO);
14033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_DST_RGB:
14063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_DST_ALPHA:
14073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendFunc(GL_ZERO, func);
14083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
14113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(false && "should not happen");
14123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
14143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
14153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*		m_verifier;
14173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum			m_testTargetName;
14183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int				m_initialValue;
14193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
14203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BlendFuncSeparateTestCase : public BlendFuncTestCase
14223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
14243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	BlendFuncSeparateTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, int initialValue)
14253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: BlendFuncTestCase	(context, verifier, name, description, testTargetName, initialValue)
14263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
14273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
14283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void SetBlendFunc (GLenum func)
14303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
14313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		switch (m_testTargetName)
14323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
14333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_SRC_RGB:
14343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendFuncSeparate(func, GL_ZERO, GL_ZERO, GL_ZERO);
14353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_DST_RGB:
14383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendFuncSeparate(GL_ZERO, func, GL_ZERO, GL_ZERO);
14393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_SRC_ALPHA:
14423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendFuncSeparate(GL_ZERO, GL_ZERO, func, GL_ZERO);
14433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_DST_ALPHA:
14463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendFuncSeparate(GL_ZERO, GL_ZERO, GL_ZERO, func);
14473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
14503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(false && "should not happen");
14513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
14523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
14533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
14543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
14553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BlendEquationTestCase : public ApiCase
14573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14583c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
14593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	BlendEquationTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, int initialValue)
14603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase			(context, name, description)
14613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier		(verifier)
14623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName	(testTargetName)
14633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_initialValue	(initialValue)
14643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
14653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
14663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
14683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
14693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testTargetName, m_initialValue);
14703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
14713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLenum blendFuncValues[] =
14733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
14743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GL_FUNC_ADD, GL_FUNC_SUBTRACT, GL_FUNC_REVERSE_SUBTRACT
14753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
14763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(blendFuncValues); ++ndx)
14783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
14793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const GLenum referenceValue = blendFuncValues[ndx];
14803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			SetBlendEquation(referenceValue);
14823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
14833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, m_testTargetName, referenceValue);
14853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
14863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
14873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
14883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
14893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void SetBlendEquation (GLenum equation)
14903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
14913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glBlendEquation(equation);
14923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
14933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*		m_verifier;
14953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum			m_testTargetName;
14963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int				m_initialValue;
14973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
14983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BlendEquationSeparateTestCase : public BlendEquationTestCase
15003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
15013c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
15023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	BlendEquationSeparateTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, int initialValue)
15033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: BlendEquationTestCase	(context, verifier, name, description, testTargetName, initialValue)
15043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
15053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
15063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15073c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
15083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void SetBlendEquation (GLenum equation)
15093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
15103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		switch (m_testTargetName)
15113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
15123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_EQUATION_RGB:
15133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendEquationSeparate(equation, GL_FUNC_ADD);
15143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
15153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_BLEND_EQUATION_ALPHA:
15173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glBlendEquationSeparate(GL_FUNC_ADD, equation);
15183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
15193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
15213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(false && "should not happen");
15223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
15233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
15243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
15253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
15263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15273c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ImplementationArrayTestCase : public ApiCase
15283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
15293c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
15303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ImplementationArrayTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testTargetName, GLenum testTargetLengthTargetName, int minValue)
15313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase						(context, name, description)
15323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier					(verifier)
15333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetName				(testTargetName)
15343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testTargetLengthTargetName	(testTargetLengthTargetName)
15353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_minValue					(minValue)
15363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
15373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
15383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
15403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
15413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, m_testTargetLengthTargetName, m_minValue);
15423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
15433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLint targetArrayLength = 0;
15453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glGetIntegerv(m_testTargetLengthTargetName, &targetArrayLength);
15463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
15473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (targetArrayLength)
15493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
15503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			std::vector<GLint> queryResult;
15513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			queryResult.resize(targetArrayLength, 0);
15523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glGetIntegerv(m_testTargetName, &queryResult[0]);
15543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
15553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
15563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
15573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
15593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*		m_verifier;
15603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum			m_testTargetName;
15613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum			m_testTargetLengthTargetName;
15623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int				m_minValue;
15633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
15643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CurrentProgramBindingTestCase : public ApiCase
15663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
15673c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
15683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CurrentProgramBindingTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
15693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
15703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
15713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
15723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
15733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
15753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
15763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_CURRENT_PROGRAM, 0);
15773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
15783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
15803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLuint shaderVert = glCreateShader(GL_VERTEX_SHADER);
15813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glShaderSource(shaderVert, 1, &testVertSource, DE_NULL);
15823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glCompileShader(shaderVert);
15833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
15843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint compileStatus;
15853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glGetShaderiv(shaderVert, GL_COMPILE_STATUS, &compileStatus);
15863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			checkBooleans(compileStatus, GL_TRUE);
15873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLuint shaderFrag = glCreateShader(GL_FRAGMENT_SHADER);
15893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glShaderSource(shaderFrag, 1, &testFragSource, DE_NULL);
15903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glCompileShader(shaderFrag);
15913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
15923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glGetShaderiv(shaderFrag, GL_COMPILE_STATUS, &compileStatus);
15933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			checkBooleans(compileStatus, GL_TRUE);
15943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLuint shaderProg = glCreateProgram();
15963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glAttachShader(shaderProg, shaderVert);
15973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glAttachShader(shaderProg, shaderFrag);
15983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glLinkProgram(shaderProg);
15993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
16003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint linkStatus;
16013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glGetProgramiv(shaderProg, GL_LINK_STATUS, &linkStatus);
16023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			checkBooleans(linkStatus, GL_TRUE);
16033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glUseProgram(shaderProg);
16053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
16063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_CURRENT_PROGRAM, shaderProg);
16083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
16093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glDeleteShader(shaderVert);
16113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glDeleteShader(shaderFrag);
16123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glDeleteProgram(shaderProg);
16133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
16143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_CURRENT_PROGRAM, shaderProg);
16163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
16173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
16183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glUseProgram(0);
16203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
16213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_CURRENT_PROGRAM, 0);
16223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
16233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
16243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16253c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
16263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*		m_verifier;
16273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
16283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BufferBindingTestCase : public ApiCase
16303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
16313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
16323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	BufferBindingTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum bufferBindingName, GLenum bufferType)
16333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase				(context, name, description)
16343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier			(verifier)
16353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_bufferBindingName	(bufferBindingName)
16363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_bufferType			(bufferType)
16373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
16383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
16393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
16413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
16423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_bufferBindingName, 0);
16433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
16443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLuint bufferObject = 0;
16463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glGenBuffers(1, &bufferObject);
16473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
16483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glBindBuffer(m_bufferType, bufferObject);
16503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_bufferBindingName, bufferObject);
16513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
16523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glDeleteBuffers(1, &bufferObject);
16543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_bufferBindingName, 0);
16553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
16563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
16573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
16593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*		m_verifier;
16603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum			m_bufferBindingName;
16613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum			m_bufferType;
16623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
16633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StencilClearValueTestCase : public ApiCase
16653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
16663c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
16673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StencilClearValueTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
16683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
16693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
16703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
16713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
16723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
16743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
16753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_STENCIL_CLEAR_VALUE, 0);
16763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
16773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int stencilBits = m_context.getRenderTarget().getStencilBits();
16793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int stencilBit = 0; stencilBit < stencilBits; ++stencilBit)
16813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
16823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int ref = 1 << stencilBit;
16833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glClearStencil(ref);
16853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
16863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_STENCIL_CLEAR_VALUE, ref);
16883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
16893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
16903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
16913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
16933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
16943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
16953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
16963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ActiveTextureTestCase : public ApiCase
16973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
16983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
16993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ActiveTextureTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
17003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
17013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
17023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
17033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
17043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
17063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
17073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_ACTIVE_TEXTURE, GL_TEXTURE0);
17083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLint textureUnits = 0;
17113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &textureUnits);
17123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < textureUnits; ++ndx)
17153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
17163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glActiveTexture(GL_TEXTURE0 + ndx);
17173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
17183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_verifier->verifyInteger(m_testCtx, GL_ACTIVE_TEXTURE, GL_TEXTURE0 + ndx);
17203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			expectError(GL_NO_ERROR);
17213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
17223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
17233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17243c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
17253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*		m_verifier;
17263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
17273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17283c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RenderbufferBindingTestCase : public ApiCase
17293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
17303c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
17313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RenderbufferBindingTestCase	(Context& context, StateVerifier* verifier, const char* name, const char* description)
17323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
17333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
17343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
17353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
17363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
17383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
17393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_RENDERBUFFER_BINDING, 0);
17403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLuint renderBuffer = 0;
17433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glGenRenderbuffers(1, &renderBuffer);
17443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glBindRenderbuffer(GL_RENDERBUFFER, renderBuffer);
17473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_RENDERBUFFER_BINDING, renderBuffer);
17503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glDeleteRenderbuffers(1, &renderBuffer);
17533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_RENDERBUFFER_BINDING, 0);
17543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
17563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
17583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*		m_verifier;
17593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
17603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass TextureBindingTestCase : public ApiCase
17623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
17633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
17643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TextureBindingTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description, GLenum testBindingName, GLenum textureType)
17653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase				(context, name, description)
17663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier			(verifier)
17673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_testBindingName		(testBindingName)
17683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_textureType			(textureType)
17693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
17703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
17713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
17733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
17743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testBindingName, 0);
17753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLuint texture = 0;
17783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glGenTextures(1, &texture);
17793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glBindTexture(m_textureType, texture);
17823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testBindingName, texture);
17833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glDeleteTextures(1, &texture);
17853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, m_testBindingName, 0);
17883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
17893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
17903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
17913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
17923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_testBindingName;
17933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLenum		m_textureType;
17943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
17953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FrameBufferBindingTestCase : public ApiCase
17973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
17983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
17993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FrameBufferBindingTestCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
18003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
18013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
18023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
18033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
18043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
18063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
18073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_FRAMEBUFFER_BINDING, 0);
18083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLuint framebufferId = 0;
18113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glGenFramebuffers(1, &framebufferId);
18123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
18153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_FRAMEBUFFER_BINDING, framebufferId);
18183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glBindFramebuffer(GL_FRAMEBUFFER, 0);
18213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_FRAMEBUFFER_BINDING, 0);
18243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glBindFramebuffer(GL_FRAMEBUFFER, framebufferId);
18273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glDeleteFramebuffers(1, &framebufferId);
18283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyInteger(m_testCtx, GL_FRAMEBUFFER_BINDING, 0);
18313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
18323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
18333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
18353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
18363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
18373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ImplementationColorReadTestCase : public ApiCase
18393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
18403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
18413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ImplementationColorReadTestCase	(Context& context, StateVerifier* verifier, const char* name, const char* description)
18423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
18433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
18443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
18453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
18463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
18483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
18493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLint defaultColorTypes[] =
18503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
18513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_5_6_5
18523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
18533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const GLint defaultColorFormats[] =
18543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
18553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GL_RGBA, GL_RGB, GL_ALPHA
18563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
18573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::vector<GLint> validColorTypes;
18593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::vector<GLint> validColorFormats;
18603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Defined by the spec
18623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(defaultColorTypes); ++ndx)
18643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorTypes.push_back(defaultColorTypes[ndx]);
18653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(defaultColorFormats); ++ndx)
18663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(defaultColorFormats[ndx]);
18673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Extensions
18693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_format_BGRA8888") ||
18713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_context.getContextInfo().isExtensionSupported("GL_APPLE_texture_format_BGRA8888"))
18723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_BGRA);
18733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_context.getContextInfo().isExtensionSupported("GL_EXT_read_format_bgra"))
18753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
18763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_BGRA);
18773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorTypes.push_back(GL_UNSIGNED_SHORT_4_4_4_4_REV);
18783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorTypes.push_back(GL_UNSIGNED_SHORT_1_5_5_5_REV);
18793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
18803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_context.getContextInfo().isExtensionSupported("GL_IMG_read_format"))
18823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
18833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_BGRA);
18843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorTypes.push_back(GL_UNSIGNED_SHORT_4_4_4_4_REV);
18853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
18863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_context.getContextInfo().isExtensionSupported("GL_NV_sRGB_formats"))
18883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
18893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_SLUMINANCE_NV);
18903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_SLUMINANCE_ALPHA_NV);
18913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
18923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_context.getContextInfo().isExtensionSupported("GL_NV_bgr"))
18943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
18953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_BGR_NV);
18963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
18973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
18983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_context.getContextInfo().isExtensionSupported("GL_EXT_texture_rg"))
18993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
19003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_RED);
19013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			validColorFormats.push_back(GL_RG);
19023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
19033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerAnyOf(m_testCtx, GL_IMPLEMENTATION_COLOR_READ_TYPE,	&validColorTypes[0],	validColorTypes.size());
19053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerAnyOf(m_testCtx, GL_IMPLEMENTATION_COLOR_READ_FORMAT,	&validColorFormats[0],	validColorFormats.size());
19063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
19073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
19083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
19103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
19113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
19123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19133c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass BufferComponentSizeCase : public ApiCase
19143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
19153c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
19163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	BufferComponentSizeCase (Context& context, StateVerifier* verifier, const char* name, const char* description)
19173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: ApiCase		(context, name, description)
19183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_verifier	(verifier)
19193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
19203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
19213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void test (void)
19233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
19243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_RED_BITS,		m_context.getRenderTarget().getPixelFormat().redBits);
19253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_BLUE_BITS,	m_context.getRenderTarget().getPixelFormat().blueBits);
19263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_GREEN_BITS,	m_context.getRenderTarget().getPixelFormat().greenBits);
19273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_ALPHA_BITS,	m_context.getRenderTarget().getPixelFormat().alphaBits);
19283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
19293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_DEPTH_BITS,	m_context.getRenderTarget().getDepthBits());
19313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifier->verifyIntegerGreaterOrEqual(m_testCtx, GL_STENCIL_BITS,	m_context.getRenderTarget().getStencilBits());
19323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		expectError(GL_NO_ERROR);
19333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
19343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
19353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier*	m_verifier;
19363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
19373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define FOR_EACH_VERIFIER(VERIFIERS, CODE_BLOCK)												\
19393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int _verifierNdx = 0; _verifierNdx < DE_LENGTH_OF_ARRAY(VERIFIERS); _verifierNdx++)	\
19403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{																							\
19413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		StateVerifier* verifier = VERIFIERS[_verifierNdx];										\
19423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		CODE_BLOCK;																				\
19433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
19443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
19463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19473c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIntegerStateQueryTests::IntegerStateQueryTests (Context& context)
19483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup			(context, "integers", "Integer Values")
19493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_verifierBoolean		(DE_NULL)
19503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_verifierInteger		(DE_NULL)
19513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_verifierFloat		(DE_NULL)
19523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
19533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
19543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19553c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIntegerStateQueryTests::~IntegerStateQueryTests (void)
19563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
19573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deinit();
19583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
19593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid IntegerStateQueryTests::init (void)
19613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
19623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(m_verifierBoolean == DE_NULL);
19633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(m_verifierInteger == DE_NULL);
19643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(m_verifierFloat == DE_NULL);
19653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_verifierBoolean		= new GetBooleanVerifier	(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
19673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_verifierInteger		= new GetIntegerVerifier	(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
19683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_verifierFloat			= new GetFloatVerifier		(m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog());
19693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const struct LimitedStateInteger
19713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
19723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*		name;
19733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*		description;
19743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLenum			targetName;
19753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLint			value;
19763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	} implementationMinLimits[] =
19773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
19783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "subpixel_bits",						"SUBPIXEL_BITS has  a minimum value of 4",						GL_SUBPIXEL_BITS,						4	},
19793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_texture_size",					"MAX_TEXTURE_SIZE has  a minimum value of 64",					GL_MAX_TEXTURE_SIZE,					64	},
19803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_cube_map_texture_size",			"MAX_CUBE_MAP_TEXTURE_SIZE has  a minimum value of 16",			GL_MAX_CUBE_MAP_TEXTURE_SIZE,			16	},
19813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_vertex_attribs",					"MAX_VERTEX_ATTRIBS has  a minimum value of 8",					GL_MAX_VERTEX_ATTRIBS,					8	},
19823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_vertex_uniform_vectors",			"MAX_VERTEX_UNIFORM_VECTORS has  a minimum value of 128",		GL_MAX_VERTEX_UNIFORM_VECTORS,			128	},
19833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_varying_vectors",				"MAX_VARYING_VECTORS has  a minimum value of 8",				GL_MAX_VARYING_VECTORS,					8	},
19843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_combined_texture_image_units",	"MAX_COMBINED_TEXTURE_IMAGE_UNITS has  a minimum value of 8",	GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,	8	},
19853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_vertex_texture_image_units",		"MAX_VERTEX_TEXTURE_IMAGE_UNITS has  a minimum value of 0",		GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,		0	},
19863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_texture_image_units",			"MAX_TEXTURE_IMAGE_UNITS has  a minimum value of 8",			GL_MAX_TEXTURE_IMAGE_UNITS,				8	},
19873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_fragment_uniform_vectors",		"MAX_FRAGMENT_UNIFORM_VECTORS has  a minimum value of 16",		GL_MAX_FRAGMENT_UNIFORM_VECTORS,		16	},
19883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "max_renderbuffer_size",				"MAX_RENDERBUFFER_SIZE has  a minimum value of 1",				GL_MAX_RENDERBUFFER_SIZE,				1	},
19893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
19903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// \note implementation defined limits have their own tests so just check the conversions to boolean and float
19923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier* implementationLimitVerifiers[]	= {m_verifierBoolean,						m_verifierFloat};
19933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateVerifier* normalVerifiers[]				= {m_verifierBoolean,	m_verifierInteger,	m_verifierFloat};
19943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(implementationMinLimits); testNdx++)
19963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FOR_EACH_VERIFIER(implementationLimitVerifiers, addChild(new ConstantMinimumValueTestCase(m_context, verifier, (std::string(implementationMinLimits[testNdx].name) + verifier->getTestNamePostfix()).c_str(), implementationMinLimits[testNdx].description, implementationMinLimits[testNdx].targetName, implementationMinLimits[testNdx].value)));
19973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
19983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(implementationLimitVerifiers, addChild(new SampleBuffersTestCase		(m_context,	 verifier, (std::string("sample_buffers")						+ verifier->getTestNamePostfix()).c_str(),		"SAMPLE_BUFFERS")));
19993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new SamplesTestCase				(m_context,	 verifier, (std::string("samples")								+ verifier->getTestNamePostfix()).c_str(),		"SAMPLES")));
20013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new HintTestCase				(m_context,	 verifier, (std::string("generate_mipmap_hint")					+ verifier->getTestNamePostfix()).c_str(),		"GENERATE_MIPMAP_HINT",				GL_GENERATE_MIPMAP_HINT)));
20023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new DepthFuncTestCase			(m_context,	 verifier, (std::string("depth_func")							+ verifier->getTestNamePostfix()).c_str(),		"DEPTH_FUNC")));
20033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new CullFaceTestCase			(m_context,	 verifier, (std::string("cull_face_mode")						+ verifier->getTestNamePostfix()).c_str(),		"CULL_FACE_MODE")));
20043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new FrontFaceTestCase			(m_context,	 verifier, (std::string("front_face_mode")						+ verifier->getTestNamePostfix()).c_str(),		"FRONT_FACE")));
20053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ViewPortTestCase			(m_context,	 verifier, (std::string("viewport")								+ verifier->getTestNamePostfix()).c_str(),		"VIEWPORT")));
20063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ScissorBoxTestCase			(m_context,	 verifier, (std::string("scissor_box")							+ verifier->getTestNamePostfix()).c_str(),		"SCISSOR_BOX")));
20073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new MaxViewportDimsTestCase		(m_context,	 verifier, (std::string("max_viewport_dims")					+ verifier->getTestNamePostfix()).c_str(),		"MAX_VIEWPORT_DIMS")));
20083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new BufferComponentSizeCase		(m_context,	 verifier, (std::string("buffer_component_size")				+ verifier->getTestNamePostfix()).c_str(),		"x BITS")));
20093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilRefTestCase			(m_context,	 verifier, (std::string("stencil_ref")							+ verifier->getTestNamePostfix()).c_str(),		"STENCIL_REF",						GL_STENCIL_REF)));
20103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilRefTestCase			(m_context,	 verifier, (std::string("stencil_back_ref")						+ verifier->getTestNamePostfix()).c_str(),		"STENCIL_BACK_REF",					GL_STENCIL_BACK_REF)));
20113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilRefSeparateTestCase	(m_context,	 verifier, (std::string("stencil_ref_separate")					+ verifier->getTestNamePostfix()).c_str(),		"STENCIL_REF (separate)",			GL_STENCIL_REF,			GL_FRONT)));
20123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilRefSeparateTestCase	(m_context,	 verifier, (std::string("stencil_ref_separate_both")			+ verifier->getTestNamePostfix()).c_str(),		"STENCIL_REF (separate)",			GL_STENCIL_REF,			GL_FRONT_AND_BACK)));
20133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilRefSeparateTestCase	(m_context,	 verifier, (std::string("stencil_back_ref_separate")			+ verifier->getTestNamePostfix()).c_str(),		"STENCIL_BACK_REF (separate)",		GL_STENCIL_BACK_REF,	GL_BACK)));
20143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilRefSeparateTestCase	(m_context,	 verifier, (std::string("stencil_back_ref_separate_both")		+ verifier->getTestNamePostfix()).c_str(),		"STENCIL_BACK_REF (separate)",		GL_STENCIL_BACK_REF,	GL_FRONT_AND_BACK)));
20153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const struct NamedStencilOp
20173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
20183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*		name;
20193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*		frontDescription;
20213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLenum			frontTarget;
20223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*		backDescription;
20233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLenum			backTarget;
20243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	} stencilOps[] =
20253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
20263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "fail",		"STENCIL_FAIL",				GL_STENCIL_FAIL,			"STENCIL_BACK_FAIL",			GL_STENCIL_BACK_FAIL			},
20273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "depth_fail",	"STENCIL_PASS_DEPTH_FAIL",	GL_STENCIL_PASS_DEPTH_FAIL,	"STENCIL_BACK_PASS_DEPTH_FAIL",	GL_STENCIL_BACK_PASS_DEPTH_FAIL	},
20283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "depth_pass",	"STENCIL_PASS_DEPTH_PASS",	GL_STENCIL_PASS_DEPTH_PASS,	"STENCIL_BACK_PASS_DEPTH_PASS",	GL_STENCIL_BACK_PASS_DEPTH_PASS	}
20293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
20303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(stencilOps); testNdx++)
20323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
20333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilOpTestCase			(m_context, verifier, (std::string("stencil_")		+ stencilOps[testNdx].name + verifier->getTestNamePostfix()).c_str(), stencilOps[testNdx].frontDescription,	stencilOps[testNdx].frontTarget)));
20343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilOpTestCase			(m_context, verifier, (std::string("stencil_back_")	+ stencilOps[testNdx].name + verifier->getTestNamePostfix()).c_str(), stencilOps[testNdx].backDescription,	stencilOps[testNdx].backTarget)));
20353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilOpSeparateTestCase	(m_context, verifier, (std::string("stencil_")		+ stencilOps[testNdx].name + "_separate_both"	+ verifier->getTestNamePostfix()).c_str(), stencilOps[testNdx].frontDescription,	stencilOps[testNdx].frontTarget,	GL_FRONT_AND_BACK)));
20373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilOpSeparateTestCase	(m_context, verifier, (std::string("stencil_back_")	+ stencilOps[testNdx].name + "_separate_both"	+ verifier->getTestNamePostfix()).c_str(), stencilOps[testNdx].backDescription,		stencilOps[testNdx].backTarget,		GL_FRONT_AND_BACK)));
20383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilOpSeparateTestCase	(m_context, verifier, (std::string("stencil_")		+ stencilOps[testNdx].name + "_separate"		+ verifier->getTestNamePostfix()).c_str(), stencilOps[testNdx].frontDescription,	stencilOps[testNdx].frontTarget,	GL_FRONT)));
20403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilOpSeparateTestCase	(m_context, verifier, (std::string("stencil_back_")	+ stencilOps[testNdx].name + "_separate"		+ verifier->getTestNamePostfix()).c_str(), stencilOps[testNdx].backDescription,		stencilOps[testNdx].backTarget,		GL_BACK)));
20413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
20423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilFuncTestCase					(m_context, verifier,	(std::string("stencil_func")								+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_FUNC")));
20443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilFuncSeparateTestCase			(m_context, verifier,	(std::string("stencil_func_separate")						+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_FUNC (separate)",				GL_STENCIL_FUNC,				GL_FRONT)));
20453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilFuncSeparateTestCase			(m_context, verifier,	(std::string("stencil_func_separate_both")					+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_FUNC (separate)",				GL_STENCIL_FUNC,				GL_FRONT_AND_BACK)));
20463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilFuncSeparateTestCase			(m_context, verifier,	(std::string("stencil_back_func_separate")					+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_FUNC (separate)",				GL_STENCIL_BACK_FUNC,			GL_BACK)));
20473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilFuncSeparateTestCase			(m_context, verifier,	(std::string("stencil_back_func_separate_both")				+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_FUNC (separate)",				GL_STENCIL_BACK_FUNC,			GL_FRONT_AND_BACK)));
20483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilMaskTestCase					(m_context, verifier,	(std::string("stencil_value_mask")							+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_VALUE_MASK",					GL_STENCIL_VALUE_MASK)));
20493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilMaskTestCase					(m_context, verifier,	(std::string("stencil_back_value_mask")						+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_BACK_VALUE_MASK",				GL_STENCIL_BACK_VALUE_MASK)));
20503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilMaskSeparateTestCase			(m_context, verifier,	(std::string("stencil_value_mask_separate")					+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_VALUE_MASK (separate)",		GL_STENCIL_VALUE_MASK,			GL_FRONT)));
20513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilMaskSeparateTestCase			(m_context, verifier,	(std::string("stencil_value_mask_separate_both")			+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_VALUE_MASK (separate)",		GL_STENCIL_VALUE_MASK,			GL_FRONT_AND_BACK)));
20523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilMaskSeparateTestCase			(m_context, verifier,	(std::string("stencil_back_value_mask_separate")			+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_BACK_VALUE_MASK (separate)",	GL_STENCIL_BACK_VALUE_MASK,		GL_BACK)));
20533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilMaskSeparateTestCase			(m_context, verifier,	(std::string("stencil_back_value_mask_separate_both")		+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_BACK_VALUE_MASK (separate)",	GL_STENCIL_BACK_VALUE_MASK,		GL_FRONT_AND_BACK)));
20543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilWriteMaskTestCase			(m_context, verifier,	(std::string("stencil_writemask")							+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_WRITEMASK",					GL_STENCIL_WRITEMASK)));
20553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilWriteMaskTestCase			(m_context, verifier,	(std::string("stencil_back_writemask")						+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_BACK_WRITEMASK",				GL_STENCIL_BACK_WRITEMASK)));
20563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilWriteMaskSeparateTestCase	(m_context, verifier,	(std::string("stencil_writemask_separate")					+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_WRITEMASK (separate)",			GL_STENCIL_WRITEMASK,			GL_FRONT)));
20573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilWriteMaskSeparateTestCase	(m_context, verifier,	(std::string("stencil_writemask_separate_both")				+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_WRITEMASK (separate)",			GL_STENCIL_WRITEMASK,			GL_FRONT_AND_BACK)));
20583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilWriteMaskSeparateTestCase	(m_context, verifier,	(std::string("stencil_back_writemask_separate")				+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_BACK_WRITEMASK (separate)",	GL_STENCIL_BACK_WRITEMASK,		GL_BACK)));
20593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilWriteMaskSeparateTestCase	(m_context, verifier,	(std::string("stencil_back_writemask_separate_both")		+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_BACK_WRITEMASK (separate)",	GL_STENCIL_BACK_WRITEMASK,		GL_FRONT_AND_BACK)));
20603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new PixelStoreAlignTestCase(m_context, verifier, (std::string("unpack_alignment")	+ verifier->getTestNamePostfix()).c_str(),	"UNPACK_ALIGNMENT",	GL_UNPACK_ALIGNMENT)));
20623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new PixelStoreAlignTestCase(m_context, verifier, (std::string("pack_alignment")		+ verifier->getTestNamePostfix()).c_str(),	"PACK_ALIGNMENT",	GL_PACK_ALIGNMENT)));
20633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
20653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const struct BlendColorState
20663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
20673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const char*	name;
20683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const char*	description;
20693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLenum		target;
20703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			int			initialValue;
20713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		} blendColorStates[] =
20723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
20733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{ "blend_src_rgb",		"BLEND_SRC_RGB",	GL_BLEND_SRC_RGB,		GL_ONE	},
20743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{ "blend_src_alpha",	"BLEND_SRC_ALPHA",	GL_BLEND_SRC_ALPHA,		GL_ONE	},
20753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{ "blend_dst_rgb",		"BLEND_DST_RGB",	GL_BLEND_DST_RGB,		GL_ZERO	},
20763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{ "blend_dst_alpha",	"BLEND_DST_ALPHA",	GL_BLEND_DST_ALPHA,		GL_ZERO	}
20773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
20783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(blendColorStates); testNdx++)
20793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
20803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			FOR_EACH_VERIFIER(normalVerifiers, addChild(new BlendFuncTestCase			(m_context, verifier, (std::string(blendColorStates[testNdx].name)					+ verifier->getTestNamePostfix()).c_str(),	blendColorStates[testNdx].description,	blendColorStates[testNdx].target,	blendColorStates[testNdx].initialValue)));
20813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			FOR_EACH_VERIFIER(normalVerifiers, addChild(new BlendFuncSeparateTestCase	(m_context, verifier, (std::string(blendColorStates[testNdx].name) + "_separate"	+ verifier->getTestNamePostfix()).c_str(),	blendColorStates[testNdx].description,	blendColorStates[testNdx].target,	blendColorStates[testNdx].initialValue)));
20823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
20833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
20843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
20853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
20863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const struct BlendEquationState
20873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
20883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const char*	name;
20893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const char*	description;
20903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLenum		target;
20913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			int			initialValue;
20923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		} blendEquationStates[] =
20933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
20943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{ "blend_equation_rgb",		"BLEND_EQUATION_RGB",	GL_BLEND_EQUATION_RGB,		GL_FUNC_ADD	},
20953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{ "blend_equation_alpha",	"BLEND_EQUATION_ALPHA",	GL_BLEND_EQUATION_ALPHA,	GL_FUNC_ADD	}
20963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
20973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(blendEquationStates); testNdx++)
20983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
20993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			FOR_EACH_VERIFIER(normalVerifiers, addChild(new BlendEquationTestCase			(m_context, verifier, (std::string(blendEquationStates[testNdx].name) +				+ verifier->getTestNamePostfix()).c_str(),		blendEquationStates[testNdx].description,	blendEquationStates[testNdx].target,	blendEquationStates[testNdx].initialValue)));
21003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			FOR_EACH_VERIFIER(normalVerifiers, addChild(new BlendEquationSeparateTestCase	(m_context, verifier, (std::string(blendEquationStates[testNdx].name) + "_separate"	+ verifier->getTestNamePostfix()).c_str(),		blendEquationStates[testNdx].description,	blendEquationStates[testNdx].target,	blendEquationStates[testNdx].initialValue)));
21013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
21023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
21033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ImplementationArrayTestCase			(m_context, verifier, (std::string("compressed_texture_formats")	+ verifier->getTestNamePostfix()).c_str(),	"COMPRESSED_TEXTURE_FORMATS",	GL_COMPRESSED_TEXTURE_FORMATS,		GL_NUM_COMPRESSED_TEXTURE_FORMATS,	0)));
21053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ImplementationArrayTestCase			(m_context, verifier, (std::string("shader_binary_formats")			+ verifier->getTestNamePostfix()).c_str(),	"SHADER_BINARY_FORMATS",		GL_SHADER_BINARY_FORMATS,			GL_NUM_SHADER_BINARY_FORMATS,		0)));
21063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new BufferBindingTestCase				(m_context, verifier, (std::string("array_buffer_binding")			+ verifier->getTestNamePostfix()).c_str(),	"ARRAY_BUFFER_BINDING",			GL_ARRAY_BUFFER_BINDING,			GL_ARRAY_BUFFER)));
21083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new BufferBindingTestCase				(m_context, verifier, (std::string("element_array_buffer_binding")	+ verifier->getTestNamePostfix()).c_str(),	"ELEMENT_ARRAY_BUFFER_BINDING",	GL_ELEMENT_ARRAY_BUFFER_BINDING,	GL_ELEMENT_ARRAY_BUFFER)));
21093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new CurrentProgramBindingTestCase		(m_context, verifier, (std::string("current_program_binding")		+ verifier->getTestNamePostfix()).c_str(),	"CURRENT_PROGRAM")));
21113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new StencilClearValueTestCase			(m_context, verifier, (std::string("stencil_clear_value")			+ verifier->getTestNamePostfix()).c_str(),	"STENCIL_CLEAR_VALUE")));
21123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ActiveTextureTestCase				(m_context, verifier, (std::string("active_texture")				+ verifier->getTestNamePostfix()).c_str(),	"ACTIVE_TEXTURE")));
21133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new RenderbufferBindingTestCase			(m_context, verifier, (std::string("renderbuffer_binding")			+ verifier->getTestNamePostfix()).c_str(),	"RENDERBUFFER_BINDING")));
21143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new TextureBindingTestCase				(m_context, verifier, (std::string("texture_binding_2d")			+ verifier->getTestNamePostfix()).c_str(),	"TEXTURE_BINDING_2D",			GL_TEXTURE_BINDING_2D,			GL_TEXTURE_2D)));
21163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new TextureBindingTestCase				(m_context, verifier, (std::string("texture_binding_cube_map")		+ verifier->getTestNamePostfix()).c_str(),	"TEXTURE_BINDING_CUBE_MAP",		GL_TEXTURE_BINDING_CUBE_MAP,	GL_TEXTURE_CUBE_MAP)));
21173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new FrameBufferBindingTestCase			(m_context, verifier, (std::string("framebuffer_binding")			+ verifier->getTestNamePostfix()).c_str(),	"DRAW_FRAMEBUFFER_BINDING and READ_FRAMEBUFFER_BINDING")));
21193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FOR_EACH_VERIFIER(normalVerifiers, addChild(new ImplementationColorReadTestCase		(m_context, verifier, (std::string("implementation_color_read")		+ verifier->getTestNamePostfix()).c_str(),	"IMPLEMENTATION_COLOR_READ_TYPE and IMPLEMENTATION_COLOR_READ_FORMAT")));
21203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
21213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21223c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid IntegerStateQueryTests::deinit (void)
21233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
21243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_verifierBoolean)
21253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
21263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete m_verifierBoolean;
21273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifierBoolean = DE_NULL;
21283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
21293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_verifierInteger)
21303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
21313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete m_verifierInteger;
21323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifierInteger = DE_NULL;
21333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
21343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_verifierFloat)
21353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
21363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete m_verifierFloat;
21373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_verifierFloat = DE_NULL;
21383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
21393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	this->TestCaseGroup::deinit();
21413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
21423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
21433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional
21443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2
21453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
2146