13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GLSUNIFORMBLOCKCASE_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GLSUNIFORMBLOCKCASE_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 Uniform block tests.
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestCase.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderUtil.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glu
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RenderContext;
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gls
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Uniform block details.
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace ub
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum UniformFlags
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	PRECISION_LOW		= (1<<0),
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	PRECISION_MEDIUM	= (1<<1),
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	PRECISION_HIGH		= (1<<2),
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	PRECISION_MASK		= PRECISION_LOW|PRECISION_MEDIUM|PRECISION_HIGH,
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LAYOUT_SHARED		= (1<<3),
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LAYOUT_PACKED		= (1<<4),
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LAYOUT_STD140		= (1<<5),
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LAYOUT_ROW_MAJOR	= (1<<6),
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LAYOUT_COLUMN_MAJOR	= (1<<7),	//!< \note Lack of both flags means column-major matrix.
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	LAYOUT_MASK			= LAYOUT_SHARED|LAYOUT_PACKED|LAYOUT_STD140|LAYOUT_ROW_MAJOR|LAYOUT_COLUMN_MAJOR,
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DECLARE_VERTEX		= (1<<8),
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DECLARE_FRAGMENT	= (1<<9),
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DECLARE_BOTH		= DECLARE_VERTEX|DECLARE_FRAGMENT,
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	UNUSED_VERTEX		= (1<<10),	//!< Uniform or struct member is not read in vertex shader.
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	UNUSED_FRAGMENT		= (1<<11),	//!< Uniform or struct member is not read in fragment shader.
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	UNUSED_BOTH			= UNUSED_VERTEX|UNUSED_FRAGMENT
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// \todo [2012-07-25 pyry] Use glu::VarType.
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StructType;
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass VarType
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						VarType			(void);
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						VarType			(const VarType& other);
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						VarType			(glu::DataType basicType, deUint32 flags);
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						VarType			(const VarType& elementType, int arraySize);
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit			VarType			(const StructType* structPtr);
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						~VarType		(void);
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool				isBasicType		(void) const	{ return m_type == TYPE_BASIC;	}
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool				isArrayType		(void) const	{ return m_type == TYPE_ARRAY;	}
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool				isStructType	(void) const	{ return m_type == TYPE_STRUCT;	}
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			getFlags		(void) const	{ return m_flags;					}
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::DataType		getBasicType	(void) const	{ return m_data.basicType;			}
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const VarType&		getElementType	(void) const	{ return *m_data.array.elementType;	}
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int					getArraySize	(void) const	{ return m_data.array.size;			}
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const StructType&	getStruct		(void) const	{ return *m_data.structPtr;			}
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	VarType&			operator=		(const VarType& other);
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum Type
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TYPE_BASIC,
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TYPE_ARRAY,
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TYPE_STRUCT,
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TYPE_LAST
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Type				m_type;
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			m_flags;
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	union Data
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glu::DataType		basicType;
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		struct
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			VarType*		elementType;
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			int				size;
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		} array;
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const StructType*	structPtr;
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		Data (void)
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			array.elementType	= DE_NULL;
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			array.size			= 0;
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	} m_data;
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StructMember
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						StructMember	(const char* name, const VarType& type, deUint32 flags) : m_name(name), m_type(type), m_flags(flags) {}
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						StructMember	(void) : m_flags(0) {}
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*			getName			(void) const { return m_name.c_str();	}
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const VarType&		getType			(void) const { return m_type;			}
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			getFlags		(void) const { return m_flags;			}
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string			m_name;
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	VarType				m_type;
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32			m_flags;
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StructType
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef std::vector<StructMember>::iterator			Iterator;
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef std::vector<StructMember>::const_iterator	ConstIterator;
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								StructType		(const char* typeName) : m_typeName(typeName) {}
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								~StructType		(void) {}
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*					getTypeName		(void) const	{ return m_typeName.empty() ? DE_NULL : m_typeName.c_str();	}
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline Iterator				begin			(void)			{ return m_members.begin();		}
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline ConstIterator		begin			(void) const	{ return m_members.begin();		}
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline Iterator				end				(void)			{ return m_members.end();		}
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline ConstIterator		end				(void) const	{ return m_members.end();		}
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void						addMember		(const char* name, const VarType& type, deUint32 flags = 0);
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string					m_typeName;
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<StructMember>	m_members;
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Uniform
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					Uniform			(const char* name, const VarType& type, deUint32 flags = 0);
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*		getName			(void) const { return m_name.c_str();	}
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const VarType&	getType			(void) const { return m_type;			}
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32		getFlags		(void) const { return m_flags;			}
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string		m_name;
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	VarType			m_type;
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32		m_flags;
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UniformBlock
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef std::vector<Uniform>::iterator			Iterator;
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	typedef std::vector<Uniform>::const_iterator	ConstIterator;
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							UniformBlock		(const char* blockName);
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*				getBlockName		(void) const { return m_blockName.c_str();		}
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*				getInstanceName		(void) const { return m_instanceName.empty() ? DE_NULL : m_instanceName.c_str();	}
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					isArray				(void) const { return m_arraySize > 0;			}
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int						getArraySize		(void) const { return m_arraySize;				}
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32				getFlags			(void) const { return m_flags;					}
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					setInstanceName		(const char* name)			{ m_instanceName = name;			}
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					setFlags			(deUint32 flags)			{ m_flags = flags;					}
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					setArraySize		(int arraySize)				{ m_arraySize = arraySize;			}
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					addUniform			(const Uniform& uniform)	{ m_uniforms.push_back(uniform);	}
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline Iterator			begin				(void)			{ return m_uniforms.begin();	}
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline ConstIterator	begin				(void) const	{ return m_uniforms.begin();	}
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline Iterator			end					(void)			{ return m_uniforms.end();		}
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	inline ConstIterator	end					(void) const	{ return m_uniforms.end();		}
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string				m_blockName;
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::string				m_instanceName;
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<Uniform>	m_uniforms;
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int						m_arraySize;	//!< Array size or 0 if not interface block array.
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32				m_flags;
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ShaderInterface
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								ShaderInterface			(void);
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								~ShaderInterface		(void);
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StructType&					allocStruct				(const char* name);
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const StructType*			findStruct				(const char* name) const;
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void						getNamedStructs			(std::vector<const StructType*>& structs) const;
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	UniformBlock&				allocBlock				(const char* name);
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int							getNumUniformBlocks		(void) const	{ return (int)m_uniformBlocks.size();	}
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const UniformBlock&			getUniformBlock			(int ndx) const	{ return *m_uniformBlocks[ndx];			}
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<StructType*>	m_structs;
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<UniformBlock*>	m_uniformBlocks;
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UniformLayout;
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // ub
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass UniformBlockCase : public tcu::TestCase
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum BufferMode
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		BUFFERMODE_SINGLE = 0,	//!< Single buffer shared between uniform blocks.
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		BUFFERMODE_PER_BLOCK,	//!< Per-block buffers
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		BUFFERMODE_LAST
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								UniformBlockCase			(tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, glu::GLSLVersion glslVersion, BufferMode bufferMode);
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry								~UniformBlockCase			(void);
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult				iterate						(void);
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						compareStd140Blocks			(const ub::UniformLayout& refLayout, const ub::UniformLayout& cmpLayout) const;
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						compareSharedBlocks			(const ub::UniformLayout& refLayout, const ub::UniformLayout& cmpLayout) const;
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						compareTypes				(const ub::UniformLayout& refLayout, const ub::UniformLayout& cmpLayout) const;
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						checkLayoutIndices			(const ub::UniformLayout& layout) const;
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						checkLayoutBounds			(const ub::UniformLayout& layout) const;
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						checkIndexQueries			(deUint32 program, const ub::UniformLayout& layout) const;
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool						render						(deUint32 program) const;
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&			m_renderCtx;
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::GLSLVersion			m_glslVersion;
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	BufferMode					m_bufferMode;
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ub::ShaderInterface			m_interface;
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLSUNIFORMBLOCKCASE_HPP
271