13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _GLSSTATECHANGEPERFTESTCASES_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _GLSSTATECHANGEPERFTESTCASES_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 State change performance tests.
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestCase.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glu
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass ShaderProgram;
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass RenderContext;
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace glw
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Functions;
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gls
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StateChangePerformanceCase : public tcu::TestCase
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum DrawType
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DRAWTYPE_NOT_INDEXED		= 0,	//!< glDrawArrays()
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DRAWTYPE_INDEXED_USER_PTR,			//!< glDrawElements(), indices from user pointer.
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		DRAWTYPE_INDEXED_BUFFER,			//!< glDrawElements(), indices in buffer.
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										StateChangePerformanceCase		(tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, DrawType drawType, int drawCallCount, int triangleCount);
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										~StateChangePerformanceCase		(void);
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								init							(void);
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								deinit							(void);
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult						iterate							(void);
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requireIndexBuffers				(int count);
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requireCoordBuffers				(int count);
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requirePrograms					(int count);
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requireTextures					(int count);
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requireFramebuffers				(int count);
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requireRenderbuffers			(int count);
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requireSamplers					(int count);
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								requireVertexArrays				(int count);
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void						setupInitialState				(const glw::Functions& gl) = 0;
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void						renderTest						(const glw::Functions& gl) = 0;
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void						renderReference					(const glw::Functions& gl) = 0;
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								callDraw						(const glw::Functions& gl);
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void								logAndSetTestResult				(void);
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&					m_renderCtx;
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const DrawType						m_drawType;
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int							m_iterationCount;
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int							m_callCount;
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int							m_triangleCount;
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint32>				m_indexBuffers;
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint32>				m_coordBuffers;
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint32>				m_textures;
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<glu::ShaderProgram*>	m_programs;
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint32>				m_framebuffers;
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint32>				m_renderbuffers;
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint32>				m_samplers;
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint32>				m_vertexArrays;
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry										StateChangePerformanceCase		(const StateChangePerformanceCase&);
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	StateChangePerformanceCase&			operator=						(const StateChangePerformanceCase&);
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint16>				m_indices;
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint64>				m_interleavedResults;
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint64>				m_batchedResults;
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass StateChangeCallPerformanceCase : public tcu::TestCase
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							StateChangeCallPerformanceCase	(tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description);
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							~StateChangeCallPerformanceCase	(void);
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult			iterate							(void);
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void			execCalls						(const glw::Functions& gl, int iterNdx, int callCount) = 0;
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					executeTest						(void);
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					logTestCase						(void);
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					logAndSetTestResult				(void);
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::RenderContext&		m_renderCtx;
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int				m_iterationCount;
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int				m_callCount;
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::vector<deUint64>	m_results;
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gls
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _GLSSTATECHANGEPERFTESTCASES_HPP
137