es3fScissorTests.cpp revision 3c827367444ee418f129b2c238299f49d3264554
13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.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 GLES3 Scissor tests
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es3fScissorTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsScissorTests.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "sglrGLContext.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "sglrReferenceContext.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "sglrContextUtil.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVector.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuImageCompare.hpp"
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluStrUtil.hpp"
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDrawUtil.hpp"
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deDefs.hpp"
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles3
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::ConstPixelBufferAccess;
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FramebufferCase : public tcu::TestCase
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									FramebufferCase			(glu::RenderContext& context, tcu::TestContext& testContext, const char* name, const char* description);
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual							~FramebufferCase		(void) {}
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual IterateResult			iterate					(void);
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Must do its own 'readPixels', wrapper does not need to care about formats this way
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual ConstPixelBufferAccess	render					(sglr::Context& context, std::vector<deUint8>& pixelBuffer) = DE_NULL;
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&				m_renderContext;
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
683c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFramebufferCase::FramebufferCase (glu::RenderContext& context, tcu::TestContext& testContext, const char* name, const char* description)
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: tcu::TestCase		(testContext, name, description)
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderContext	(context)
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
743c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFramebufferCase::IterateResult FramebufferCase::iterate (void)
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::Vec4				clearColor				(0.0f, 0.0f, 0.0f, 1.0f);
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::RenderTarget&	renderTarget			= m_renderContext.getRenderTarget();
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*					failReason				= DE_NULL;
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int					width					= 64;
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int					height					= 64;
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestLog&				log						= m_testCtx.getLog();
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&			renderCtx				= m_renderContext;
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::ConstPixelBufferAccess glesAccess;
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::ConstPixelBufferAccess refAccess;
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint8>		glesFrame;
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint8>		refFrame;
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32					glesError;
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Render using GLES
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		sglr::GLContext context(renderCtx, log, sglr::GLCONTEXT_LOG_CALLS, tcu::IVec4(0, 0, width, height));
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		context.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		context.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glesAccess = render(context, glesFrame); // Call actual render func
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glesError = context.getError();
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Render reference image
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		sglr::ReferenceContextBuffers	buffers	(tcu::PixelFormat(8,8,8,renderTarget.getPixelFormat().alphaBits?8:0), renderTarget.getDepthBits(), renderTarget.getStencilBits(), width, height);
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		sglr::ReferenceContext			context	(sglr::ReferenceContextLimits(renderCtx), buffers.getColorbuffer(), buffers.getDepthbuffer(), buffers.getStencilbuffer());
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		context.clearColor(clearColor.x(), clearColor.y(), clearColor.z(), clearColor.w());
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		context.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		refAccess = render(context, refFrame);
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DE_ASSERT(context.getError() == GL_NO_ERROR);
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (glesError != GL_NO_ERROR)
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << tcu::TestLog::Message << "Unexpected error: got " << glu::getErrorStr(glesError) << tcu::TestLog::EndMessage;
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Got unexpected error");
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Compare images
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const tcu::Vec4		threshold	(0.02f, 0.02f, 0.02f, 0.02f);
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const bool			imagesOk	= tcu::floatThresholdCompare(log, "ComparisonResult", "Image comparison result", refAccess, glesAccess, threshold, tcu::COMPARE_LOG_RESULT);
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!imagesOk && !failReason)
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			failReason = "Image comparison failed";
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Store test result
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(imagesOk ? QP_TEST_RESULT_PASS	: QP_TEST_RESULT_FAIL,
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								imagesOk ? "Pass"				: failReason);
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FramebufferClearCase : public FramebufferCase
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum ClearType
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		COLOR_FIXED = 0,
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		COLOR_FLOAT,
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		COLOR_INT,
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		COLOR_UINT,
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DEPTH,
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STENCIL,
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DEPTH_STENCIL,
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		CLEAR_TYPE_LAST
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									FramebufferClearCase	(glu::RenderContext& context, tcu::TestContext& testContext, ClearType clearType, const char* name, const char* description);
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual							~FramebufferClearCase	(void) {}
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::ConstPixelBufferAccess		render					(sglr::Context& context, std::vector<deUint8>& pixelBuffer);
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const ClearType					m_clearType;
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1633c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFramebufferClearCase::FramebufferClearCase (glu::RenderContext& context, tcu::TestContext& testContext, ClearType clearType, const char* name, const char* description)
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: FramebufferCase	(context, testContext, name, description)
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_clearType		(clearType)
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1693c827367444ee418f129b2c238299f49d3264554Jarkko PoyryConstPixelBufferAccess FramebufferClearCase::render (sglr::Context& context, std::vector<deUint8>& pixelBuffer)
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using gls::Functional::ScissorTestShader;
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ScissorTestShader	shader;
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deUint32		shaderID			= context.createProgram(&shader);
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			width				= 64;
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			height				= 64;
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::Vec4		clearColor			(1.0f, 1.0f, 0.5f, 1.0f);
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::IVec4	clearInt			(127, -127, 0, 127);
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::UVec4	clearUint			(255, 255, 0, 255);
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::Vec4		baseColor			(0.0f, 0.0f, 0.0f, 1.0f);
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::IVec4	baseIntColor		(0, 0, 0, 0);
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::UVec4	baseUintColor		(0, 0, 0, 0);
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			clearStencil		= 123;
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float			clearDepth			= 1.0f;
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			framebuf, colorbuf, dsbuf;
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			colorBufferFormat	= GL_RGBA8;
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			readFormat			= GL_RGBA;
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			readType			= GL_UNSIGNED_BYTE;
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureFormat	textureFormat		(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8);
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.genFramebuffers(1, &framebuf);
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuf);
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	switch (m_clearType)
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_FLOAT:
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			colorBufferFormat	= GL_RGBA16F;
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			textureFormat		= tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::HALF_FLOAT);
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(!"Floating point clear not implemented");// \todo [2014-1-23 otto] pixel read format & type, nothing guaranteed, need extension...
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_INT:
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			colorBufferFormat	= GL_RGBA8I;
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			readFormat			= GL_RGBA_INTEGER;
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			readType			= GL_INT;
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			textureFormat		= tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::SIGNED_INT32);
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			pixelBuffer.resize(width*height*4*4);
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_UINT:
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			colorBufferFormat	= GL_RGBA8UI;
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			readFormat			= GL_RGBA_INTEGER;
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			readType			= GL_UNSIGNED_INT;
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			textureFormat		= tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNSIGNED_INT32);
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			pixelBuffer.resize(width*height*4*4);
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			pixelBuffer.resize(width*height*1*4);
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Color
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.genRenderbuffers(1, &colorbuf);
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindRenderbuffer(GL_RENDERBUFFER, colorbuf);
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.renderbufferStorage(GL_RENDERBUFFER, colorBufferFormat, width, height);
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.framebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuf);
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Depth/stencil
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.genRenderbuffers(1, &dsbuf);
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindRenderbuffer(GL_RENDERBUFFER, dsbuf);
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.framebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, dsbuf);
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.clearBufferfi(GL_DEPTH_STENCIL, 0, 1.0f-clearDepth, ~clearStencil);
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	switch (m_clearType)
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_INT:		context.clearBufferiv(GL_COLOR, 0, baseIntColor.getPtr());		break;
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_UINT:	context.clearBufferuiv(GL_COLOR, 0, baseUintColor.getPtr());	break;
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:			context.clearBufferfv(GL_COLOR, 0, baseColor.getPtr());
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.enable(GL_SCISSOR_TEST);
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.scissor(8, 8, 48, 48);
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	switch (m_clearType)
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_FIXED:		context.clearBufferfv(GL_COLOR, 0, clearColor.getPtr());				break;
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_FLOAT:		context.clearBufferfv(GL_COLOR, 0, clearColor.getPtr());				break;
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_INT:			context.clearBufferiv(GL_COLOR, 0, clearInt.getPtr());					break;
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case COLOR_UINT:		context.clearBufferuiv(GL_COLOR, 0, clearUint.getPtr());				break;
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case DEPTH:				context.clearBufferfv(GL_DEPTH, 0, &clearDepth);						break;
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case STENCIL:			context.clearBufferiv(GL_STENCIL, 0, &clearStencil);					break;
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case DEPTH_STENCIL:		context.clearBufferfi(GL_DEPTH_STENCIL, 0, clearDepth, clearStencil);	break;
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:				DE_ASSERT(false);														break;
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.disable(GL_SCISSOR_TEST);
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const bool useDepth		= (m_clearType==DEPTH   || m_clearType==DEPTH_STENCIL);
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const bool useStencil	= (m_clearType==STENCIL || m_clearType==DEPTH_STENCIL);
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (useDepth)
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		context.enable(GL_DEPTH_TEST);
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (useStencil)
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		context.enable(GL_STENCIL_TEST);
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		context.stencilFunc(GL_EQUAL, clearStencil, ~0u);
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (useDepth || useStencil)
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		shader.setColor(context, shaderID, clearColor);
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		sglr::drawQuad(context, shaderID, tcu::Vec3(-1.0f, -1.0f, 0.2f), tcu::Vec3(1.0f, 1.0f, 0.2f));
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindFramebuffer(GL_READ_FRAMEBUFFER, framebuf);
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.readPixels(0, 0, width, height, readFormat, readType, &pixelBuffer[0]);
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.deleteFramebuffers(1, &framebuf);
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.deleteRenderbuffers(1, &colorbuf);
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.deleteRenderbuffers(1, &dsbuf);
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return tcu::PixelBufferAccess(textureFormat, width, height, 1, &pixelBuffer[0]);
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FramebufferBlitCase : public gls::Functional::ScissorCase
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							FramebufferBlitCase		(glu::RenderContext& context, tcu::TestContext& testContext, const tcu::Vec4& scissorArea, const char* name, const char* description);
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual					~FramebufferBlitCase	(void) {}
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void			init					(void);
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void			render					(sglr::Context& context, const tcu::IVec4& viewport);
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3073c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFramebufferBlitCase::FramebufferBlitCase (glu::RenderContext& context, tcu::TestContext& testContext, const tcu::Vec4& scissorArea, const char* name, const char* description):
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ScissorCase(context, testContext, scissorArea, name, description)
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FramebufferBlitCase::init (void)
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_renderContext.getRenderTarget().getNumSamples())
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw tcu::NotSupportedError("Cannot blit to multisampled render buffer", "", __FILE__, __LINE__);
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FramebufferBlitCase::render (sglr::Context& context, const tcu::IVec4& viewport)
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			framebuf;
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			colorbuf;
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			fboWidth			= 64;
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			fboHeight			= 64;
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::Vec4		clearColor			(1.0f, 1.0f, 0.5f, 1.0f);
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			width				= viewport.z();
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			height				= viewport.w();
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::IVec4	scissorArea			(int(m_scissorArea.x()*width) + viewport.x(),
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											 int(m_scissorArea.y()*height) + viewport.y(),
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											 int(m_scissorArea.z()*width),
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											 int(m_scissorArea.w()*height));
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		defaultFramebuffer	= m_renderContext.getDefaultFramebuffer();
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.genFramebuffers(1, &framebuf);
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuf);
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.genRenderbuffers(1, &colorbuf);
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindRenderbuffer(GL_RENDERBUFFER, colorbuf);
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.renderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, fboWidth, fboHeight);
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.framebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorbuf);
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.clearBufferfv(GL_COLOR, 0, clearColor.getPtr());
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.enable(GL_SCISSOR_TEST);
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.scissor(scissorArea.x(), scissorArea.y(), scissorArea.z(), scissorArea.w());
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// blit to default framebuffer
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindFramebuffer(GL_READ_FRAMEBUFFER, framebuf);
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindFramebuffer(GL_DRAW_FRAMEBUFFER, defaultFramebuffer);
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.blitFramebuffer(0, 0, fboWidth, fboHeight, viewport.x(), viewport.y(), viewport.x() + width, viewport.y() + height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.bindFramebuffer(GL_READ_FRAMEBUFFER, defaultFramebuffer);
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.disable(GL_SCISSOR_TEST);
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.deleteFramebuffers(1, &framebuf);
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context.deleteRenderbuffers(1, &colorbuf);
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Anonymous
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3633c827367444ee418f129b2c238299f49d3264554Jarkko PoyryScissorTests::ScissorTests (Context& context):
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestCaseGroup	(context, "scissor", "Scissor Tests")
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3683c827367444ee418f129b2c238299f49d3264554Jarkko PoyryScissorTests::~ScissorTests (void)
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid ScissorTests::init (void)
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	using tcu::Vec4;
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef gls::Functional::ScissorCase SC;
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&		rc = m_context.getRenderContext();
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestContext&		tc = m_context.getTestContext();
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const struct
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*				name;
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*				description;
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const tcu::Vec4			scissor;
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const tcu::Vec4			render;
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const SC::PrimitiveType	type;
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int				primitives;
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	} cases[] =
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "contained_quads",		"Triangles fully inside scissor area (single call)",		Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), SC::TRIANGLE,	30 },
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "partial_quads",			"Triangles partially inside scissor area (single call)",	Vec4(0.3f, 0.3f, 0.4f, 0.4f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), SC::TRIANGLE,	30 },
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "contained_tri",			"Triangle fully inside scissor area",						Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), SC::TRIANGLE,	1  },
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "enclosing_tri",			"Triangle fully covering scissor area",						Vec4(0.4f, 0.4f, 0.2f, 0.2f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), SC::TRIANGLE,	1  },
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "partial_tri",			"Triangle partially inside scissor area",					Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), SC::TRIANGLE,	1  },
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "outside_render_tri",		"Triangle with scissor area outside render target",			Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.6f, 0.6f), SC::TRIANGLE,	1  },
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "partial_lines",			"Linse partially inside scissor area",						Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), SC::LINE,		30 },
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "contained_line",			"Line fully inside scissor area",							Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), SC::LINE,		1  },
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "partial_line",			"Line partially inside scissor area",						Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), SC::LINE,		1  },
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "outside_render_line",	"Line with scissor area outside render target",				Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.6f, 0.6f), SC::LINE,		1  },
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "contained_point",		"Point fully inside scissor area",							Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.5f, 0.5f, 0.0f, 0.0f), SC::POINT,		1  },
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "partial_points",			"Points partially inside scissor area",						Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), SC::POINT,		30 },
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "outside_point",			"Point fully outside scissor area",							Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.0f, 0.0f), SC::POINT,		1  },
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ "outside_render_point",	"Point with scissor area outside render target",			Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.5f, 0.5f, 0.0f, 0.0f),	SC::POINT,		1  }
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(cases); caseNdx++)
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(SC::createPrimitiveTest(rc,
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 tc,
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 cases[caseNdx].scissor,
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 cases[caseNdx].render,
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 cases[caseNdx].type,
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 cases[caseNdx].primitives,
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 cases[caseNdx].name,
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										 cases[caseNdx].description));
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(SC::createClearTest(rc, tc, Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_DEPTH_BUFFER_BIT,		"clear_depth",		"Depth buffer clear"));
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(SC::createClearTest(rc, tc, Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_STENCIL_BUFFER_BIT,	"clear_stencil",	"Stencil buffer clear"));
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(SC::createClearTest(rc, tc, Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_COLOR_BUFFER_BIT,		"clear_color",		"Color buffer clear"));
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferClearCase(rc, tc, FramebufferClearCase::COLOR_FIXED,	"clear_fixed_buffer",			"Fixed point color clear"));
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferClearCase(rc, tc, FramebufferClearCase::COLOR_INT,		"clear_int_buffer",				"Integer color clear"));
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferClearCase(rc, tc, FramebufferClearCase::COLOR_UINT,		"clear_uint_buffer",			"Unsigned integer buffer clear"));
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferClearCase(rc, tc, FramebufferClearCase::DEPTH,			"clear_depth_buffer",			"Depth buffer clear"));
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferClearCase(rc, tc, FramebufferClearCase::STENCIL,		"clear_stencil_buffer",			"Stencil buffer clear"));
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferClearCase(rc, tc, FramebufferClearCase::DEPTH_STENCIL,	"clear_depth_stencil_buffer",	"Fixed point color buffer clear"));
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferBlitCase(rc, tc, Vec4(0.1f, 0.1f, 0.8f, 0.8f), "framebuffer_blit_center",	"Blit to default framebuffer, scissor away edges"));
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferBlitCase(rc, tc, Vec4(0.6f, 0.6f, 0.5f, 0.5f), "framebuffer_blit_corner",	"Blit to default framebuffer, scissor all but a corner"));
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FramebufferBlitCase(rc, tc, Vec4(1.6f, 0.6f, 0.5f, 0.5f), "framebuffer_blit_none",		"Blit to default framebuffer, scissor area outside screen"));
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles3
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
437