13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 2.0 Module
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * -------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Drawing tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es2sDrawTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsDrawTest.hpp"
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deUniquePtr.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <set>
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles2
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Stress
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void genBasicSpec (gls::DrawTestSpec& spec, gls::DrawTestSpec::DrawMethod method)
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.apiType							= glu::ApiType::es(2,0);
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.primitive							= gls::DrawTestSpec::PRIMITIVE_TRIANGLES;
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.primitiveCount						= 5;
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.drawMethod							= method;
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.indexType							= gls::DrawTestSpec::INDEXTYPE_LAST;
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.indexPointerOffset					= 0;
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.indexStorage						= gls::DrawTestSpec::STORAGE_LAST;
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.first								= 0;
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.indexMin							= 0;
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.indexMax							= 0;
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.instanceCount						= 1;
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs.resize(2);
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].inputType				= gls::DrawTestSpec::INPUTTYPE_FLOAT;
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].outputType				= gls::DrawTestSpec::OUTPUTTYPE_VEC2;
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].storage					= gls::DrawTestSpec::STORAGE_BUFFER;
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].usage					= gls::DrawTestSpec::USAGE_STATIC_DRAW;
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].componentCount			= 4;
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].offset					= 0;
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].stride					= 0;
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].normalize				= false;
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].instanceDivisor			= 0;
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[0].useDefaultAttribute		= false;
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].inputType				= gls::DrawTestSpec::INPUTTYPE_FLOAT;
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].outputType				= gls::DrawTestSpec::OUTPUTTYPE_VEC2;
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].storage					= gls::DrawTestSpec::STORAGE_BUFFER;
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].usage					= gls::DrawTestSpec::USAGE_STATIC_DRAW;
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].componentCount			= 2;
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].offset					= 0;
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].stride					= 0;
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].normalize				= false;
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].instanceDivisor			= 0;
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	spec.attribs[1].useDefaultAttribute		= false;
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass IndexGroup : public TestCaseGroup
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									IndexGroup		(Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod);
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									~IndexGroup		(void);
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void							init			(void);
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::DrawMethod	m_method;
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
953c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIndexGroup::IndexGroup (Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod)
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup		(context, name, descr)
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_method			(drawMethod)
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1013c827367444ee418f129b2c238299f49d3264554Jarkko PoyryIndexGroup::~IndexGroup (void)
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid IndexGroup::init (void)
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	struct IndexTest
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::Storage		storage;
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::IndexType	type;
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bool							aligned;
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int								offsets[3];
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const IndexTest tests[] =
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{ gls::DrawTestSpec::STORAGE_BUFFER,	gls::DrawTestSpec::INDEXTYPE_SHORT,	false,	{ 1, 3, -1 } },
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec spec;
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestCaseGroup* unalignedBufferGroup	= new tcu::TestCaseGroup(m_testCtx, "unaligned_buffer", "unaligned buffer");
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	genBasicSpec(spec, m_method);
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	this->addChild(unalignedBufferGroup);
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(tests); ++testNdx)
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const IndexTest&				indexTest	= tests[testNdx];
131ac469fadc6942610baa5c31b9e9ea085137aa25eJarkko Pöyry
132ac469fadc6942610baa5c31b9e9ea085137aa25eJarkko Pöyry		DE_ASSERT(indexTest.storage != gls::DrawTestSpec::STORAGE_USER);
133ac469fadc6942610baa5c31b9e9ea085137aa25eJarkko Pöyry		DE_ASSERT(!indexTest.aligned);
134ac469fadc6942610baa5c31b9e9ea085137aa25eJarkko Pöyry		tcu::TestCaseGroup*				group		= unalignedBufferGroup;
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const std::string				name		= std::string("index_") + gls::DrawTestSpec::indexTypeToString(indexTest.type);
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const std::string				desc		= std::string("index ") + gls::DrawTestSpec::indexTypeToString(indexTest.type) + " in " + gls::DrawTestSpec::storageToString(indexTest.storage);
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		de::MovePtr<gls::DrawTest>		test		(new gls::DrawTest(m_testCtx, m_context.getRenderContext(), name.c_str(), desc.c_str()));
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.indexType			= indexTest.type;
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.indexStorage		= indexTest.storage;
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int iterationNdx = 0; iterationNdx < DE_LENGTH_OF_ARRAY(indexTest.offsets) && indexTest.offsets[iterationNdx] != -1; ++iterationNdx)
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const std::string iterationDesc = std::string("offset ") + de::toString(indexTest.offsets[iterationNdx]);
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			spec.indexPointerOffset	= indexTest.offsets[iterationNdx];
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			test->addIteration(spec, iterationDesc.c_str());
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
150ee2e92c10d529b2be9ef1279655f9b65a3f1a407Jarkko Pöyry		DE_ASSERT(spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET ||
151ee2e92c10d529b2be9ef1279655f9b65a3f1a407Jarkko Pöyry				  spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE);
152ee2e92c10d529b2be9ef1279655f9b65a3f1a407Jarkko Pöyry		group->addChild(test.release());
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MethodGroup : public TestCaseGroup
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									MethodGroup			(Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod);
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									~MethodGroup		(void);
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void							init				(void);
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::DrawMethod	m_method;
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1683c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMethodGroup::MethodGroup (Context& context, const char* name, const char* descr, gls::DrawTestSpec::DrawMethod drawMethod)
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup		(context, name, descr)
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_method			(drawMethod)
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1743c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMethodGroup::~MethodGroup (void)
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MethodGroup::init (void)
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const bool indexed = (m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS) || (m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED) || (m_method == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED);
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(indexed);
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_UNREF(indexed);
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	this->addChild(new IndexGroup(m_context, "indices", "Index tests", m_method));
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RandomGroup : public TestCaseGroup
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									RandomGroup		(Context& context, const char* name, const char* descr);
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									~RandomGroup	(void);
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void							init			(void);
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate <int SIZE>
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystruct UniformWeightArray
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	float weights[SIZE];
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	UniformWeightArray (void)
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int i=0; i<SIZE; ++i)
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			weights[i] = 1.0f;
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2093c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRandomGroup::RandomGroup (Context& context, const char* name, const char* descr)
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup	(context, name, descr)
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2143c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRandomGroup::~RandomGroup (void)
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid RandomGroup::init (void)
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	numAttempts				= 100;
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	attribCounts[]			= { 1, 2, 5 };
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float	attribWeights[]			= { 30, 10, 1 };
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	primitiveCounts[]		= { 1, 5, 64 };
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float	primitiveCountWeights[]	= { 20, 10, 1 };
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	indexOffsets[]			= { 0, 7, 13 };
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float	indexOffsetWeights[]	= { 20, 20, 1 };
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	firsts[]				= { 0, 7, 13 };
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float	firstWeights[]			= { 20, 20, 1 };
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	offsets[]				= { 0, 1, 5, 12 };
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float	offsetWeights[]			= { 50, 10, 10, 10 };
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int	strides[]				= { 0, 7, 16, 17 };
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float	strideWeights[]			= { 50, 10, 10, 10 };
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::Primitive primitives[] =
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::PRIMITIVE_POINTS,
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::PRIMITIVE_TRIANGLES,
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::PRIMITIVE_TRIANGLE_FAN,
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP,
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::PRIMITIVE_LINES,
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::PRIMITIVE_LINE_STRIP,
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::PRIMITIVE_LINE_LOOP
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformWeightArray<DE_LENGTH_OF_ARRAY(primitives)> primitiveWeights;
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::DrawMethod drawMethods[] =
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::DRAWMETHOD_DRAWARRAYS,
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS,
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformWeightArray<DE_LENGTH_OF_ARRAY(drawMethods)> drawMethodWeights;
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::IndexType indexTypes[] =
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INDEXTYPE_BYTE,
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INDEXTYPE_SHORT,
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformWeightArray<DE_LENGTH_OF_ARRAY(indexTypes)> indexTypeWeights;
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::Storage storages[] =
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::STORAGE_USER,
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::STORAGE_BUFFER,
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformWeightArray<DE_LENGTH_OF_ARRAY(storages)> storageWeights;
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::InputType inputTypes[] =
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INPUTTYPE_FLOAT,
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INPUTTYPE_FIXED,
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INPUTTYPE_BYTE,
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INPUTTYPE_SHORT,
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE,
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformWeightArray<DE_LENGTH_OF_ARRAY(inputTypes)> inputTypeWeights;
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::OutputType outputTypes[] =
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::OUTPUTTYPE_FLOAT,
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::OUTPUTTYPE_VEC2,
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::OUTPUTTYPE_VEC3,
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::OUTPUTTYPE_VEC4,
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformWeightArray<DE_LENGTH_OF_ARRAY(outputTypes)> outputTypeWeights;
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gls::DrawTestSpec::Usage usages[] =
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::USAGE_STATIC_DRAW,
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::USAGE_DYNAMIC_DRAW,
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec::USAGE_STREAM_DRAW,
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformWeightArray<DE_LENGTH_OF_ARRAY(usages)> usageWeights;
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deUint32 blacklistedCases[]=
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		3153,	//!< extremely narrow triangle, results depend on sample positions
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::set<deUint32>	insertedHashes;
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	size_t				insertedCount = 0;
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int ndx = 0; ndx < numAttempts; ++ndx)
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		de::Random random(0xc551393 + ndx); // random does not depend on previous cases
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int					attributeCount = random.chooseWeighted<int, const int*, const float*>(DE_ARRAY_BEGIN(attribCounts), DE_ARRAY_END(attribCounts), attribWeights);
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gls::DrawTestSpec	spec;
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.apiType				= glu::ApiType::es(2,0);
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.primitive				= random.chooseWeighted<gls::DrawTestSpec::Primitive>	(DE_ARRAY_BEGIN(primitives),		DE_ARRAY_END(primitives),		primitiveWeights.weights);
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.primitiveCount			= random.chooseWeighted<int, const int*, const float*>	(DE_ARRAY_BEGIN(primitiveCounts),	DE_ARRAY_END(primitiveCounts),	primitiveCountWeights);
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.drawMethod				= random.chooseWeighted<gls::DrawTestSpec::DrawMethod>	(DE_ARRAY_BEGIN(drawMethods),		DE_ARRAY_END(drawMethods),		drawMethodWeights.weights);
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.indexType				= random.chooseWeighted<gls::DrawTestSpec::IndexType>	(DE_ARRAY_BEGIN(indexTypes),		DE_ARRAY_END(indexTypes),		indexTypeWeights.weights);
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.indexPointerOffset		= random.chooseWeighted<int, const int*, const float*>	(DE_ARRAY_BEGIN(indexOffsets),		DE_ARRAY_END(indexOffsets),		indexOffsetWeights);
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.indexStorage			= random.chooseWeighted<gls::DrawTestSpec::Storage>		(DE_ARRAY_BEGIN(storages),			DE_ARRAY_END(storages),			storageWeights.weights);
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.first					= random.chooseWeighted<int, const int*, const float*>	(DE_ARRAY_BEGIN(firsts),			DE_ARRAY_END(firsts),			firstWeights);
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.indexMin				= 0;
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.indexMax				= 0;
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		spec.instanceCount			= 0;
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// check spec is legal
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!spec.valid())
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			continue;
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int attrNdx = 0; attrNdx < attributeCount;)
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bool valid;
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gls::DrawTestSpec::AttributeSpec attribSpec;
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.inputType			= random.chooseWeighted<gls::DrawTestSpec::InputType>	(DE_ARRAY_BEGIN(inputTypes),		DE_ARRAY_END(inputTypes),		inputTypeWeights.weights);
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.outputType			= random.chooseWeighted<gls::DrawTestSpec::OutputType>	(DE_ARRAY_BEGIN(outputTypes),		DE_ARRAY_END(outputTypes),		outputTypeWeights.weights);
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.storage				= random.chooseWeighted<gls::DrawTestSpec::Storage>		(DE_ARRAY_BEGIN(storages),			DE_ARRAY_END(storages),			storageWeights.weights);
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.usage				= random.chooseWeighted<gls::DrawTestSpec::Usage>		(DE_ARRAY_BEGIN(usages),			DE_ARRAY_END(usages),			usageWeights.weights);
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.componentCount		= random.getInt(1, 4);
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.offset				= random.chooseWeighted<int, const int*, const float*>(DE_ARRAY_BEGIN(offsets), DE_ARRAY_END(offsets), offsetWeights);
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.stride				= random.chooseWeighted<int, const int*, const float*>(DE_ARRAY_BEGIN(strides), DE_ARRAY_END(strides), strideWeights);
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.normalize			= random.getBool();
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.instanceDivisor		= 0;
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			attribSpec.useDefaultAttribute	= random.getBool();
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			// check spec is legal
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			valid = attribSpec.valid(spec.apiType);
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			// we do not want interleaved elements. (Might result in some weird floating point values)
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (attribSpec.stride && attribSpec.componentCount * gls::DrawTestSpec::inputTypeSize(attribSpec.inputType) > attribSpec.stride)
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				valid = false;
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			// try again if not valid
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (valid)
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				spec.attribs.push_back(attribSpec);
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				++attrNdx;
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Do not collapse all vertex positions to a single positions
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (spec.primitive != gls::DrawTestSpec::PRIMITIVE_POINTS)
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			spec.attribs[0].instanceDivisor = 0;
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Is render result meaningful?
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			// Only one vertex
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (spec.drawMethod == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED && spec.indexMin == spec.indexMax && spec.primitive != gls::DrawTestSpec::PRIMITIVE_POINTS)
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				continue;
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (spec.attribs[0].useDefaultAttribute && spec.primitive != gls::DrawTestSpec::PRIMITIVE_POINTS)
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				continue;
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			// Triangle only on one axis
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (spec.primitive == gls::DrawTestSpec::PRIMITIVE_TRIANGLES || spec.primitive == gls::DrawTestSpec::PRIMITIVE_TRIANGLE_FAN || spec.primitive == gls::DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP)
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (spec.attribs[0].componentCount == 1)
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					continue;
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (spec.attribs[0].outputType == gls::DrawTestSpec::OUTPUTTYPE_FLOAT || spec.attribs[0].outputType == gls::DrawTestSpec::OUTPUTTYPE_INT || spec.attribs[0].outputType == gls::DrawTestSpec::OUTPUTTYPE_UINT)
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					continue;
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (spec.drawMethod == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED && (spec.indexMax - spec.indexMin) < 2)
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					continue;
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Add case
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deUint32 hash = spec.hash();
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int attrNdx = 0; attrNdx < attributeCount; ++attrNdx)
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				hash = (hash << 2) ^ (deUint32)spec.attribs[attrNdx].hash();
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (insertedHashes.find(hash) == insertedHashes.end() &&
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				std::find(DE_ARRAY_BEGIN(blacklistedCases), DE_ARRAY_END(blacklistedCases), hash) == DE_ARRAY_END(blacklistedCases))
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				// Only unaligned cases
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET ||
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.isCompatibilityTest() == gls::DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE)
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					this->addChild(new gls::DrawTest(m_testCtx, m_context.getRenderContext(), spec, de::toString(insertedCount).c_str(), spec.getDesc().c_str()));
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				insertedHashes.insert(hash);
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				++insertedCount;
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4053c827367444ee418f129b2c238299f49d3264554Jarkko PoyryDrawTests::DrawTests (Context& context)
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(context, "draw", "Drawing tests")
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4103c827367444ee418f129b2c238299f49d3264554Jarkko PoyryDrawTests::~DrawTests (void)
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid DrawTests::init (void)
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TestCaseGroup* const unalignedGroup	= new tcu::TestCaseGroup(m_testCtx, "unaligned_data", "Test with unaligned data");
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(unalignedGroup);
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// .unaligned_data
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const gls::DrawTestSpec::DrawMethod basicMethods[] =
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			// gls::DrawTestSpec::DRAWMETHOD_DRAWARRAYS,
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS,
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(basicMethods); ++ndx)
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			std::string name = gls::DrawTestSpec::drawMethodToString(basicMethods[ndx]);
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			std::string desc = gls::DrawTestSpec::drawMethodToString(basicMethods[ndx]);
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			unalignedGroup->addChild(new MethodGroup(m_context, name.c_str(), desc.c_str(), basicMethods[ndx]));
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Random
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		unalignedGroup->addChild(new RandomGroup(m_context, "random", "random draw commands."));
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Stress
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles2
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
446