13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL (ES) 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 Attribute location tests
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsAttributeLocationTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuStringTemplate.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDefs.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderUtil.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluStrUtil.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp"
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <map>
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <set>
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <sstream>
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string>
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <cstring>
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glw.h"
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog;
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector;
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::set;
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::map;
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::pair;
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace deqp::gls::AttributeLocationTestUtil;
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gls
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
663c827367444ee418f129b2c238299f49d3264554Jarkko PoyrydeInt32 getBoundLocation (const map<string, deUint32>& bindings, const string& attrib)
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::map<string, deUint32>::const_iterator iter = bindings.find(attrib);
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return (iter == bindings.end() ? (deInt32)Attribute::LOC_UNDEF : iter->second);
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool hasAttributeAliasing (const vector<Attribute>& attributes, const map<string, deUint32>& bindings)
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<bool> reservedSpaces;
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int attribNdx = 0; attribNdx < (int)attributes.size(); attribNdx++)
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const deInt32	location	= getBoundLocation(bindings, attributes[attribNdx].getName());
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const deUint32	size		= attributes[attribNdx].getType().getLocationSize();
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (location != Attribute::LOC_UNDEF)
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (reservedSpaces.size() < location + size)
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				reservedSpaces.resize(location + size, false);
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int i = 0; i < (int)size; i++)
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (reservedSpaces[location + i])
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					return true;
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				reservedSpaces[location + i] = true;
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return false;
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1003c827367444ee418f129b2c238299f49d3264554Jarkko PoyrydeInt32 getMaxAttributeLocations (glu::RenderContext& renderCtx)
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions& gl = renderCtx.getFunctions();
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32 maxAttribs;
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxAttribs);
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetIntegerv()");
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return maxAttribs;
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring generateAttributeDefinitions (const vector<Attribute>& attributes)
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::ostringstream src;
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (vector<Attribute>::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter)
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (iter->getLayoutLocation() != Attribute::LOC_UNDEF)
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src << "layout(location = " << iter->getLayoutLocation() << ") ";
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		src << "${VTX_INPUT} mediump "
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< iter->getType().getName() << " "
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< iter->getName()
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<<  (iter->getArraySize() != Attribute::NOT_ARRAY ? "[" + de::toString(iter->getArraySize()) + "]" : "") << ";\n";
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return src.str();
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring generateConditionUniformDefinitions (const vector<Attribute>& attributes)
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::ostringstream src;
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	set<string> conditions;
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (vector<Attribute>::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter)
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (iter->getCondition() != Cond::COND_NEVER && iter->getCondition() != Cond::COND_ALWAYS)
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			conditions.insert(iter->getCondition().getName());
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (set<string>::const_iterator iter = conditions.begin(); iter != conditions.end(); ++iter)
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src << "uniform mediump float u_" << (*iter) << ";\n";
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return src.str();
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring generateToVec4Expression (const Attribute& attrib, int id=-1)
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const string		variableName(attrib.getName() + (attrib.getArraySize() != Attribute::NOT_ARRAY ? "[" + de::toString(id) + "]" : ""));
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::ostringstream	src;
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	switch (attrib.getType().getGLTypeEnum())
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_INT_VEC2:
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_UNSIGNED_INT_VEC2:
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_FLOAT_VEC2:
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src << "vec4(" << variableName << ".xy, " << variableName << ".yx)";
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_INT_VEC3:
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_UNSIGNED_INT_VEC3:
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case GL_FLOAT_VEC3:
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src << "vec4(" << variableName << ".xyz, " << variableName << ".x)";
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src << "vec4(" << variableName << ")";
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return src.str();
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring generateOutputCode (const vector<Attribute>& attributes)
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::ostringstream src;
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (vector<Attribute>::const_iterator iter = attributes.begin(); iter != attributes.end(); ++iter)
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (iter->getCondition() == Cond::COND_NEVER)
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src <<
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\tif (0 != 0)\n"
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\t{\n";
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (iter->getArraySize() == Attribute::NOT_ARRAY)
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				src << "\t\tcolor += " << generateToVec4Expression(*iter) << ";\n";
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				for (int i = 0; i < iter->getArraySize(); i++)
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					src << "\t\tcolor += " << generateToVec4Expression(*iter, i) << ";\n";
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src << "\t}\n";
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else if (iter->getCondition() == Cond::COND_ALWAYS)
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (iter->getArraySize() == Attribute::NOT_ARRAY)
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				src << "\tcolor += " << generateToVec4Expression(*iter) << ";\n";
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				for (int i = 0; i < iter->getArraySize(); i++)
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					src << "\tcolor += " << generateToVec4Expression(*iter, i) << ";\n";
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src <<
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\tif (u_" << iter->getCondition().getName() << (iter->getCondition().getNegate() ? " != " : " == ") << "0.0)\n"
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\t{\n";
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (iter->getArraySize() == Attribute::NOT_ARRAY)
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				src << "\t\tcolor += " << generateToVec4Expression(*iter) << ";\n";
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				for (int i = 0; i < iter->getArraySize(); i++)
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					src << "\t\tcolor += " << generateToVec4Expression(*iter, i) << ";\n";
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			src <<
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\t}\n";
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return src.str();
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring generateVertexShaderTemplate (const vector<Attribute>& attributes)
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::ostringstream src;
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	src <<	"${VERSION}\n"
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"${VTX_OUTPUT} mediump vec4 v_color;\n";
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	src << generateAttributeDefinitions(attributes)
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		<< "\n"
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		<< generateConditionUniformDefinitions(attributes)
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		<< "\n";
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	src <<	"void main (void)\n"
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"{\n"
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\tmediump vec4 color = vec4(0.0);\n"
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\n";
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	src << generateOutputCode(attributes);
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	src <<	"\n"
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\tv_color = color;\n"
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"\tgl_Position = color;\n"
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			"}\n";
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return src.str();
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring createVertexShaderSource (glu::RenderContext& renderCtx, const vector<Attribute>& attributes, bool attributeAliasing)
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// \note On GLES only GLSL #version 100 supports aliasing
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glu::GLSLVersion		contextGLSLVersion		= glu::getContextTypeGLSLVersion(renderCtx.getType());
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glu::GLSLVersion		glslVersion				= (attributeAliasing && glu::glslVersionIsES(contextGLSLVersion) ? glu::GLSL_VERSION_100_ES : contextGLSLVersion);
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const bool					usesInOutQualifiers		= glu::glslVersionUsesInOutQualifiers(glslVersion);
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::StringTemplate	vertexShaderTemplate(generateVertexShaderTemplate(attributes));
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	map<string, string> parameters;
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["VERSION"]					= glu::getGLSLVersionDeclaration(glslVersion);
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["VTX_OUTPUT"]				= (usesInOutQualifiers ? "out"				: "varying");
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["VTX_INPUT"]					= (usesInOutQualifiers ? "in"				: "attribute");
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["FRAG_INPUT"]				= (usesInOutQualifiers ? "in"				: "varying");
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["FRAG_OUTPUT_VAR"]			= (usesInOutQualifiers ? "dEQP_FragColor"	: "gl_FragColor");
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["FRAG_OUTPUT_DECLARATION"]	= (usesInOutQualifiers
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													? "layout(location=0) out mediump vec4 dEQP_FragColor;"
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													: "");
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return vertexShaderTemplate.specialize(parameters);
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring createFragmentShaderSource (glu::RenderContext& renderCtx, bool attributeAliasing)
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char* const fragmentShaderSource =
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"${VERSION}\n"
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"${FRAG_OUTPUT_DECLARATION}\n"
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"${FRAG_INPUT} mediump vec4 v_color;\n"
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"void main (void)\n"
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"{\n"
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"\t${FRAG_OUTPUT_VAR} = v_color;\n"
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		"}\n";
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// \note On GLES only GLSL #version 100 supports aliasing
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glu::GLSLVersion		contextGLSLVersion		= glu::getContextTypeGLSLVersion(renderCtx.getType());
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glu::GLSLVersion		glslVersion				= (attributeAliasing && glu::glslVersionIsES(contextGLSLVersion) ? glu::GLSL_VERSION_100_ES : contextGLSLVersion);
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::StringTemplate	fragmentShaderTemplate(fragmentShaderSource);
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const bool					usesInOutQualifiers		= glu::glslVersionUsesInOutQualifiers(glslVersion);
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	map<string, string> parameters;
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["VERSION"]					= glu::getGLSLVersionDeclaration(glslVersion);
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["VTX_OUTPUT"]				= (usesInOutQualifiers ? "out"				: "varying");
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["VTX_INPUT"]					= (usesInOutQualifiers ? "in"				: "attribute");
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["FRAG_INPUT"]				= (usesInOutQualifiers ? "in"				: "varying");
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["FRAG_OUTPUT_VAR"]			= (usesInOutQualifiers ? "dEQP_FragColor"	: "gl_FragColor");
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	parameters["FRAG_OUTPUT_DECLARATION"]	= (usesInOutQualifiers
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													? "layout(location=0) out mediump vec4 dEQP_FragColor;"
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													: "");
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return fragmentShaderTemplate.specialize(parameters);
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring getShaderInfoLog (const glw::Functions& gl, deUint32 shader)
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32	length = 0;
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string	infoLog;
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetShaderiv()");
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	infoLog.resize(length, '\0');
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getShaderInfoLog(shader, (glw::GLsizei)infoLog.length(), DE_NULL, &(infoLog[0]));
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetShaderInfoLog()");
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return infoLog;
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool getShaderCompileStatus (const glw::Functions& gl, deUint32 shader)
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32 status;
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getShaderiv(shader, GL_COMPILE_STATUS, &status);
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetShaderiv()");
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return status == GL_TRUE;
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring getProgramInfoLog (const glw::Functions& gl, deUint32 program)
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32	length = 0;
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string	infoLog;
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &length);
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetProgramiv()");
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	infoLog.resize(length, '\0');
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getProgramInfoLog(program, (glw::GLsizei)infoLog.length(), DE_NULL, &(infoLog[0]));
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetProgramInfoLog()");
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return infoLog;
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool getProgramLinkStatus (const glw::Functions& gl, deUint32 program)
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32 status;
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getProgramiv(program, GL_LINK_STATUS, &status);
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetProgramiv()");
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return status == GL_TRUE;
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid logProgram (TestLog& log, const glw::Functions& gl, deUint32 program)
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const bool				programLinkOk	= getProgramLinkStatus(gl, program);
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const string			programInfoLog	= getProgramInfoLog(gl, program);
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::ScopedLogSection	linkInfo		(log, "Program Link Info", "Program Link Info");
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::ScopedLogSection infoLogSection(log, "Info Log", "Info Log");
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << programInfoLog << TestLog::EndMessage;
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log << TestLog::Message << "Link result: " << (programLinkOk ? "Ok" : "Fail") << TestLog::EndMessage;
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid logShaders (TestLog&		log,
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const string&	vertexShaderSource,
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const string&	vertexShaderInfoLog,
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				bool			vertexCompileOk,
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const string&	fragmentShaderSource,
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const string&	fragmentShaderInfoLog,
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				bool			fragmentCompileOk)
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// \todo [mika] Log as real shader elements. Currently not supported by TestLog.
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::ScopedLogSection shaderSection(log, "Vertex Shader Info", "Vertex Shader Info");
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::KernelSource(vertexShaderSource);
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::ScopedLogSection infoLogSection(log, "Info Log", "Info Log");
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << vertexShaderInfoLog << TestLog::EndMessage;
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Compilation result: " << (vertexCompileOk ? "Ok" : "Failed") << TestLog::EndMessage;
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::ScopedLogSection shaderSection(log, "Fragment Shader Info", "Fragment Shader Info");
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::KernelSource(fragmentShaderSource);
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::ScopedLogSection infoLogSection(log, "Info Log", "Info Log");
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << fragmentShaderInfoLog << TestLog::EndMessage;
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Compilation result: " << (fragmentCompileOk ? "Ok" : "Failed") << TestLog::EndMessage;
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypair<deUint32, deUint32> createAndAttachShaders (TestLog& log, glu::RenderContext& renderCtx, deUint32 program, const vector<Attribute>& attributes, bool attributeAliasing)
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions&	gl						= renderCtx.getFunctions();
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const string			vertexShaderSource		= createVertexShaderSource(renderCtx, attributes, attributeAliasing);
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const string			fragmentShaderSource	= createFragmentShaderSource(renderCtx, attributeAliasing);
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deUint32			vertexShader			= gl.createShader(GL_VERTEX_SHADER);
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deUint32			fragmentShader			= gl.createShader(GL_FRAGMENT_SHADER);
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glCreateShader()");
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const char* const vertexShaderString	= vertexShaderSource.c_str();
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const char* const fragmentShaderString	= fragmentShaderSource.c_str();
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.shaderSource(vertexShader, 1, &vertexShaderString, DE_NULL);
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.shaderSource(fragmentShader, 1, &fragmentShaderString, DE_NULL);
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glShaderSource()");
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.compileShader(vertexShader);
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.compileShader(fragmentShader);
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glCompileShader()");
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.attachShader(program, vertexShader);
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.attachShader(program, fragmentShader);
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glAttachShader()");
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const bool		vertexCompileOk			= getShaderCompileStatus(gl, vertexShader);
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const bool		fragmentCompileOk		= getShaderCompileStatus(gl, fragmentShader);
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const string	vertexShaderInfoLog		= getShaderInfoLog(gl, vertexShader);
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const string	fragmentShaderInfoLog	= getShaderInfoLog(gl, fragmentShader);
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			logShaders(log, vertexShaderSource, vertexShaderInfoLog, vertexCompileOk, fragmentShaderSource, fragmentShaderInfoLog, fragmentCompileOk);
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_CHECK_MSG(vertexCompileOk, "Vertex shader compilation failed");
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_CHECK_MSG(fragmentCompileOk, "Fragment shader compilation failed");
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteShader(vertexShader);
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteShader(fragmentShader);
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return pair<deUint32, deUint32>(vertexShader, fragmentShader);
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (vertexShader != 0)
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteShader(vertexShader);
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (fragmentShader != 0)
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteShader(fragmentShader);
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid bindAttributes (TestLog& log, const glw::Functions& gl, deUint32 program, const vector<Bind>& binds)
4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (vector<Bind>::const_iterator iter = binds.begin(); iter != binds.end(); ++iter)
4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Bind attribute: '" << iter->getAttributeName() << "' to " << iter->getLocation() << TestLog::EndMessage;
4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.bindAttribLocation(program, iter->getLocation(), iter->getAttributeName().c_str());
4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glBindAttribLocation()");
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid logAttributes (TestLog& log, const vector<Attribute>& attributes)
4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int attribNdx = 0; attribNdx < (int)attributes.size(); attribNdx++)
4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const Attribute& attrib = attributes[attribNdx];
4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message
4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< "Type: " << attrib.getType().getName()
4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< ", Name: " << attrib.getName()
4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (attrib.getLayoutLocation()	!= Attribute::LOC_UNDEF ? ", Layout location "	+ de::toString(attrib.getLayoutLocation()) : "")
4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< TestLog::EndMessage;
4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool checkActiveAttribQuery (TestLog& log, const glw::Functions& gl, deUint32 program, const vector<Attribute>& attributes)
4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32					activeAttribCount = 0;
5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	set<string>				activeAttributes;
5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					isOk = true;
5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.getProgramiv(program, GL_ACTIVE_ATTRIBUTES, &activeAttribCount);
5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &activeAttribCount)");
5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int activeAttribNdx = 0; activeAttribNdx < activeAttribCount; activeAttribNdx++)
5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		char			name[128];
5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const size_t	maxNameSize = DE_LENGTH_OF_ARRAY(name) - 1;
5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deInt32			length = 0;
5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deInt32			size = 0;
5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint32		type = 0;
5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::memset(name, 0, sizeof(name));
5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.getActiveAttrib(program, activeAttribNdx, maxNameSize, &length, &size, &type, name);
5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glGetActiveAttrib()");
5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message
5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< "glGetActiveAttrib(program"
5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< ", index=" << activeAttribNdx
5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< ", bufSize=" << maxNameSize
5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< ", length=" << length
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< ", size=" << size
5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< ", type=" << glu::getShaderVarTypeStr(type)
5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< ", name='" << name << "')" << TestLog::EndMessage;
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bool found = false;
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int attribNdx = 0; attribNdx < (int)attributes.size(); attribNdx++)
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const Attribute& attrib = attributes[attribNdx];
5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (attrib.getName() == name)
5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				{
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					if (type != attrib.getType().getGLTypeEnum())
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					{
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						log << TestLog::Message
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							<< "Error: Wrong type " << glu::getShaderVarTypeStr(type)
5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							<< " expected " << glu::getShaderVarTypeStr(attrib.getType().getGLTypeEnum())
5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							<< TestLog::EndMessage;
5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						isOk = false;
5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					}
5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					if (attrib.getArraySize() == Attribute::NOT_ARRAY)
5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					{
5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						if (size != 1)
5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						{
5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							log << TestLog::Message << "Error: Wrong size " << size << " expected " << 1 << TestLog::EndMessage;
5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							isOk = false;
5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						}
5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					}
5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					else
5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					{
5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						if (size != attrib.getArraySize())
5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						{
5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							log << TestLog::Message << "Error: Wrong size " << size << " expected " << attrib.getArraySize() << TestLog::EndMessage;
5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							isOk = false;
5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						}
5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					}
5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					found = true;
5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					break;
5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				}
5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (!found)
5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				log << TestLog::Message << "Error: Unknown attribute '" << name << "' returned by glGetActiveAttrib()." << TestLog::EndMessage;
5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		activeAttributes.insert(name);
5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int attribNdx = 0; attribNdx < (int)attributes.size(); attribNdx++)
5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const Attribute&	attrib		= attributes[attribNdx];
5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const bool			isActive	= attrib.getCondition() != Cond::COND_NEVER;
5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (isActive)
5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (activeAttributes.find(attrib.getName()) == activeAttributes.end())
5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				log << TestLog::Message << "Error: Active attribute " << attrib.getName() << " wasn't returned by glGetActiveAttrib()." << TestLog::EndMessage;
5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (activeAttributes.find(attrib.getName()) != activeAttributes.end())
5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				log << TestLog::Message << "Note: Inactive attribute " << attrib.getName() << " was returned by glGetActiveAttrib()." << TestLog::EndMessage;
5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return isOk;
6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool checkAttribLocationQuery (TestLog& log, const glw::Functions& gl, deUint32 program, const vector<Attribute>& attributes, const map<string, deUint32>& bindings)
6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool isOk = true;
6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int attribNdx = 0; attribNdx < (int)attributes.size(); attribNdx++)
6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const Attribute&	attrib				= attributes[attribNdx];
6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const deInt32		expectedLocation	= (attrib.getLayoutLocation() != Attribute::LOC_UNDEF ? attrib.getLayoutLocation() : getBoundLocation(bindings, attrib.getName()));
6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const deInt32		location			= gl.getAttribLocation(program, attrib.getName().c_str());
6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glGetAttribLocation()");
6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message
6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< location << " = glGetAttribLocation(program, \"" << attrib.getName() << "\")"
6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< (attrib.getCondition() != Cond::COND_NEVER && expectedLocation != Attribute::LOC_UNDEF ? ", expected " + de::toString(expectedLocation) : "")
6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< "." << TestLog::EndMessage;
6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (attrib.getCondition() == Cond::COND_NEVER && location != -1)
6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "\tNote: Inactive attribute with location." << TestLog::EndMessage;
6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (attrib.getCondition() != Cond::COND_NEVER && expectedLocation != Attribute::LOC_UNDEF && expectedLocation != location)
6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "\tError: Invalid attribute location." << TestLog::EndMessage;
6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		isOk &= (attrib.getCondition() == Cond::COND_NEVER || expectedLocation == Attribute::LOC_UNDEF || expectedLocation == location);
6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return isOk;
6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool checkQuery (TestLog& log, const glw::Functions& gl, deUint32 program, const vector<Attribute>& attributes, const map<string, deUint32>& bindings)
6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool isOk = checkActiveAttribQuery(log, gl, program, attributes);
6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!checkAttribLocationQuery(log, gl, program, attributes, bindings))
6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		isOk = false;
6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return isOk;
6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring generateTestName (const AttribType& type, int arraySize)
6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return type.getName() + (arraySize != Attribute::NOT_ARRAY ? "_array_" + de::toString(arraySize) : "");
6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace AttributeLocationTestUtil
6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6513c827367444ee418f129b2c238299f49d3264554Jarkko PoyryAttribType::AttribType (const string& name, deUint32 localSize, deUint32 typeEnum)
6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: m_name			(name)
6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_locationSize	(localSize)
6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_glTypeEnum		(typeEnum)
6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6583c827367444ee418f129b2c238299f49d3264554Jarkko PoyryCond::Cond (const string& name, bool negate)
6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: m_negate	(negate)
6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_name	(name)
6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6643c827367444ee418f129b2c238299f49d3264554Jarkko PoyryCond::Cond (ConstCond cond)
6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: m_negate	(cond != COND_NEVER)
6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_name	("__always__")
6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(cond == COND_ALWAYS || cond == COND_NEVER);
6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6713c827367444ee418f129b2c238299f49d3264554Jarkko PoyryAttribute::Attribute (const AttribType& type, const string& name, deInt32 layoutLocation, const Cond& cond, int arraySize)
6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: m_type			(type)
6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_name			(name)
6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_layoutLocation	(layoutLocation)
6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_cond			(cond)
6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize		(arraySize)
6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6803c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBind::Bind (const std::string& attribute, deUint32 location)
6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: m_attribute	(attribute)
6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_location	(location)
6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid runTest (tcu::TestContext&			testCtx,
6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			glu::RenderContext&			renderCtx,
6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const vector<Attribute>&	attributes,
6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const vector<Bind>&			preAttachBind,
6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const vector<Bind>&			preLinkBind,
6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const vector<Bind>&			postLinkBind,
6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bool						relink,
6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bool						reattach = false,
6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const vector<Attribute>&	reattachAttributes = vector<Attribute>())
6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog&					log			= testCtx.getLog();
6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions&		gl			= renderCtx.getFunctions();
6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32					program 	= 0;
6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	pair<deUint32, deUint32>	shaders;
7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bool					isOk			= true;
7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		map<string, deUint32>	activeBindings;
7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int bindNdx = 0; bindNdx < (int)preAttachBind.size(); bindNdx++)
7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			activeBindings[preAttachBind[bindNdx].getAttributeName()] = preAttachBind[bindNdx].getLocation();
7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int bindNdx = 0; bindNdx < (int)preLinkBind.size(); bindNdx++)
7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			activeBindings[preLinkBind[bindNdx].getAttributeName()] = preLinkBind[bindNdx].getLocation();
7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::ScopedLogSection section(log, "Attributes", "Attribute information");
7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			logAttributes(testCtx.getLog(), attributes);
7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Create program." << TestLog::EndMessage;
7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		program = gl.createProgram();
7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glCreateProgram()");
7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!preAttachBind.empty())
7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bindAttributes(log, gl, program, preAttachBind);
7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Create and attach shaders to program." << TestLog::EndMessage;
7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		shaders = createAndAttachShaders(log, renderCtx, program, attributes, hasAttributeAliasing(attributes, activeBindings));
7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!preLinkBind.empty())
7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bindAttributes(log, gl, program, preLinkBind);
7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Link program." << TestLog::EndMessage;
7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.linkProgram(program);
7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glLinkProgram()");
7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		logProgram(log, gl, program);
7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_MSG(getProgramLinkStatus(gl, program), "Program link failed");
7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!checkQuery(log, gl, program, attributes, activeBindings))
7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			isOk = false;
7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!postLinkBind.empty())
7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bindAttributes(log, gl, program, postLinkBind);
7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (!checkQuery(log, gl, program, attributes, activeBindings))
7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (relink)
7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Relink program." << TestLog::EndMessage;
7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.linkProgram(program);
7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glLinkProgram()");
7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			logProgram(log, gl, program);
7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_CHECK_MSG(getProgramLinkStatus(gl, program), "Program link failed");
7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int bindNdx = 0; bindNdx < (int)postLinkBind.size(); bindNdx++)
7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				activeBindings[postLinkBind[bindNdx].getAttributeName()] = postLinkBind[bindNdx].getLocation();
7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (!checkQuery(log, gl, program, attributes, activeBindings))
7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (reattach)
7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.detachShader(program, shaders.first);
7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.detachShader(program, shaders.second);
7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glDetachShader()");
7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Create and attach shaders to program." << TestLog::EndMessage;
7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			createAndAttachShaders(log, renderCtx, program, reattachAttributes, hasAttributeAliasing(reattachAttributes, activeBindings));
7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Relink program." << TestLog::EndMessage;
7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.linkProgram(program);
7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "glLinkProgram()");
7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			logProgram(log, gl, program);
7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_CHECK_MSG(getProgramLinkStatus(gl, program), "Program link failed");
7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (!checkQuery(log, gl, program, reattachAttributes, activeBindings))
7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteProgram(program);
7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glDeleteProgram()");
7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (isOk)
7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (program)
7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteProgram(program);
7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // AttributeLocationTestUtil
8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8043c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindAttributeTest::BindAttributeTest (tcu::TestContext&		testCtx,
8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									  glu::RenderContext&	renderCtx,
8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									  const AttribType&		type,
8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									  int					arraySize)
8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindAttributeTest::iterate (void)
8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
8213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_0", Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 3));
8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8293c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindMaxAttributesTest::BindMaxAttributesTest (tcu::TestContext&		testCtx,
8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  glu::RenderContext&	renderCtx,
8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  const AttribType&		type,
8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  int					arraySize)
8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx,  generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindMaxAttributesTest::iterate (void)
8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes		= getMaxAttributeLocations(m_renderCtx);
8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx = 0;
8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_testCtx.getLog() << TestLog::Message << "GL_MAX_VERTEX_ATTRIBS: " << maxAttributes << TestLog::EndMessage;
8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = maxAttributes - (arrayElementCount * m_type.getLocationSize()); loc >= 0; loc -= (arrayElementCount * m_type.getLocationSize()))
8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx), Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bindings.push_back(Bind("a_" + de::toString(ndx), loc));
8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8633c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindAliasingAttributeTest::BindAliasingAttributeTest (tcu::TestContext&		testCtx,
8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  glu::RenderContext&	renderCtx,
8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  const AttribType&		type,
8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  int					offset,
8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  int					arraySize)
8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx,	("cond_" + generateTestName(type, arraySize) + (offset != 0 ? "_offset_" + de::toString(offset) : "")).c_str(),
8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								("cond_" + generateTestName(type, arraySize) + (offset != 0 ? "_offset_" + de::toString(offset) : "")).c_str())
8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_offset		(offset)
8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindAliasingAttributeTest::iterate (void)
8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
8823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_0", Attribute::LOC_UNDEF, Cond("A", true), m_arraySize));
8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(AttribType("vec4", 1, GL_FLOAT_VEC4), "a_1", Attribute::LOC_UNDEF, Cond("A", false)));
8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 1));
8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_1", 1 + m_offset));
8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
8933c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindMaxAliasingAttributeTest::BindMaxAliasingAttributeTest (tcu::TestContext&	testCtx,
8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry															glu::RenderContext&	renderCtx,
8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry															const AttribType&	type,
8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry															int					arraySize)
8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, ("max_cond_" + generateTestName(type, arraySize)).c_str(), ("max_cond_" + generateTestName(type, arraySize)).c_str())
8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindMaxAliasingAttributeTest::iterate (void)
9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes		= getMaxAttributeLocations(m_renderCtx);
9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx = 0;
9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_testCtx.getLog() << TestLog::Message << "GL_MAX_VERTEX_ATTRIBS: " << maxAttributes << TestLog::EndMessage;
9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = maxAttributes - arrayElementCount * m_type.getLocationSize(); loc >= 0; loc -= m_type.getLocationSize() * arrayElementCount)
9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx), Attribute::LOC_UNDEF, Cond("A", true)));
9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bindings.push_back(Bind("a_" + de::toString(ndx), loc));
9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx + maxAttributes), Attribute::LOC_UNDEF, Cond("A", false)));
9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bindings.push_back(Bind("a_" + de::toString(ndx + maxAttributes), loc));
9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9303c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindHoleAttributeTest::BindHoleAttributeTest (tcu::TestContext&		testCtx,
9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  glu::RenderContext&	renderCtx,
9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  const AttribType&		type,
9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  int					arraySize)
9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindHoleAttributeTest::iterate (void)
9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes = getMaxAttributeLocations(m_renderCtx);
9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4("vec4", 1, GL_FLOAT_VEC4);
9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx;
9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0"));
9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 0));
9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_1", Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ndx = 2;
9583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = 1 + m_type.getLocationSize() * arrayElementCount; loc < maxAttributes; loc++)
9593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(vec4, "a_" + de::toString(ndx)));
9613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bindings.push_back(Bind("a_" + de::toString(ndx), loc));
9623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
9643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
9653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
9673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
9683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
9693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9703c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindInactiveAliasingAttributeTest::BindInactiveAliasingAttributeTest (tcu::TestContext&		testCtx,
9713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry																	  glu::RenderContext&	renderCtx,
9723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry																	  const AttribType&		type,
9733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry																	  int					arraySize)
9743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx,	("max_inactive_" + generateTestName(type, arraySize)).c_str(),
9753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								("max_inactive_" + generateTestName(type, arraySize)).c_str())
9763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
9773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
9783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
9793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
9813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9823c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindInactiveAliasingAttributeTest::iterate (void)
9833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
9843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
9853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes		= getMaxAttributeLocations(m_renderCtx);
9863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
9873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
9893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
9903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx = 0;
9913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_testCtx.getLog() << TestLog::Message << "GL_MAX_VERTEX_ATTRIBS: " << maxAttributes << TestLog::EndMessage;
9933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = maxAttributes - arrayElementCount * m_type.getLocationSize(); loc >= 0; loc -= m_type.getLocationSize() * arrayElementCount)
9953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
9963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx), Attribute::LOC_UNDEF, Cond("A")));
9973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bindings.push_back(Bind("a_" + de::toString(ndx), loc));
9983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
9993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx + maxAttributes), Attribute::LOC_UNDEF, Cond::COND_NEVER));
10003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bindings.push_back(Bind("a_" + de::toString(ndx + maxAttributes), loc));
10013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
10023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
10033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
10053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
10063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10083c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPreAttachBindAttributeTest::PreAttachBindAttributeTest (tcu::TestContext&	testCtx,
10093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														glu::RenderContext&	renderCtx)
10103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "pre_attach", "pre_attach")
10113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
10123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10153c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult PreAttachBindAttributeTest::iterate (void)
10163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
10183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
10203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
10213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(AttribType("vec4", 1, GL_FLOAT_VEC4), "a_0"));
10233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 3));
10243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, bindings, noBindings, noBindings, false);
10263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
10273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10293c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPreLinkBindAttributeTest::PreLinkBindAttributeTest (tcu::TestContext&	testCtx,
10303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													glu::RenderContext&	renderCtx)
10313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "pre_link", "pre_link")
10323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
10333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult PreLinkBindAttributeTest::iterate (void)
10373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
10393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
10413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
10423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(AttribType("vec4", 1, GL_FLOAT_VEC4), "a_0"));
10443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 3));
10453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
10473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
10483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10503c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPostLinkBindAttributeTest::PostLinkBindAttributeTest (tcu::TestContext&		testCtx,
10513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  glu::RenderContext&	renderCtx)
10523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "post_link", "post_link")
10533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
10543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10573c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult PostLinkBindAttributeTest::iterate (void)
10583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
10603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
10623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
10633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(AttribType("vec4", 1, GL_FLOAT_VEC4), "a_0"));
10653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 3));
10663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, noBindings, bindings, false);
10683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
10693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10713c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLocationAttributeTest::LocationAttributeTest (tcu::TestContext&		testCtx,
10723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  glu::RenderContext&	renderCtx,
10733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  const AttribType&		type,
10743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  int					arraySize)
10753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
10763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
10773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
10783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
10793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10823c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult LocationAttributeTest::iterate (void)
10833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
10843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
10853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
10873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_0", 3, Cond::COND_ALWAYS, m_arraySize));
10893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, noBindings, noBindings, false);
10913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
10923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
10933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
10943c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLocationMaxAttributesTest::LocationMaxAttributesTest (tcu::TestContext&		testCtx,
10953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  glu::RenderContext&	renderCtx,
10963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  const AttribType&		type,
10973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  int					arraySize)
10983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
10993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
11003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
11013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
11023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
11043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11053c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult LocationMaxAttributesTest::iterate (void)
11063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
11083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes		= getMaxAttributeLocations(m_renderCtx);
11093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
11103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
11123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx = 0;
11133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_testCtx.getLog() << TestLog::Message << "GL_MAX_VERTEX_ATTRIBS: " << maxAttributes << TestLog::EndMessage;
11153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = maxAttributes - (arrayElementCount * m_type.getLocationSize()); loc >= 0; loc -= (arrayElementCount * m_type.getLocationSize()))
11173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx), loc, Cond::COND_ALWAYS, m_arraySize));
11193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
11203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
11213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, noBindings, noBindings, false);
11233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
11243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
11253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11263c827367444ee418f129b2c238299f49d3264554Jarkko PoyryLocationHoleAttributeTest::LocationHoleAttributeTest (tcu::TestContext&		testCtx,
11273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  glu::RenderContext&	renderCtx,
11283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  const AttribType&		type,
11293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  int					arraySize)
11303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
11313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
11323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
11333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
11343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
11363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult LocationHoleAttributeTest::iterate (void)
11383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
11403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes = getMaxAttributeLocations(m_renderCtx);
11413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4("vec4", 1, GL_FLOAT_VEC4);
11423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
11433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
11453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx;
11463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0", 0));
11483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_1", Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
11503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ndx = 2;
11523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = 1 + m_type.getLocationSize() * arrayElementCount; loc < maxAttributes; loc++)
11533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
11543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(vec4, "a_" + de::toString(ndx), loc));
11553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
11563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
11573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, noBindings, noBindings, false);
11593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
11603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
11613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11623c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMixedAttributeTest::MixedAttributeTest (tcu::TestContext&	testCtx,
11633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										glu::RenderContext&	renderCtx,
11643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										const AttribType&	type,
11653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										int					arraySize)
11663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
11673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
11683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
11693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
11703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
11723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11733c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult MixedAttributeTest::iterate (void)
11743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
11763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
11783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
11793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_0", 3, Cond::COND_ALWAYS, m_arraySize));
11813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 4));
11823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
11843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
11853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
11863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11873c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMixedMaxAttributesTest::MixedMaxAttributesTest (tcu::TestContext&	testCtx,
11883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												glu::RenderContext&	renderCtx,
11893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												const AttribType&	type,
11903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												int					arraySize)
11913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
11923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
11933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
11943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
11953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
11963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
11973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
11983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult MixedMaxAttributesTest::iterate (void)
11993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
12013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes		= getMaxAttributeLocations(m_renderCtx);
12023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
12033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
12053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
12063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx = 0;
12073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_testCtx.getLog() << TestLog::Message << "GL_MAX_VERTEX_ATTRIBS: " << maxAttributes << TestLog::EndMessage;
12093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = maxAttributes - (arrayElementCount * m_type.getLocationSize()); loc >= 0; loc -= (arrayElementCount * m_type.getLocationSize()))
12113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if ((ndx % 2) != 0)
12133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx), loc, Cond::COND_ALWAYS, m_arraySize));
12143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
12153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
12163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attributes.push_back(Attribute(m_type, "a_" + de::toString(ndx), Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
12173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bindings.push_back(Bind("a_" + de::toString(ndx), loc));
12183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
12203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
12213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
12243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
12253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
12263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12273c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMixedHoleAttributeTest::MixedHoleAttributeTest (tcu::TestContext&		testCtx,
12283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												glu::RenderContext&		renderCtx,
12293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												const AttribType&		type,
12303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												int						arraySize)
12313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
12323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
12333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
12343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
12353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
12373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult MixedHoleAttributeTest::iterate (void)
12393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
12413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes = getMaxAttributeLocations(m_renderCtx);
12423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4("vec4", 1, GL_FLOAT_VEC4);
12433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
12443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
12463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
12473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx;
12483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0"));
12503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 0));
12513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_1", Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
12533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ndx = 2;
12553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = 1 + m_type.getLocationSize() * arrayElementCount; loc < maxAttributes; loc++)
12563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
12573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if ((ndx % 2) != 0)
12583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attributes.push_back(Attribute(vec4, "a_" + de::toString(ndx), loc));
12593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
12603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
12613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attributes.push_back(Attribute(vec4, "a_" + de::toString(ndx), loc));
12623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bindings.push_back(Bind("a_" + de::toString(ndx), loc));
12633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
12653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
12663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
12673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
12693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
12703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
12713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12723c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindRelinkAttributeTest::BindRelinkAttributeTest (tcu::TestContext&		testCtx,
12733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												  glu::RenderContext&	renderCtx)
12743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "relink", "relink")
12753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
12763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
12783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12793c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindRelinkAttributeTest::iterate (void)
12803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
12813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
12823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4("vec4", 1, GL_FLOAT_VEC4);
12833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
12853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		preLinkBindings;
12863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		postLinkBindings;
12873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0"));
12893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_1"));
12903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	preLinkBindings.push_back(Bind("a_0", 3));
12923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	preLinkBindings.push_back(Bind("a_0", 5));
12933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	postLinkBindings.push_back(Bind("a_0", 6));
12953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
12963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, preLinkBindings, postLinkBindings, true);
12973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
12983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
12993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13003c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindRelinkHoleAttributeTest::BindRelinkHoleAttributeTest (tcu::TestContext&		testCtx,
13013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														  glu::RenderContext&	renderCtx,
13023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														  const AttribType&		type,
13033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														  int					arraySize)
13043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
13053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
13063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
13073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
13083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
13093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
13103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13113c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindRelinkHoleAttributeTest::iterate (void)
13123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
13133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
13143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes		= getMaxAttributeLocations(m_renderCtx);
13153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4				("vec4", 1, GL_FLOAT_VEC4);
13163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
13173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
13193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		preLinkBindings;
13203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		postLinkBindings;
13213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx;
13223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0"));
13243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	preLinkBindings.push_back(Bind("a_0", 0));
13253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_1", Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
13273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ndx = 2;
13293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = 1 + m_type.getLocationSize() * arrayElementCount; loc < maxAttributes; loc++)
13303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		attributes.push_back(Attribute(vec4, "a_" + de::toString(ndx)));
13323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		preLinkBindings.push_back(Bind("a_" + de::toString(ndx), loc));
13333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
13353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
13363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	postLinkBindings.push_back(Bind("a_2", 1));
13383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, preLinkBindings, postLinkBindings, true);
13403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
13413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
13423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13433c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMixedRelinkHoleAttributeTest::MixedRelinkHoleAttributeTest (tcu::TestContext&		testCtx,
13443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry															glu::RenderContext&		renderCtx,
13453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry															const AttribType&		type,
13463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry															int						arraySize)
13473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, generateTestName(type, arraySize).c_str(), generateTestName(type, arraySize).c_str())
13483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
13493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_type		(type)
13503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_arraySize	(arraySize)
13513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
13523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
13533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13543c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult MixedRelinkHoleAttributeTest::iterate (void)
13553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
13563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
13573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deInt32		maxAttributes		= getMaxAttributeLocations(m_renderCtx);
13583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4				("vec4", 1, GL_FLOAT_VEC4);
13593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int			arrayElementCount	= (m_arraySize != Attribute::NOT_ARRAY ? m_arraySize : 1);
13603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		preLinkBindings;
13623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		postLinkBindings;
13633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
13643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					ndx;
13653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0"));
13673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	preLinkBindings.push_back(Bind("a_0", 0));
13683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(m_type, "a_1", Attribute::LOC_UNDEF, Cond::COND_ALWAYS, m_arraySize));
13703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ndx = 2;
13723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int loc = 1 + m_type.getLocationSize() * arrayElementCount; loc < maxAttributes; loc++)
13733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
13743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if ((ndx % 2) != 0)
13753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attributes.push_back(Attribute(vec4, "a_" + de::toString(ndx), loc));
13763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
13773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
13783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attributes.push_back(Attribute(vec4, "a_" + de::toString(ndx)));
13793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			preLinkBindings.push_back(Bind("a_" + de::toString(ndx), loc));
13803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
13823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		ndx++;
13833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
13843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	postLinkBindings.push_back(Bind("a_2", 1));
13863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, preLinkBindings, postLinkBindings, true);
13883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
13893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
13903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13913c827367444ee418f129b2c238299f49d3264554Jarkko PoyryBindReattachAttributeTest::BindReattachAttributeTest (tcu::TestContext&		testCtx,
13923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													  glu::RenderContext&	renderCtx)
13933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "reattach", "reattach")
13943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
13953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
13963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
13973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
13983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult BindReattachAttributeTest::iterate (void)
13993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
14013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4("vec4", 1, GL_FLOAT_VEC4);
14023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec2("vec2", 1, GL_FLOAT_VEC2);
14033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
14053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
14063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	reattachAttributes;
14073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0"));
14093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 1));
14103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_1", 1));
14113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	reattachAttributes.push_back(Attribute(vec2, "a_1"));
14133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false, true, reattachAttributes);
14153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
14163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14183c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPreAttachMixedAttributeTest::PreAttachMixedAttributeTest (tcu::TestContext&	testCtx,
14193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														glu::RenderContext&	renderCtx)
14203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "pre_attach", "pre_attach")
14213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
14223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14253c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult PreAttachMixedAttributeTest::iterate (void)
14263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
14283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
14303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
14313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(AttribType("vec4", 1, GL_FLOAT_VEC4), "a_0", 1));
14333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 3));
14343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, bindings, noBindings, noBindings, false);
14363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
14373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14393c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPreLinkMixedAttributeTest::PreLinkMixedAttributeTest (tcu::TestContext&	testCtx,
14403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													glu::RenderContext&	renderCtx)
14413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "pre_link", "pre_link")
14423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
14433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult PreLinkMixedAttributeTest::iterate (void)
14473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
14493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
14513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
14523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(AttribType("vec4", 1, GL_FLOAT_VEC4), "a_0", 1));
14543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 3));
14553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false);
14573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
14583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14603c827367444ee418f129b2c238299f49d3264554Jarkko PoyryPostLinkMixedAttributeTest::PostLinkMixedAttributeTest (tcu::TestContext&	testCtx,
14613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														glu::RenderContext&	renderCtx)
14623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "post_link", "post_link")
14633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
14643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14673c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult PostLinkMixedAttributeTest::iterate (void)
14683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
14703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
14723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
14733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(AttribType("vec4", 1, GL_FLOAT_VEC4), "a_0", 1));
14753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 3));
14763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, noBindings, bindings, false);
14783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
14793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14813c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMixedReattachAttributeTest::MixedReattachAttributeTest (tcu::TestContext&	testCtx,
14823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry														glu::RenderContext&	renderCtx)
14833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "reattach", "reattach")
14843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
14853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
14873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14883c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult MixedReattachAttributeTest::iterate (void)
14893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
14903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
14913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4("vec4", 1, GL_FLOAT_VEC4);
14923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec2("vec2", 1, GL_FLOAT_VEC2);
14933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		bindings;
14953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
14963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	reattachAttributes;
14973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
14983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0", 2));
14993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_0", 1));
15003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bindings.push_back(Bind("a_1", 1));
15013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	reattachAttributes.push_back(Attribute(vec2, "a_1"));
15033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, bindings, noBindings, false, true, reattachAttributes);
15053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
15063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
15073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15083c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMixedRelinkAttributeTest::MixedRelinkAttributeTest (tcu::TestContext&	testCtx,
15093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry													glu::RenderContext&	renderCtx)
15103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(testCtx, "relink", "relink")
15113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_renderCtx	(renderCtx)
15123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
15133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
15143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15153c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestCase::IterateResult MixedRelinkAttributeTest::iterate (void)
15163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
15173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Bind>	noBindings;
15183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const AttribType	vec4("vec4", 1, GL_FLOAT_VEC4);
15193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Attribute>	attributes;
15213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		preLinkBindings;
15223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Bind>		postLinkBindings;
15233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_0", 1));
15253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	attributes.push_back(Attribute(vec4, "a_1"));
15263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	preLinkBindings.push_back(Bind("a_0", 3));
15283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	preLinkBindings.push_back(Bind("a_0", 5));
15293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	postLinkBindings.push_back(Bind("a_0", 6));
15313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	runTest(m_testCtx, m_renderCtx, attributes, noBindings, preLinkBindings, postLinkBindings, true);
15333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
15343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
15353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
15363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls
15373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
1538