13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program EGL 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 eglMakeCurrent performance tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglMakeCurrentPerfTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeWindow.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativePixmap.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUtil.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deClock.h"
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deString.h"
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <algorithm>
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <cmath>
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <limits>
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <sstream>
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string>
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::ostringstream;
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector;
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog;
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass MakeCurrentPerfCase : public TestCase
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum SurfaceType
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		SURFACETYPE_PBUFFER	= (1<<0),
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		SURFACETYPE_WINDOW	= (1<<1),
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		SURFACETYPE_PIXMAP	= (1<<2)
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	struct Spec
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		SurfaceType	surfaceTypes;
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int			contextCount;
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int			surfaceCount;
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		bool		release;
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int			iterationCount;
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int			sampleCount;
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		string		toName			(void) const;
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		string		toDescription	(void) const;
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					MakeCurrentPerfCase		(EglTestContext& eglTestCtx, const Spec& spec, const char* name, const char* description);
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					~MakeCurrentPerfCase	(void);
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void			init					(void);
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void			deinit					(void);
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult	iterate					(void);
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	Spec						m_spec;
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	de::Random					m_rnd;
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLConfig					m_config;
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<EGLContext>			m_contexts;
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<EGLSurface>			m_surfaces;
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<eglu::NativeWindow*>	m_windows;
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<eglu::NativePixmap*>	m_pixmaps;
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<deUint64>			m_samples;
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					chooseConfig	(void);
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					createSurfaces	(void);
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					createContexts	(void);
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					destroySurfaces	(void);
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					destroyContexts	(void);
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					createPBuffer	(void);
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					createWindow	(void);
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					createPixmap	(void);
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					logTestInfo		(void);
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					logResults		(void);
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Disabled
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							MakeCurrentPerfCase	(const MakeCurrentPerfCase&);
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MakeCurrentPerfCase&	operator=			(const MakeCurrentPerfCase&);
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring MakeCurrentPerfCase::Spec::toName (void) const
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ostringstream name;
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	name << "context";
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (contextCount > 1)
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name << "s_" << contextCount;
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((surfaceTypes & SURFACETYPE_WINDOW) != 0)
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name << "_window" << (surfaceCount > 1 ? "s" : "");
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((surfaceTypes & SURFACETYPE_PIXMAP) != 0)
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name << "_pixmap" << (surfaceCount > 1 ? "s" : "");
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((surfaceTypes & SURFACETYPE_PBUFFER) != 0)
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name << "_pbuffer" << (surfaceCount > 1 ? "s" : "");
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (surfaceCount > 1)
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name << "_" << surfaceCount;
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (release)
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		name << "_release";
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return name.str();
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring MakeCurrentPerfCase::Spec::toDescription (void) const
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// \todo [mika] Generate descrpition
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return toName();
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1513c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMakeCurrentPerfCase::MakeCurrentPerfCase (EglTestContext& eglTestCtx, const Spec& spec, const char* name, const char* description)
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase		(eglTestCtx, tcu::NODETYPE_PERFORMANCE, name, description)
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_spec		(spec)
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_rnd			(deStringHash(name))
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_config		(DE_NULL)
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1593c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMakeCurrentPerfCase::~MakeCurrentPerfCase (void)
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deinit();
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::init (void)
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	chooseConfig();
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	createContexts();
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	createSurfaces();
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::deinit (void)
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	destroyContexts();
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	destroySurfaces();
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::chooseConfig (void)
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	surfaceBits	= ((m_spec.surfaceTypes & SURFACETYPE_WINDOW) != 0 ? EGL_WINDOW_BIT : 0)
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									| ((m_spec.surfaceTypes & SURFACETYPE_PIXMAP) != 0 ? EGL_PIXMAP_BIT : 0)
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									| ((m_spec.surfaceTypes & SURFACETYPE_PBUFFER) != 0 ? EGL_PBUFFER_BIT : 0);
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	attribList[] = {
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_SURFACE_TYPE,		surfaceBits,
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_RENDERABLE_TYPE,	EGL_OPENGL_ES2_BIT,
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_NONE
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLint		configCount = 0;
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLDisplay	display	= m_eglTestCtx.getDisplay().getEGLDisplay();
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK_EGL_CALL(eglChooseConfig(display, attribList, &m_config, 1, &configCount));
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (configCount <= 0)
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw tcu::NotSupportedError("No compatible configs found");
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createSurfaces (void)
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<SurfaceType> types;
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((m_spec.surfaceTypes & SURFACETYPE_WINDOW) != 0)
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		types.push_back(SURFACETYPE_WINDOW);
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((m_spec.surfaceTypes & SURFACETYPE_PIXMAP) != 0)
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		types.push_back(SURFACETYPE_PIXMAP);
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((m_spec.surfaceTypes & SURFACETYPE_PBUFFER) != 0)
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		types.push_back(SURFACETYPE_PBUFFER);
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT((int)types.size() <= m_spec.surfaceCount);
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Create surfaces
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int surfaceNdx = 0; surfaceNdx < m_spec.surfaceCount; surfaceNdx++)
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		SurfaceType type = types[surfaceNdx % types.size()];
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		switch (type)
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			case SURFACETYPE_PBUFFER:
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				createPBuffer();
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			case SURFACETYPE_WINDOW:
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				createWindow();
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			case SURFACETYPE_PIXMAP:
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				createPixmap();
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			default:
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				DE_ASSERT(false);
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createPBuffer (void)
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	width	= 256;
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	height	= 256;
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint attribList[] = {
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_WIDTH,	width,
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_HEIGHT, height,
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_NONE
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLDisplay	display	= m_eglTestCtx.getDisplay().getEGLDisplay();
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLSurface	surface = eglCreatePbufferSurface(display, m_config, attribList);
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK_EGL_MSG("eglCreatePbufferSurface()");
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_surfaces.push_back(surface);
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createWindow (void)
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	width	= 256;
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	height	= 256;
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglu::NativeWindow* window	= DE_NULL;
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLSurface			surface	= EGL_NO_SURFACE;
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window	= m_eglTestCtx.createNativeWindow(m_eglTestCtx.getDisplay().getEGLDisplay(), m_config, DE_NULL, width, height, eglu::parseWindowVisibility(m_eglTestCtx.getTestContext().getCommandLine()));
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		surface	= eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, m_eglTestCtx.getDisplay().getEGLDisplay(), m_config, DE_NULL);
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (const std::exception&)
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (surface != EGL_NO_SURFACE)
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_CHECK_EGL_CALL(eglDestroySurface(m_eglTestCtx.getDisplay().getEGLDisplay(), surface));
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete window;
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_windows.push_back(window);
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_surfaces.push_back(surface);
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createPixmap (void)
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	width	= 256;
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	height	= 256;
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglu::NativePixmap*	pixmap	= DE_NULL;
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLSurface			surface	= EGL_NO_SURFACE;
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		pixmap	= m_eglTestCtx.createNativePixmap(m_eglTestCtx.getDisplay().getEGLDisplay(), m_config, DE_NULL, width, height);
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		surface	= eglu::createPixmapSurface(m_eglTestCtx.getNativeDisplay(), *pixmap, m_eglTestCtx.getDisplay().getEGLDisplay(), m_config, DE_NULL);
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (const std::exception&)
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (surface != EGL_NO_SURFACE)
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_CHECK_EGL_CALL(eglDestroySurface(m_eglTestCtx.getDisplay().getEGLDisplay(), surface));
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete pixmap;
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_pixmaps.push_back(pixmap);
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_surfaces.push_back(surface);
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::destroySurfaces (void)
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_surfaces.size() > 0)
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGLDisplay display = m_eglTestCtx.getDisplay().getEGLDisplay();
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Destroy surfaces
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (vector<EGLSurface>::iterator iter = m_surfaces.begin(); iter != m_surfaces.end(); ++iter)
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (*iter != EGL_NO_SURFACE)
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				TCU_CHECK_EGL_CALL(eglDestroySurface(display, *iter));
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			*iter = EGL_NO_SURFACE;
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_surfaces.clear();
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Destroy pixmaps
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (vector<eglu::NativePixmap*>::iterator iter = m_pixmaps.begin(); iter != m_pixmaps.end(); ++iter)
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			delete *iter;
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			*iter = NULL;
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_pixmaps.clear();
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Destroy windows
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (vector<eglu::NativeWindow*>::iterator iter = m_windows.begin(); iter != m_windows.end(); ++iter)
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			delete *iter;
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			*iter = NULL;
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_windows.clear();
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Clear all surface handles
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_surfaces.clear();
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::createContexts (void)
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLDisplay display = m_eglTestCtx.getDisplay().getEGLDisplay();
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int contextNdx = 0; contextNdx < m_spec.contextCount; contextNdx++)
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const EGLint attribList[] = {
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			EGL_CONTEXT_CLIENT_VERSION, 2,
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			EGL_NONE
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_CALL(eglBindAPI(EGL_OPENGL_ES_API));
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGLContext context = eglCreateContext(display, m_config, EGL_NO_CONTEXT, attribList);
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_MSG("eglCreateContext()");
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_contexts.push_back(context);
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::destroyContexts (void)
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_contexts.size() > 0)
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGLDisplay display = m_eglTestCtx.getDisplay().getEGLDisplay();
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (vector<EGLContext>::iterator iter = m_contexts.begin(); iter != m_contexts.end(); ++iter)
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (*iter != EGL_NO_CONTEXT)
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				TCU_CHECK_EGL_CALL(eglDestroyContext(display, *iter));
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			*iter = EGL_NO_CONTEXT;
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_contexts.clear();
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::logTestInfo (void)
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog& log = m_testCtx.getLog();
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::ScopedLogSection	section(log, "Test Info", "Test case information.");
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Context count: "	<< m_contexts.size()											<< TestLog::EndMessage;
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Surfaces count: "	<< m_surfaces.size()											<< TestLog::EndMessage;
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Sample count: "	<< m_spec.sampleCount												<< TestLog::EndMessage;
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Iteration count: "	<< m_spec.iterationCount										<< TestLog::EndMessage;
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Window count: "	<< m_windows.size()													<< TestLog::EndMessage;
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Pixmap count: "	<< m_pixmaps.size()													<< TestLog::EndMessage;
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "PBuffer count: "	<< (m_surfaces.size() - m_windows.size() - m_pixmaps.size())	<< TestLog::EndMessage;
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (m_spec.release)
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Context is released after each use. Both binding and releasing context are included in result time." << TestLog::EndMessage;
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfCase::logResults (void)
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TestLog& log = m_testCtx.getLog();
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log << TestLog::SampleList("Result", "Result")
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		<< TestLog::SampleInfo << TestLog::ValueInfo("Time", "Time", "us", QP_SAMPLE_VALUE_TAG_RESPONSE)
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		<< TestLog::EndSampleInfo;
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Sample << deInt64(m_samples[sampleNdx]) << TestLog::EndSample;
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log << TestLog::EndSampleList;
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Log stats
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint64	totalTimeUs				= 0;
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint64	totalIterationCount		= 0;
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		float		iterationTimeMeanUs		= 0.0f;
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		float		iterationTimeMedianUs	= 0.0f;
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		float		iterationTimeVarianceUs	= 0.0f;
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		float		iterationTimeSkewnessUs	= 0.0f;
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		float		iterationTimeMinUs		= std::numeric_limits<float>::max();
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		float		iterationTimeMaxUs		= 0.0f;
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::sort(m_samples.begin(), m_samples.end());
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Calculate totals
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			totalTimeUs			+= m_samples[sampleNdx];
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			totalIterationCount	+= m_spec.iterationCount;
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Calculate mean and median
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		iterationTimeMeanUs		= ((float)(((double)totalTimeUs) / totalIterationCount));
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		iterationTimeMedianUs	= ((float)(((double)m_samples[m_samples.size() / 2]) / m_spec.iterationCount));
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Calculate variance
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			float iterationTimeUs	= (float)(((double)m_samples[sampleNdx]) / m_spec.iterationCount);
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			iterationTimeVarianceUs	+= std::pow(iterationTimeUs - iterationTimeMedianUs, 2.0f);
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Calculate min and max
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			float iterationTimeUs	= (float)(((double)m_samples[sampleNdx]) / m_spec.iterationCount);
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			iterationTimeMinUs		= std::min<float>(iterationTimeMinUs, iterationTimeUs);
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			iterationTimeMaxUs		= std::max<float>(iterationTimeMaxUs, iterationTimeUs);
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		iterationTimeVarianceUs /= m_samples.size();
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Calculate skewness
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			float iterationTimeUs	= (float)(((double)m_samples[sampleNdx]) / m_spec.iterationCount);
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			iterationTimeSkewnessUs	= std::pow((iterationTimeUs - iterationTimeMedianUs) / iterationTimeVarianceUs, 2.0f);
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		iterationTimeSkewnessUs /= (float)m_samples.size();
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			tcu::ScopedLogSection	section(log, "Result", "Statistics from results.");
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Total time: "	<< totalTimeUs				<< "us" << TestLog::EndMessage;
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Mean: "			<< iterationTimeMeanUs		<< "us" << TestLog::EndMessage;
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Median: "		<< iterationTimeMedianUs	<< "us" << TestLog::EndMessage;
4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Variance: "		<< iterationTimeVarianceUs	<< "us" << TestLog::EndMessage;
4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Skewness: "		<< iterationTimeSkewnessUs	<< "us" << TestLog::EndMessage;
4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Min: "			<< iterationTimeMinUs		<< "us" << TestLog::EndMessage;
4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Message << "Max: "			<< iterationTimeMaxUs		<< "us" << TestLog::EndMessage;
4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(((double)totalTimeUs)/totalIterationCount), 2).c_str());
4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4843c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCase::IterateResult MakeCurrentPerfCase::iterate (void)
4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_samples.size() == 0)
4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		logTestInfo();
4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGLDisplay	display		= m_eglTestCtx.getDisplay().getEGLDisplay();
4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint64	beginTimeUs	= deGetMicroseconds();
4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int iteration = 0; iteration < m_spec.iterationCount; iteration++)
4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			EGLContext	context = m_contexts[m_rnd.getUint32() % m_contexts.size()];
4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			EGLSurface	surface	= m_surfaces[m_rnd.getUint32() % m_surfaces.size()];
4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			TCU_CHECK_EGL_CALL(eglMakeCurrent(display, surface, surface, context));
4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (m_spec.release)
5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				TCU_CHECK_EGL_CALL(eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_samples.push_back(deGetMicroseconds() - beginTimeUs);
5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((int)m_samples.size() == m_spec.sampleCount)
5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		logResults();
5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return STOP;
5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return CONTINUE;
5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5163c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMakeCurrentPerfTests::MakeCurrentPerfTests (EglTestContext& eglTestCtx)
5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(eglTestCtx, "make_current", "eglMakeCurrent performance tests")
5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid MakeCurrentPerfTests::init (void)
5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int iterationCount	= 100;
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int sampleCount		= 100;
5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Add simple test group
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestCaseGroup* simple = new TestCaseGroup(m_eglTestCtx, "simple", "Simple eglMakeCurrent performance tests using single context and surface");
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const MakeCurrentPerfCase::SurfaceType types[] = {
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PBUFFER,
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PIXMAP,
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_WINDOW
5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++)
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++)
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				MakeCurrentPerfCase::Spec spec;
5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				spec.surfaceTypes	= types[typeNdx];
5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				spec.contextCount	= 1;
5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				spec.surfaceCount	= 1;
5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				spec.release		= (releaseNdx == 1);
5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				spec.iterationCount	= iterationCount;
5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				spec.sampleCount	= sampleCount;
5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				simple->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str()));
5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(simple);
5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Add multi context test group
5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestCaseGroup* multiContext = new TestCaseGroup(m_eglTestCtx, "multi_context", "eglMakeCurrent performance tests using multiple contexts and single surface");
5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const MakeCurrentPerfCase::SurfaceType types[] = {
5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PBUFFER,
5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PIXMAP,
5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_WINDOW
5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int contextCounts[] = {
5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			10, 100
5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int contextCountNdx = 0; contextCountNdx < DE_LENGTH_OF_ARRAY(contextCounts); contextCountNdx++)
5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++)
5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++)
5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				{
5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					MakeCurrentPerfCase::Spec spec;
5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.surfaceTypes	= types[typeNdx];
5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.contextCount	= contextCounts[contextCountNdx];
5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.surfaceCount	= 1;
5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.release		= (releaseNdx == 1);
5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.iterationCount	= iterationCount;
5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.sampleCount	= sampleCount;
5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					multiContext->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str()));
5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				}
5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(multiContext);
5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Add multi surface test group
5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestCaseGroup* multiSurface = new TestCaseGroup(m_eglTestCtx, "multi_surface", "eglMakeCurrent performance tests using single context and multiple surfaces");
5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const MakeCurrentPerfCase::SurfaceType types[] = {
5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PBUFFER,
5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PIXMAP,
6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_WINDOW,
6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER	|MakeCurrentPerfCase::SURFACETYPE_PIXMAP),
6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER	|MakeCurrentPerfCase::SURFACETYPE_WINDOW),
6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PIXMAP	|MakeCurrentPerfCase::SURFACETYPE_WINDOW),
6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER|MakeCurrentPerfCase::SURFACETYPE_PIXMAP|MakeCurrentPerfCase::SURFACETYPE_WINDOW)
6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int surfaceCounts[] = {
6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			10, 100
6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int surfaceCountNdx = 0; surfaceCountNdx < DE_LENGTH_OF_ARRAY(surfaceCounts); surfaceCountNdx++)
6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++)
6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++)
6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				{
6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					MakeCurrentPerfCase::Spec spec;
6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.surfaceTypes	= types[typeNdx];
6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.surfaceCount	= surfaceCounts[surfaceCountNdx];
6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.contextCount	= 1;
6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.release		= (releaseNdx == 1);
6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.iterationCount	= iterationCount;
6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					spec.sampleCount	= sampleCount;
6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					multiSurface->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str()));
6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				}
6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(multiSurface);
6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Add Complex? test group
6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestCaseGroup* multi = new TestCaseGroup(m_eglTestCtx, "complex", "eglMakeCurrent performance tests using multiple contexts and multiple surfaces");
6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const MakeCurrentPerfCase::SurfaceType types[] = {
6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PBUFFER,
6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_PIXMAP,
6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			MakeCurrentPerfCase::SURFACETYPE_WINDOW,
6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER	|MakeCurrentPerfCase::SURFACETYPE_PIXMAP),
6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER	|MakeCurrentPerfCase::SURFACETYPE_WINDOW),
6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PIXMAP	|MakeCurrentPerfCase::SURFACETYPE_WINDOW),
6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			(MakeCurrentPerfCase::SurfaceType)(MakeCurrentPerfCase::SURFACETYPE_PBUFFER|MakeCurrentPerfCase::SURFACETYPE_PIXMAP|MakeCurrentPerfCase::SURFACETYPE_WINDOW)
6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int surfaceCounts[] = {
6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			10, 100
6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const int contextCounts[] = {
6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			10, 100
6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int surfaceCountNdx = 0; surfaceCountNdx < DE_LENGTH_OF_ARRAY(surfaceCounts); surfaceCountNdx++)
6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			for (int contextCountNdx = 0; contextCountNdx < DE_LENGTH_OF_ARRAY(contextCounts); contextCountNdx++)
6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				for (int typeNdx = 0; typeNdx < DE_LENGTH_OF_ARRAY(types); typeNdx++)
6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				{
6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					for (int releaseNdx = 0; releaseNdx < 2; releaseNdx++)
6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					{
6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						MakeCurrentPerfCase::Spec spec;
6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						spec.surfaceTypes	= types[typeNdx];
6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						spec.contextCount	= contextCounts[contextCountNdx];
6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						spec.surfaceCount	= surfaceCounts[surfaceCountNdx];
6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						spec.release		= (releaseNdx == 1);
6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						spec.iterationCount	= iterationCount;
6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						spec.sampleCount	= sampleCount;
6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						multi->addChild(new MakeCurrentPerfCase(m_eglTestCtx, spec, spec.toName().c_str(), spec.toDescription().c_str()));
6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					}
6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				}
6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(multi);
6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl
6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
690