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 Redundant state change performance tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2pRedundantStateChangeTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsStateChangePerfTestCases.hpp"
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Performance
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw; // GL types
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	VIEWPORT_WIDTH	= 24,
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	VIEWPORT_HEIGHT	= 24
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RedundantStateChangeCase : public gls::StateChangePerformanceCase
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					RedundantStateChangeCase	(Context& context, int drawCallCount, int triangleCount, bool drawArrays, bool useIndexBuffer, const char* name, const char* description);
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					~RedundantStateChangeCase	(void);
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void	renderTest					(const glw::Functions& gl);
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void	renderReference				(const glw::Functions& gl);
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void	changeState					(const glw::Functions& gl) = 0;
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
603c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRedundantStateChangeCase::RedundantStateChangeCase (Context& context, int drawCallCount, int triangleCount, bool drawArrays, bool useIndexBuffer, const char* name, const char* description)
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: gls::StateChangePerformanceCase(context.getTestContext(), context.getRenderContext(), name, description,
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									  (useIndexBuffer	? DRAWTYPE_INDEXED_BUFFER	:
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									   drawArrays		? DRAWTYPE_NOT_INDEXED		:
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														  DRAWTYPE_INDEXED_USER_PTR), drawCallCount, triangleCount)
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(!useIndexBuffer || !drawArrays);
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
693c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRedundantStateChangeCase::~RedundantStateChangeCase (void)
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid RedundantStateChangeCase::renderTest (const glw::Functions& gl)
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int callNdx = 0; callNdx < m_callCount; callNdx++)
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		changeState(gl);
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		callDraw(gl);
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid RedundantStateChangeCase::renderReference (const glw::Functions& gl)
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	changeState(gl);
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int callNdx = 0; callNdx < m_callCount; callNdx++)
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		callDraw(gl);
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRedundantStateChangeTests::RedundantStateChangeTests (Context& context)
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(context, "redundant_state_change_draw", "Test performance with redundant sate changes between rendering.")
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRedundantStateChangeTests::~RedundantStateChangeTests (void)
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define MACRO_BLOCK(...) __VA_ARGS__
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define ADD_TESTCASE(NAME, DESC, DRAWARRAYS, INDEXBUFFER, INIT_FUNC, CHANGE_FUNC)\
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyrydo {\
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	class RedundantStateChangeCase_ ## NAME : public RedundantStateChangeCase\
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{\
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	public:\
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			RedundantStateChangeCase_ ## NAME (Context& context, int drawCallCount, int triangleCount, const char* name, const char* description)\
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				: RedundantStateChangeCase(context, drawCallCount, triangleCount, (DRAWARRAYS), (INDEXBUFFER), name, description)\
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{}\
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		virtual void setupInitialState (const glw::Functions& gl)\
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{\
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			INIT_FUNC\
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}\
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		virtual void changeState (const glw::Functions& gl)\
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{\
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			CHANGE_FUNC\
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}\
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};\
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	manySmallCallsGroup->addChild	(new RedundantStateChangeCase_ ## NAME (m_context,1000,2,#NAME,(DESC)));\
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	fewBigCallsGroup->addChild		(new RedundantStateChangeCase_ ## NAME (m_context,10,200,#NAME,(DESC)));\
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} while (0);
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid RedundantStateChangeTests::init (void)
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestCaseGroup* const	manySmallCallsGroup	= new tcu::TestCaseGroup(m_testCtx, "many_small_calls",	"1000 calls, 2 triangles in each");
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestCaseGroup* const	fewBigCallsGroup	= new tcu::TestCaseGroup(m_testCtx, "few_big_calls",	"10 calls, 200 triangles in each");
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(manySmallCallsGroup);
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(fewBigCallsGroup);
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(blend, "Enable/Disable blending.",
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_BLEND);
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(depth_test, "Enable/Disable depth test.",
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.depthFunc(GL_LEQUAL);
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glDepthFunc()");
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_DEPTH_TEST);
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(stencil_test, "Enable/Disable stencil test.",
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilFunc(GL_LEQUAL, 0, 0);
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glStencilFunc()");
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glStencilOp()");
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clearStencil(0);
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClearStencil()");
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clear(GL_STENCIL_BUFFER_BIT);
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClear()");
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_STENCIL_TEST);
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(scissor_test, "Enable/Disable scissor test.",
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.scissor(2, 3, 12, 13);
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glScissor()");
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_SCISSOR_TEST);
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(dither, "Enable/Disable dithering.",
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_DITHER);
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(culling, "Enable/Disable culling.",
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.frontFace(GL_CW);
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glFrontFace()");
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.cullFace(GL_FRONT);
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glCullFace()");
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_CULL_FACE);
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(depth_func, "Change depth func.",
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_DEPTH_TEST);
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.depthFunc(GL_GEQUAL);
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(depth_mask, "Toggle depth mask.",
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_DEPTH_TEST);
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.depthFunc(GL_LEQUAL);
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glDepthFunc()");
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.depthMask(GL_FALSE);
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(depth_rangef, "Change depth range.",
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.depthRangef(0.0f, 1.0f);
4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(blend_equation, "Change blend equation.",
5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_BLEND);
5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.blendEquation(GL_FUNC_SUBTRACT);
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(blend_func, "Change blend function.",
5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_BLEND);
5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(polygon_offset, "Change polygon offset.",
5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_POLYGON_OFFSET_FILL);
6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.polygonOffset(0.0f, 0.0f);
6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(sample_coverage, "Sample coverage.",
6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.sampleCoverage(0.25f, GL_TRUE);
6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(viewport, "Change viewport.",
6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(10, 11, 5, 6);
6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(scissor, "Change scissor box.",
6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_SCISSOR_TEST);
7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.scissor(17, 13, 5, 8);
7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(color_mask, "Change color mask.",
7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.colorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_FALSE);
7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(cull_face, "Change culling mode.",
7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_CULL_FACE);
8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.cullFace(GL_FRONT);
8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(front_face, "Change front face.",
8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
8213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
8293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_CULL_FACE);
8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.frontFace(GL_CCW);
8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(stencil_mask, "Change stencil mask.",
8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
8633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
8823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_STENCIL_TEST);
8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilFunc(GL_LEQUAL, 0, 0);
8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glStencilFunc()");
8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glStencilOp()");
8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clearStencil(0);
8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClearStencil()");
8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clear(GL_STENCIL_BUFFER_BIT);
8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClear()");
8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilMask(0xDD);
9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(stencil_func, "Change stencil func.",
9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
9303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_STENCIL_TEST);
9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glStencilOp()");
9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clearStencil(0);
9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClearStencil()");
9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clear(GL_STENCIL_BUFFER_BIT);
9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClear()");
9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilFunc(GL_LEQUAL, 0, 0xFF);
9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(stencil_op, "Change stencil op.",
9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
9593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
9603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
9613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
9623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
9643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
9653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
9663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
9673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
9683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
9693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
9713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
9723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
9743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
9753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
9773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
9783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
9803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
9813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_STENCIL_TEST);
9833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
9843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilFunc(GL_LEQUAL, 0, 0);
9863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glStencilFunc()");
9873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clearStencil(0);
9893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClearStencil()");
9903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.clear(GL_STENCIL_BUFFER_BIT);
9923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glClear()");
9933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
9943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
9953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.stencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);
9963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
9973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
9983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(bind_array_buffer, "Change array buffer and refresh vertex attrib pointer.",
10003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
10013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
10023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
10033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
10043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
10053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
10063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindAttribLocation(m_programs[0]->getProgram(), 0, "a_coord");
10083fdee359c9eee4d6c1d823b23f7f64631b5945f8Jarkko Pöyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindAttribLocation()");
10093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.linkProgram(m_programs[0]->getProgram());
10103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glLinkProgram()");
10113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
10133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
10143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(0);
10163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
10173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
10183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
10193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL);
10203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
10213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
10233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
10243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
10263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
10273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
10293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
10303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
10323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
10333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
10343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
10353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
10363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL);
10373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
10383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
10393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(element_array_buffer, "Change element array buffer.",
10413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
10423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
10433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
10443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
10453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireIndexBuffers(1);
10463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
10473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
10483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
10503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
10513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
10523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
10533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
10553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
10563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
10573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
10583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
10593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
10603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
10623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
10633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
10653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
10663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
10683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
10693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
10713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
10723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffers[0]);
10743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
10753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
10763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
10773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBuffers[0]);
10783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
10793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
10803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(bind_texture, "Change texture binding.",
10823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
10833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
10843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
10853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
10863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
10873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
10883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
10903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
10913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
10923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
10933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
10953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
10963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
10973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
10983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
10993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
11003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
11023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
11033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
11053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
11063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
11083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
11093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
11113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
11123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
11133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
11143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
11153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
11163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
11173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(use_program, "Change used program.",
11193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
11203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
11213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
11223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
11233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
11243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
11253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
11273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
11283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
11303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
11313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
11323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
11333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
11343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
11353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
11373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
11383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
11403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
11413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
11423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
11433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
11443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
11453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
11473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
11483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
11493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
11503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
11513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
11523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
11533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(tex_parameter_min_filter, "Change texture parameter min filter.",
11553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
11563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
11573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
11583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
11593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
11603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
11613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
11633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
11643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
11653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
11663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
11683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
11693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
11703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
11713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
11723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
11733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
11753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
11763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
11783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
11793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
11813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
11823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
11843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
11853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
11863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
11873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
11883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
11893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
11903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(tex_parameter_mag_filter, "Change texture parameter mag filter.",
11923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
11933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
11943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
11953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
11963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
11973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
11983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
12003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
12013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
12023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
12033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
12053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
12063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
12073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
12083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
12093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
12103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
12123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
12133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
12153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
12163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
12183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
12193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
12213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
12223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
12233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
12243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
12253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
12263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
12273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(tex_parameter_wrap, "Change texture parameter wrap filter.",
12293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
12303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
12313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
12323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
12333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
12343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
12353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
12373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
12383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
12393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
12403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
12423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
12433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
12443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
12453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
12463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
12473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
12493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
12503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
12523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
12533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
12553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
12563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
12583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
12593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
12603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
12613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
12623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
12633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
12643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(bind_framebuffer, "Change framebuffer.",
12663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
12673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
12683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
12693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
12703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
12713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireFramebuffers(1);
12723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
12733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
12753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
12763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
12773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
12783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
12803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
12813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
12823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
12833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
12843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
12853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
12873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
12883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
12903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
12913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
12933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
12943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
12963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
12973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindFramebuffer(GL_FRAMEBUFFER, m_framebuffers[0]);
12993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindFramebuffer()");
13003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
13013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
13023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindFramebuffer(GL_FRAMEBUFFER, m_framebuffers[0]);
13033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
13043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
13053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ADD_TESTCASE(blend_color, "Change blend color.",
13073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		true,
13083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		false,
13093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
13103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireCoordBuffers(1);
13113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requireTextures(1);
13123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			requirePrograms(1);
13133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.useProgram(m_programs[0]->getProgram());
13153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram()");
13163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint coordLoc = gl.getAttribLocation(m_programs[0]->getProgram(), "a_coord");
13173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
13183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enableVertexAttribArray(coordLoc);
13203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray()");
13213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindBuffer(GL_ARRAY_BUFFER, m_coordBuffers[0]);
13223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer()");
13233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.vertexAttribPointer(coordLoc, 2, GL_FLOAT, GL_FALSE, 0, NULL);
13243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer()");
13253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLint samplerLoc = gl.getUniformLocation(m_programs[0]->getProgram(), "u_sampler");
13273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glGetUniformLocation()");
13283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.bindTexture(GL_TEXTURE_2D, m_textures[0]);
13303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture()");
13313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.uniform1i(samplerLoc, 0);
13333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glUniform1i()");
13343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.viewport(0, 0, VIEWPORT_WIDTH, VIEWPORT_HEIGHT);
13363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glViewport()");
13373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.enable(GL_BLEND);
13393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable()");
13403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.blendFunc(GL_CONSTANT_COLOR, GL_CONSTANT_COLOR);
13423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glBlendFunc()");
13433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}),
13443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		MACRO_BLOCK({
13453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.blendColor(0.75f, 0.75f, 0.75f, 0.75f);
13463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		})
13473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	)
13483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
13493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Performance
13513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2
13523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
1353