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 gl_FragData[] tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2fShaderFragDataTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsShaderLibrary.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDrawUtil.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluPixelTransfer.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluObjectWrapper.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp"
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuStringTemplate.hpp"
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuSurface.hpp"
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog;
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum IndexExprType
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	INDEX_EXPR_STATIC	= 0,
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	INDEX_EXPR_UNIFORM,
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	INDEX_EXPR_DYNAMIC,
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	INDEX_EXPR_TYPE_LAST
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic bool compareSingleColor (tcu::TestLog& log, const tcu::Surface& surface, tcu::RGBA expectedColor, tcu::RGBA threshold)
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	maxPrints			= 10;
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int			numFailedPixels		= 0;
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log << TestLog::Message << "Expecting " << expectedColor << " with threshold " << threshold << TestLog::EndMessage;
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int y = 0; y < surface.getHeight(); y++)
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int x = 0; x < surface.getWidth(); x++)
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const tcu::RGBA		resultColor		= surface.getPixel(x, y);
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const bool			isOk			= compareThreshold(resultColor, expectedColor, threshold);
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (!isOk)
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (numFailedPixels < maxPrints)
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					log << TestLog::Message << "ERROR: Got " << resultColor << " at (" << x << ", " << y << ")!" << TestLog::EndMessage;
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				else if (numFailedPixels == maxPrints)
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					log << TestLog::Message << "..." << TestLog::EndMessage;
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				numFailedPixels += 1;
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (numFailedPixels > 0)
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Found " << numFailedPixels << " invalid pixels, comparison FAILED!" << TestLog::EndMessage;
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Image("ResultImage", "Result Image", surface);
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return false;
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Image comparison passed." << TestLog::EndMessage;
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return true;
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FragDataIndexingCase : public TestCase
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FragDataIndexingCase (Context& context, const char* name, const char* description, IndexExprType indexExprType)
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: TestCase			(context, name, description)
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		, m_indexExprType	(indexExprType)
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static glu::ProgramSources genSources (const IndexExprType indexExprType)
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char* const	fragIndexExpr	= indexExprType == INDEX_EXPR_STATIC	? "0"				:
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  indexExprType == INDEX_EXPR_UNIFORM	? "u_index"			:
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  indexExprType == INDEX_EXPR_DYNAMIC	? "int(v_index)"	: DE_NULL;
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glu::ProgramSources	sources;
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DE_ASSERT(fragIndexExpr);
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		sources << glu::VertexSource(
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"attribute highp vec4 a_position;\n"
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"attribute highp float a_index;\n"
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"attribute highp vec4 a_color;\n"
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"varying mediump float v_index;\n"
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"varying mediump vec4 v_color;\n"
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"void main (void)\n"
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"{\n"
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"	gl_Position = a_position;\n"
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"	v_color = a_color;\n"
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"	v_index = a_index;\n"
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"}\n");
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		sources << glu::FragmentSource(string(
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"varying mediump vec4 v_color;\n"
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"varying mediump float v_index;\n"
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"uniform mediump int u_index;\n"
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"void main (void)\n"
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"{\n"
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"	gl_FragData[") + fragIndexExpr + "] = v_color;\n"
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"}\n");
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return sources;
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult iterate (void)
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const glu::RenderContext&		renderCtx		= m_context.getRenderContext();
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const glw::Functions&			gl				= renderCtx.getFunctions();
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const glu::ShaderProgram		program			(renderCtx, genSources(m_indexExprType));
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int						viewportW		= de::min(renderCtx.getRenderTarget().getWidth(), 128);
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int						viewportH		= de::min(renderCtx.getRenderTarget().getHeight(), 128);
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const float positions[] =
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			-1.0f, -1.0f,
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			+1.0f, -1.0f,
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			-1.0f, +1.0f,
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			+1.0f, +1.0f
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const float colors[] =
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			0.0f, 1.0f, 0.0f, 1.0f,
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			0.0f, 1.0f, 0.0f, 1.0f,
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			0.0f, 1.0f, 0.0f, 1.0f,
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			0.0f, 1.0f, 0.0f, 1.0f
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const float		indexValues[]	= { 0.0f, 0.0f, 0.0f, 0.0f };
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const deUint8	indices[]		= { 0, 1, 2, 2, 1, 3 };
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const glu::VertexArrayBinding vertexArrays[] =
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glu::va::Float("a_position",	2, 4, 0, &positions[0]),
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glu::va::Float("a_color",		4, 4, 0, &colors[0]),
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glu::va::Float("a_index",		1, 4, 0, &indexValues[0])
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << program;
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!program.isOk())
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (m_indexExprType == INDEX_EXPR_STATIC)
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				TCU_FAIL("Compile failed");
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				throw tcu::NotSupportedError("Dynamic indexing of gl_FragData[] not supported");
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clearColor	(1.0f, 0.0f, 0.0f, 1.0f);
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clear		(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.viewport		(0, 0, viewportW, viewportH);
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.useProgram	(program.getProgram());
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.uniform1i	(gl.getUniformLocation(program.getProgram(), "u_index"), 0);
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glu::draw(renderCtx, program.getProgram(), DE_LENGTH_OF_ARRAY(vertexArrays), &vertexArrays[0],
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				  glu::pr::Triangles(DE_LENGTH_OF_ARRAY(indices), &indices[0]));
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Rendering failed");
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::Surface		result		(viewportW, viewportH);
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const tcu::RGBA		threshold	= renderCtx.getRenderTarget().getPixelFormat().getColorThreshold() + tcu::RGBA(1,1,1,1);
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bool				isOk;
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glu::readPixels(renderCtx, 0, 0, result.getAccess());
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "Reading pixels failed");
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
207c215aaa83047ebbaabafef7acd71275a256da6abDejan Mircevski			isOk = compareSingleColor(m_testCtx.getLog(), result, tcu::RGBA::green(), threshold);
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.setTestResult(isOk ? QP_TEST_RESULT_PASS	: QP_TEST_RESULT_FAIL,
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									isOk ? "Pass"				: "Image comparison failed");
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return STOP;
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const IndexExprType m_indexExprType;
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2223c827367444ee418f129b2c238299f49d3264554Jarkko PoyryShaderFragDataTests::ShaderFragDataTests (Context& context)
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(context, "fragdata", "gl_FragData[] Tests")
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2273c827367444ee418f129b2c238299f49d3264554Jarkko PoyryShaderFragDataTests::~ShaderFragDataTests (void)
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid ShaderFragDataTests::init (void)
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FragDataIndexingCase(m_context, "valid_static_index",	"Valid gl_FragData[] assignment using static index",	INDEX_EXPR_STATIC));
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FragDataIndexingCase(m_context, "valid_uniform_index",	"Valid gl_FragData[] assignment using uniform index",	INDEX_EXPR_UNIFORM));
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FragDataIndexingCase(m_context, "valid_dynamic_index",	"Valid gl_FragData[] assignment using dynamic index",	INDEX_EXPR_DYNAMIC));
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Negative cases.
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::ShaderLibrary library(m_testCtx, m_context.getRenderContext(), m_context.getContextInfo());
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::vector<tcu::TestNode*> negativeCases = library.loadShaderFile("shaders/fragdata.test");
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (std::vector<tcu::TestNode*>::iterator i = negativeCases.begin(); i != negativeCases.end(); i++)
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			addChild(*i);
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
250