glsVertexArrayTests.hpp revision 3c827367444ee418f129b2c238299f49d3264554
13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GLSVERTEXARRAYTESTS_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GLSVERTEXARRAYTESTS_HPP
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL (ES) Module
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * -----------------------------------------------
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Vertex array and buffer tests
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestCase.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVector.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuSurface.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluCallLogWrapper.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deFloat16.h"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuFloat.hpp"
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuPixelFormat.hpp"
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "sglrContext.hpp"
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace sglr
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ReferenceContextBuffers;
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ReferenceContext;
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Context;
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // sglr
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gls
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Array
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum Target
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// \note [mika] Are these actualy used somewhere?
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TARGET_ELEMENT_ARRAY = 0,
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TARGET_ARRAY,
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TARGET_LAST
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum InputType
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_FLOAT = 0,
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_FIXED,
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_DOUBLE,
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_BYTE,
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_SHORT,
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_UNSIGNED_BYTE,
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_UNSIGNED_SHORT,
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_INT,
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_UNSIGNED_INT,
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_HALF,
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_UNSIGNED_INT_2_10_10_10,
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_INT_2_10_10_10,
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		INPUTTYPE_LAST
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum OutputType
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_FLOAT = 0,
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_VEC2,
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_VEC3,
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_VEC4,
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_INT,
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_UINT,
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_IVEC2,
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_IVEC3,
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_IVEC4,
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_UVEC2,
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_UVEC3,
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_UVEC4,
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		OUTPUTTYPE_LAST
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum Usage
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_DYNAMIC_DRAW = 0,
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_STATIC_DRAW,
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_STREAM_DRAW,
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_STREAM_READ,
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_STREAM_COPY,
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_STATIC_READ,
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_STATIC_COPY,
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_DYNAMIC_READ,
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_DYNAMIC_COPY,
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		USAGE_LAST
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum Storage
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STORAGE_USER = 0,
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STORAGE_BUFFER,
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		STORAGE_LAST
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum Primitive
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PRIMITIVE_POINTS = 0,
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PRIMITIVE_TRIANGLES,
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PRIMITIVE_TRIANGLE_FAN,
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PRIMITIVE_TRIANGLE_STRIP,
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		PRIMITIVE_LAST
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static std::string	targetToString		(Target target);
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static std::string	inputTypeToString	(InputType type);
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static std::string	outputTypeToString	(OutputType type);
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static std::string	usageTypeToString	(Usage usage);
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static std::string	storageToString		(Storage storage);
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static std::string	primitiveToString	(Primitive primitive);
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static int			inputTypeSize		(InputType type);
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual				~Array				(void) {}
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		data				(Target target, int size, const char* data, Usage usage) = 0;
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		subdata				(Target target, int offset, int size, const char* data) = 0;
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		bind				(int attribNdx, int offset, int size, InputType inType, OutputType outType, bool normalized, int stride) = 0;
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		unBind				(void) = 0;
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual bool		isBound				(void) const = 0;
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual int			getComponentCount	(void) const = 0;
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual Target		getTarget			(void) const = 0;
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual InputType	getInputType		(void) const = 0;
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual OutputType	getOutputType		(void) const = 0;
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual Storage		getStorageType		(void) const = 0;
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual bool		getNormalized		(void) const = 0;
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual int			getStride			(void) const = 0;
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual int			getAttribNdx		(void) const = 0;
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void		setAttribNdx		(int attribNdx) = 0;
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ContextArray : public Array
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								ContextArray		(Storage storage, sglr::Context& context);
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual						~ContextArray		(void);
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void				data				(Target target, int size, const char* data, Usage usage);
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void				subdata				(Target target, int offset, int size, const char* data);
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void				bind				(int attribNdx, int offset, int size, InputType inType, OutputType outType, bool normalized, int stride);
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void				bindIndexArray		(Array::Target storage);
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void				unBind				(void) { m_bound = false; }
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual bool				isBound				(void) const { return m_bound; }
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual int					getComponentCount	(void) const { return m_componentCount; }
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual Array::Target		getTarget			(void) const { return m_target; }
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual Array::InputType	getInputType		(void) const { return m_inputType; }
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual Array::OutputType	getOutputType		(void) const { return m_outputType; }
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual Array::Storage		getStorageType		(void) const { return m_storage; }
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual bool				getNormalized		(void) const { return m_normalize; }
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual int					getStride			(void) const { return m_stride; }
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual int					getAttribNdx		(void) const { return m_attribNdx; }
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void				setAttribNdx		(int attribNdx) { m_attribNdx = attribNdx; }
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void						glBind				(deUint32 loc);
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static deUint32				targetToGL			(Array::Target target);
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static deUint32				usageToGL			(Array::Usage usage);
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static deUint32				inputTypeToGL		(Array::InputType type);
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static std::string			outputTypeToGLType	(Array::OutputType type);
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static deUint32				primitiveToGL		(Array::Primitive primitive);
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Storage						m_storage;
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	sglr::Context&				m_ctx;
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32					m_glBuffer;
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						m_bound;
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int							m_attribNdx;
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int							m_size;
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	char*						m_data;
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int							m_componentCount;
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Array::Target				m_target;
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Array::InputType			m_inputType;
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Array::OutputType			m_outputType;
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						m_normalize;
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int							m_stride;
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int							m_offset;
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ContextArrayPack
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								ContextArrayPack	(glu::RenderContext& renderCtx, sglr::Context& drawContext);
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual						~ContextArrayPack	(void);
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual Array*				getArray			(int i);
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual int					getArrayCount		(void);
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual	void				newArray			(Array::Storage storage);
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void				render 				(Array::Primitive primitive, int firstVertex, int vertexCount, bool useVao, float coordScale, float colorScale);
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::Surface&			getSurface			(void) const { return m_screen; }
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void 						updateProgram		(void);
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&			m_renderCtx;
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	sglr::Context&				m_ctx;
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<ContextArray*>	m_arrays;
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	sglr::ShaderProgram*		m_program;
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::Surface				m_screen;
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass GLValue
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	template<class Type>
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	class WrappedType
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	public:
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		static WrappedType<Type>	create			(Type value)							{ WrappedType<Type> v; v.m_value = value; return v; }
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Type					getValue		(void) const							{ return m_value; }
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>	operator+		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value + other.getValue()); }
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>	operator*		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value * other.getValue()); }
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>	operator/		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value / other.getValue()); }
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>	operator-		(const WrappedType<Type>& other) const	{ return WrappedType<Type>::create(m_value - other.getValue()); }
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>&	operator+=		(const WrappedType<Type>& other)		{ m_value += other.getValue(); return *this; }
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>&	operator*=		(const WrappedType<Type>& other)		{ m_value *= other.getValue(); return *this; }
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>&	operator/=		(const WrappedType<Type>& other)		{ m_value /= other.getValue(); return *this; }
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline WrappedType<Type>&	operator-=		(const WrappedType<Type>& other)		{ m_value -= other.getValue(); return *this; }
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool					operator==		(const WrappedType<Type>& other) const	{ return m_value == other.m_value; }
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool					operator!=		(const WrappedType<Type>& other) const	{ return m_value != other.m_value; }
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool					operator<		(const WrappedType<Type>& other) const	{ return m_value < other.m_value; }
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool					operator>		(const WrappedType<Type>& other) const	{ return m_value > other.m_value; }
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool					operator<=		(const WrappedType<Type>& other) const	{ return m_value <= other.m_value; }
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool					operator>=		(const WrappedType<Type>& other) const	{ return m_value >= other.m_value; }
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline 						operator Type	(void) const							{ return m_value; }
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		template<class T>
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline T					to				(void) const							{ return (T)m_value; }
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	private:
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Type	m_value;
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<deInt16>	Short;
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<deUint16>	Ushort;
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<deInt8>		Byte;
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<deUint8>	Ubyte;
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<float>		Float;
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<double>		Double;
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<deInt32>	Int;
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef WrappedType<deUint32>	Uint;
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	class Half
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	public:
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		static Half			create			(float value)				{ Half h; h.m_value = floatToHalf(value); return h; }
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline deFloat16	getValue		(void) const				{ return m_value; }
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half			operator+		(const Half& other) const	{ return create(halfToFloat(m_value) + halfToFloat(other.getValue())); }
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half			operator*		(const Half& other) const	{ return create(halfToFloat(m_value) * halfToFloat(other.getValue())); }
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half			operator/		(const Half& other) const	{ return create(halfToFloat(m_value) / halfToFloat(other.getValue())); }
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half			operator-		(const Half& other) const	{ return create(halfToFloat(m_value) - halfToFloat(other.getValue())); }
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half&		operator+=		(const Half& other)			{ m_value = floatToHalf(halfToFloat(other.getValue()) + halfToFloat(m_value)); return *this; }
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half&		operator*=		(const Half& other)			{ m_value = floatToHalf(halfToFloat(other.getValue()) * halfToFloat(m_value)); return *this; }
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half&		operator/=		(const Half& other)			{ m_value = floatToHalf(halfToFloat(other.getValue()) / halfToFloat(m_value)); return *this; }
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Half&		operator-=		(const Half& other)			{ m_value = floatToHalf(halfToFloat(other.getValue()) - halfToFloat(m_value)); return *this; }
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator==		(const Half& other) const	{ return m_value == other.m_value; }
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator!=		(const Half& other) const	{ return m_value != other.m_value; }
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator<		(const Half& other) const	{ return halfToFloat(m_value) < halfToFloat(other.m_value); }
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator>		(const Half& other) const	{ return halfToFloat(m_value) > halfToFloat(other.m_value); }
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator<=		(const Half& other) const	{ return halfToFloat(m_value) <= halfToFloat(other.m_value); }
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator>=		(const Half& other) const	{ return halfToFloat(m_value) >= halfToFloat(other.m_value); }
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		template<class T>
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline T			to				(void) const				{ return (T)halfToFloat(m_value); }
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline static deFloat16	floatToHalf		(float f);
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline static float		halfToFloat		(deFloat16 h);
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	private:
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deFloat16 m_value;
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	class Fixed
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	public:
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		static Fixed		create			(deInt32 value)				{ Fixed v; v.m_value = value; return v; }
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline deInt32		getValue		(void) const				{ return m_value; }
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed		operator+		(const Fixed& other) const	{ return create(m_value + other.getValue()); }
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed		operator*		(const Fixed& other) const	{ return create(m_value * other.getValue()); }
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed		operator/		(const Fixed& other) const	{ return create(m_value / other.getValue()); }
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed		operator-		(const Fixed& other) const	{ return create(m_value - other.getValue()); }
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed&		operator+=		(const Fixed& other)		{ m_value += other.getValue(); return *this; }
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed&		operator*=		(const Fixed& other)		{ m_value *= other.getValue(); return *this; }
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed&		operator/=		(const Fixed& other)		{ m_value /= other.getValue(); return *this; }
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline Fixed&		operator-=		(const Fixed& other)		{ m_value -= other.getValue(); return *this; }
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator==		(const Fixed& other) const	{ return m_value == other.m_value; }
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator!=		(const Fixed& other) const	{ return m_value != other.m_value; }
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator<		(const Fixed& other) const	{ return m_value < other.m_value; }
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator>		(const Fixed& other) const	{ return m_value > other.m_value; }
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator<=		(const Fixed& other) const	{ return m_value <= other.m_value; }
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline bool			operator>=		(const Fixed& other) const	{ return m_value >= other.m_value; }
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline 				operator deInt32 (void) const				{ return m_value; }
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		template<class T>
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		inline T			to				(void) const				{ return (T)m_value; }
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	private:
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deInt32				m_value;
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// \todo [mika] This is pretty messy
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						GLValue			(void)			: type(Array::INPUTTYPE_LAST) {}
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Float value)	: type(Array::INPUTTYPE_FLOAT),				fl(value)	{}
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Fixed value)	: type(Array::INPUTTYPE_FIXED),				fi(value)	{}
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Byte value)	: type(Array::INPUTTYPE_BYTE),				b(value)	{}
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Ubyte value)	: type(Array::INPUTTYPE_UNSIGNED_BYTE),		ub(value)	{}
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Short value)	: type(Array::INPUTTYPE_SHORT),				s(value)	{}
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Ushort value)	: type(Array::INPUTTYPE_UNSIGNED_SHORT),	us(value)	{}
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Int value)		: type(Array::INPUTTYPE_INT),				i(value)	{}
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Uint value)	: type(Array::INPUTTYPE_UNSIGNED_INT),		ui(value)	{}
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Half value)	: type(Array::INPUTTYPE_HALF),				h(value)	{}
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			GLValue			(Double value)	: type(Array::INPUTTYPE_DOUBLE),			d(value)	{}
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	float				toFloat			(void) const;
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static GLValue		getMaxValue		(Array::InputType type);
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static GLValue		getMinValue		(Array::InputType type);
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Array::InputType	type;
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	union
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Float		fl;
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Fixed		fi;
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Double		d;
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Byte		b;
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Ubyte		ub;
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Short		s;
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Ushort		us;
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Int			i;
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Uint		ui;
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Half		h;
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass VertexArrayTest : public tcu::TestCase
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									VertexArrayTest		(tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name ,const char* desc);
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual							~VertexArrayTest	(void);
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void					init				(void);
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void					deinit				(void);
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									VertexArrayTest		(const VertexArrayTest& other);
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	VertexArrayTest&				operator=			(const VertexArrayTest& other);
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void							compare				(void);
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&				m_renderCtx;
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	sglr::ReferenceContextBuffers*	m_refBuffers;
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	sglr::ReferenceContext*			m_refContext;
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	sglr::Context*					m_glesContext;
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ContextArrayPack*				m_glArrayPack;
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ContextArrayPack*				m_rrArrayPack;
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							m_isOk;
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								m_maxDiffRed;
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								m_maxDiffGreen;
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								m_maxDiffBlue;
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MultiVertexArrayTest : public VertexArrayTest
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	class Spec
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	public:
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		class ArraySpec
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		public:
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								ArraySpec	(Array::InputType inputType, Array::OutputType outputType, Array::Storage storage, Array::Usage usage, int componetCount, int offset, int stride, bool normalize, GLValue min, GLValue max);
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			Array::InputType	inputType;
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			Array::OutputType	outputType;
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			Array::Storage		storage;
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			Array::Usage		usage;
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			int 				componentCount;
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			int					offset;
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			int					stride;
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			bool				normalize;
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLValue				min;
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLValue				max;
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::string 			getName		(void) const;
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::string				getDesc		(void) const;
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Array::Primitive		primitive;
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int						drawCount;			//!<Number of primitives to draw
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int						first;
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::vector<ArraySpec>	arrays;
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							MultiVertexArrayTest	(tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const Spec& spec, const char* name, const char* desc);
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual					~MultiVertexArrayTest	(void);
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual IterateResult	iterate					(void);
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					isUnalignedBufferOffsetTest		(void) const;
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					isUnalignedBufferStrideTest		(void) const;
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Spec					m_spec;
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int						m_iteration;
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline deFloat16 GLValue::Half::floatToHalf (float f)
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// No denorm support.
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::Float<deUint16, 5, 10, 15, tcu::FLOAT_HAS_SIGN> v(f);
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(!v.isNaN() && !v.isInf());
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return v.bits();
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryinline float GLValue::Half::halfToFloat (deFloat16 h)
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return tcu::Float16((deUint16)h).asFloat();
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLSVERTEXARRAYTESTS_HPP
471