13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.0 Module
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * -------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Flush and finish tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es3fFlushFinishTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluObjectWrapper.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDrawUtil.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glsCalibration.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp"
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deRandom.hpp"
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deClock.h"
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deThread.h"
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deMath.h"
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <algorithm>
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles3
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector;
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog;
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::Vec2;
578852c82a1ffa4760985c17cc6875d5d521daf343Jarkko Poyryusing deqp::gls::theilSenLinearRegression;
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing deqp::gls::LineParameters;
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MAX_VIEWPORT_SIZE		= 256,
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MAX_SAMPLE_DURATION_US	= 200*1000,
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	WAIT_TIME_MS			= 150,
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MIN_DRAW_CALL_COUNT		= 10,
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MAX_DRAW_CALL_COUNT		= 1<<20,
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	MAX_SHADER_ITER_COUNT	= 1<<10,
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	NUM_SAMPLES				= 50
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst float		NO_CORR_COEF_THRESHOLD		= 0.1f;
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst float		FLUSH_COEF_THRESHOLD		= 0.2f;
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst float		CORRELATED_COEF_THRESHOLD	= 0.5f;
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic void busyWait (int milliseconds)
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deUint64	startTime	= deGetMicroseconds();
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	float			v			= 2.0f;
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (;;)
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int i = 0; i < 10; i++)
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			v = deFloatSin(v);
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (deGetMicroseconds()-startTime >= deUint64(1000*milliseconds))
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CalibrationFailedException : public std::runtime_error
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CalibrationFailedException (const std::string& reason) : std::runtime_error(reason) {}
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FlushFinishCase : public TestCase
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum ExpectedBehavior
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EXPECT_COEF_LESS_THAN = 0,
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EXPECT_COEF_GREATER_THAN,
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							FlushFinishCase		(Context&			context,
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 const char*		name,
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 const char*		description,
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 ExpectedBehavior	waitBehavior,
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 float				waitThreshold,
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 ExpectedBehavior	readBehavior,
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry												 float				readThreshold);
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							~FlushFinishCase	(void);
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					init				(void);
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					deinit				(void);
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	IterateResult			iterate				(void);
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	struct Sample
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int			numDrawCalls;
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint64	waitTime;
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint64	readPixelsTime;
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	struct CalibrationParams
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int			numItersInShader;
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int			maxDrawCalls;
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	virtual void			waitForGL			(void) = 0;
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							FlushFinishCase		(const FlushFinishCase&);
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FlushFinishCase&		operator=			(const FlushFinishCase&);
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CalibrationParams		calibrate			(void);
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					analyzeResults		(const std::vector<Sample>& samples, const CalibrationParams& calibrationParams);
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					setupRenderState	(void);
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					setShaderIterCount	(int numIters);
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					render				(int numDrawCalls);
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void					readPixels			(void);
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const ExpectedBehavior	m_waitBehavior;
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float				m_waitThreshold;
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const ExpectedBehavior	m_readBehavior;
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float				m_readThreshold;
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glu::ShaderProgram*		m_program;
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int						m_iterCountLoc;
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1583c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFlushFinishCase::FlushFinishCase (Context& context, const char* name, const char* description, ExpectedBehavior waitBehavior, float waitThreshold, ExpectedBehavior readBehavior, float readThreshold)
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCase			(context, name, description)
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_waitBehavior	(waitBehavior)
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_waitThreshold	(waitThreshold)
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_readBehavior	(readBehavior)
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_readThreshold	(readThreshold)
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_program			(DE_NULL)
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_iterCountLoc	(0)
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1693c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFlushFinishCase::~FlushFinishCase (void)
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FlushFinishCase::deinit();
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishCase::init (void)
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(!m_program);
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_program = new glu::ShaderProgram(m_context.getRenderContext(),
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		glu::ProgramSources()
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< glu::VertexSource(
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"#version 300 es\n"
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"in highp vec4 a_position;\n"
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"out highp vec4 v_coord;\n"
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"void main (void)\n"
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"{\n"
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"	gl_Position = a_position;\n"
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"	v_coord = a_position;\n"
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"}\n")
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			<< glu::FragmentSource(
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"#version 300 es\n"
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"uniform highp int u_numIters;\n"
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"in highp vec4 v_coord;\n"
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"out mediump vec4 o_color;\n"
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"void main (void)\n"
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"{\n"
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"	highp vec4 color = v_coord;\n"
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"	for (int i = 0; i < u_numIters; i++)\n"
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"		color = sin(color);\n"
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"	o_color = color;\n"
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				"}\n"));
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!m_program->isOk())
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << *m_program;
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		delete m_program;
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_program = DE_NULL;
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_FAIL("Compile failed");
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_iterCountLoc = m_context.getRenderContext().getFunctions().getUniformLocation(m_program->getProgram(), "u_numIters");
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK(m_iterCountLoc >= 0);
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishCase::deinit (void)
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	delete m_program;
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_program = DE_NULL;
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytcu::TestLog& operator<< (tcu::TestLog& log, const FlushFinishCase::Sample& sample)
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	log << TestLog::Message << sample.numDrawCalls << " calls:\t" << sample.waitTime << " us wait,\t" << sample.readPixelsTime << " us read" << TestLog::EndMessage;
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return log;
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishCase::setupRenderState (void)
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions&	gl				= m_context.getRenderContext().getFunctions();
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int				posLoc			= gl.getAttribLocation(m_program->getProgram(), "a_position");
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int				viewportW		= de::min<int>(m_context.getRenderTarget().getWidth(), MAX_VIEWPORT_SIZE);
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int				viewportH		= de::min<int>(m_context.getRenderTarget().getHeight(), MAX_VIEWPORT_SIZE);
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	static const float s_positions[] =
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		-1.0f, -1.0f,
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		+1.0f, -1.0f,
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		-1.0f, +1.0f,
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		+1.0f, +1.0f
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK(posLoc >= 0);
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.viewport(0, 0, viewportW, viewportH);
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.useProgram(m_program->getProgram());
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.enableVertexAttribArray(posLoc);
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.vertexAttribPointer(posLoc, 2, GL_FLOAT, GL_FALSE, 0, &s_positions[0]);
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.enable(GL_BLEND);
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.blendFunc(GL_ONE, GL_ONE);
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.blendEquation(GL_FUNC_ADD);
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to set up render state");
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishCase::setShaderIterCount (int numIters)
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions&	gl	= m_context.getRenderContext().getFunctions();
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.uniform1i(m_iterCountLoc, numIters);
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishCase::render (int numDrawCalls)
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions&	gl	= m_context.getRenderContext().getFunctions();
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const deUint8 indices[] = { 0, 1, 2, 2, 1, 3 };
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.clear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int ndx = 0; ndx < numDrawCalls; ndx++)
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.drawElements(GL_TRIANGLES, DE_LENGTH_OF_ARRAY(indices), GL_UNSIGNED_BYTE, &indices[0]);
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishCase::readPixels (void)
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const glw::Functions&	gl		= m_context.getRenderContext().getFunctions();
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint8					tmp[4];
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.readPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &tmp);
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2793c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFlushFinishCase::CalibrationParams FlushFinishCase::calibrate (void)
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::ScopedLogSection		section				(m_testCtx.getLog(), "CalibrationInfo", "Calibration info");
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CalibrationParams			params;
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Step 1: find iteration count that results in rougly 1/10th of target maximum sample duration.
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const deUint64		targetDurationUs		= MAX_SAMPLE_DURATION_US/100;
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint64			prevDuration			= 0;
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int					prevIterCount			= 1;
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int					curIterCount			= 1;
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Message << "Calibrating shader iteration count, target duration = " << targetDurationUs << " us" << TestLog::EndMessage;
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (;;)
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deUint64 curDuration;
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			setShaderIterCount(curIterCount);
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const deUint64	startTime	= deGetMicroseconds();
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				render(1);
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				readPixels();
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				curDuration = deGetMicroseconds()-startTime;
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << TestLog::Message << "Duration with " << curIterCount << " iterations = " << curDuration << " us" << TestLog::EndMessage;
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (curDuration > targetDurationUs)
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (curIterCount > 1)
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				{
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					// Compute final count by using linear estimation.
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					const float		a		= float(curDuration - prevDuration) / float(curIterCount - prevIterCount);
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					const float		b		= float(prevDuration) - a*float(prevIterCount);
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					const float		est		= (float(targetDurationUs) - b) / a;
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					curIterCount = de::clamp(deFloorFloatToInt32(est), 1, int(MAX_SHADER_ITER_COUNT));
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				}
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				// else: Settle on 1.
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else if (curIterCount >= MAX_SHADER_ITER_COUNT)
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break; // Settle on maximum.
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				prevIterCount	= curIterCount;
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				prevDuration	= curDuration;
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				curIterCount	= curIterCount*2;
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params.numItersInShader = curIterCount;
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Integer("ShaderIterCount", "Shader iteration count", "", QP_KEY_TAG_NONE, params.numItersInShader);
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Step 2: Find draw call count that results in desired maximum time.
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint64			prevDuration			= 0;
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int					prevDrawCount			= 1;
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		int					curDrawCount			= 1;
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Message << "Calibrating maximum draw call count, target duration = " << int(MAX_SAMPLE_DURATION_US) << " us" << TestLog::EndMessage;
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		setShaderIterCount(params.numItersInShader);
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (;;)
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deUint64 curDuration;
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				const deUint64	startTime	= deGetMicroseconds();
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				render(curDrawCount);
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				readPixels();
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				curDuration = deGetMicroseconds()-startTime;
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << TestLog::Message << "Duration with " << curDrawCount << " draw calls = " << curDuration << " us" << TestLog::EndMessage;
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (curDuration > MAX_SAMPLE_DURATION_US)
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				if (curDrawCount > 1)
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				{
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					// Compute final count by using linear estimation.
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					const float		a		= float(curDuration - prevDuration) / float(curDrawCount - prevDrawCount);
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					const float		b		= float(prevDuration) - a*float(prevDrawCount);
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					const float		est		= (float(MAX_SAMPLE_DURATION_US) - b) / a;
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					curDrawCount = de::clamp(deFloorFloatToInt32(est), 1, int(MAX_DRAW_CALL_COUNT));
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				}
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				// else: Settle on 1.
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else if (curDrawCount >= MAX_DRAW_CALL_COUNT)
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break; // Settle on maximum.
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				prevDrawCount	= curDrawCount;
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				prevDuration	= curDuration;
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				curDrawCount	= curDrawCount*2;
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params.maxDrawCalls = curDrawCount;
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Integer("MaxDrawCalls", "Maximum number of draw calls", "", QP_KEY_TAG_NONE, params.maxDrawCalls);
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Sanity check.
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (params.maxDrawCalls < MIN_DRAW_CALL_COUNT)
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw CalibrationFailedException("Calibration failed, maximum draw call count is too low");
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return params;
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystruct CompareSampleDrawCount
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool operator() (const FlushFinishCase::Sample& a, const FlushFinishCase::Sample& b) const { return a.numDrawCalls < b.numDrawCalls; }
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystd::vector<Vec2> getPointsFromSamples (const std::vector<FlushFinishCase::Sample>& samples, const deUint64 FlushFinishCase::Sample::*field)
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Vec2> points(samples.size());
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (size_t ndx = 0; ndx < samples.size(); ndx++)
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		points[ndx] = Vec2(float(samples[ndx].numDrawCalls), float(samples[ndx].*field));
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return points;
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyrytemplate<typename T>
4143c827367444ee418f129b2c238299f49d3264554Jarkko PoyryT getMaximumValue (const std::vector<FlushFinishCase::Sample>& samples, const T FlushFinishCase::Sample::*field)
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	DE_ASSERT(!samples.empty());
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	T maxVal = samples[0].*field;
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (size_t ndx = 1; ndx < samples.size(); ndx++)
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		maxVal = de::max(maxVal, samples[ndx].*field);
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return maxVal;
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishCase::analyzeResults (const std::vector<Sample>& samples, const CalibrationParams& calibrationParams)
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Vec2>		waitTimes		= getPointsFromSamples(samples, &Sample::waitTime);
4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const vector<Vec2>		readTimes		= getPointsFromSamples(samples, &Sample::readPixelsTime);
4308852c82a1ffa4760985c17cc6875d5d521daf343Jarkko Poyry	const LineParameters	waitLine		= theilSenLinearRegression(waitTimes);
4318852c82a1ffa4760985c17cc6875d5d521daf343Jarkko Poyry	const LineParameters	readLine		= theilSenLinearRegression(readTimes);
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float				normWaitCoef	= waitLine.coefficient * float(calibrationParams.maxDrawCalls) / float(MAX_SAMPLE_DURATION_US);
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float				normReadCoef	= readLine.coefficient * float(calibrationParams.maxDrawCalls) / float(MAX_SAMPLE_DURATION_US);
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool					allOk			= true;
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::ScopedLogSection	section			(m_testCtx.getLog(), "Samples", "Samples");
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		vector<Sample>			sortedSamples	(samples.begin(), samples.end());
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		std::sort(sortedSamples.begin(), sortedSamples.end(), CompareSampleDrawCount());
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (vector<Sample>::const_iterator iter = sortedSamples.begin(); iter != sortedSamples.end(); ++iter)
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << *iter;
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_testCtx.getLog() << TestLog::Float("WaitCoefficient",				"Wait coefficient", "", QP_KEY_TAG_NONE, waitLine.coefficient)
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					   << TestLog::Float("ReadCoefficient",				"Read coefficient", "", QP_KEY_TAG_NONE, readLine.coefficient)
4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					   << TestLog::Float("NormalizedWaitCoefficient",	"Normalized wait coefficient", "", QP_KEY_TAG_NONE, normWaitCoef)
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry					   << TestLog::Float("NormalizedReadCoefficient",	"Normalized read coefficient", "", QP_KEY_TAG_NONE, normReadCoef);
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const bool		waitCorrelated		= normWaitCoef > CORRELATED_COEF_THRESHOLD;
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const bool		readCorrelated		= normReadCoef > CORRELATED_COEF_THRESHOLD;
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const bool		waitNotCorr			= normWaitCoef < NO_CORR_COEF_THRESHOLD;
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const bool		readNotCorr			= normReadCoef < NO_CORR_COEF_THRESHOLD;
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (waitCorrelated || waitNotCorr)
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << TestLog::Message << "Wait time is" << (waitCorrelated ? "" : " NOT") << " correlated to rendering workload size." << TestLog::EndMessage;
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << TestLog::Message << "Warning: Wait time correlation to rendering workload size is unclear." << TestLog::EndMessage;
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (readCorrelated || readNotCorr)
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << TestLog::Message << "Read time is" << (readCorrelated ? "" : " NOT") << " correlated to rendering workload size." << TestLog::EndMessage;
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		else
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << TestLog::Message << "Warning: Read time correlation to rendering workload size is unclear." << TestLog::EndMessage;
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int ndx = 0; ndx < 2; ndx++)
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const float				coef		= ndx == 0 ? normWaitCoef : normReadCoef;
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*				name		= ndx == 0 ? "wait" : "read";
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const ExpectedBehavior	behavior	= ndx == 0 ? m_waitBehavior : m_readBehavior;
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const float				threshold	= ndx == 0 ? m_waitThreshold : m_readThreshold;
4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const bool				isOk		= behavior == EXPECT_COEF_GREATER_THAN	? coef > threshold :
4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  behavior == EXPECT_COEF_LESS_THAN		? coef < threshold : false;
4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*				cmpName		= behavior == EXPECT_COEF_GREATER_THAN	? "greater than" :
4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry											  behavior == EXPECT_COEF_LESS_THAN		? "less than" : DE_NULL;
4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!isOk)
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.getLog() << TestLog::Message << "ERROR: Expected " << name << " coefficient to be " << cmpName << " " << threshold << TestLog::EndMessage;
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			allOk = false;
4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_testCtx.setTestResult(allOk ? QP_TEST_RESULT_PASS	: QP_TEST_RESULT_FAIL,
4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							allOk ? "Pass"				: "Suspicious performance behavior");
4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4903c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFlushFinishCase::IterateResult FlushFinishCase::iterate (void)
4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<Sample>		samples		(NUM_SAMPLES);
4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CalibrationParams	params;
4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Try to poke CPU into full speed. \todo [2013-12-26 pyry] Use more robust method.
4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	busyWait(10);
4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	setupRenderState();
4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Do one full render cycle.
5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		setShaderIterCount(1);
5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		render(1);
5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		readPixels();
5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Calibrate.
5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		params = calibrate();
5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (const CalibrationFailedException& e)
5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_COMPATIBILITY_WARNING, e.what());
5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		return STOP;
5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Do measurement.
5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		de::Random	rnd		(123);
5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		setShaderIterCount(params.numItersInShader);
5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (size_t ndx = 0; ndx < samples.size(); ndx++)
5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const int	drawCallCount	= rnd.getInt(1, params.maxDrawCalls);
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deUint64	waitStartTime;
5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deUint64	readStartTime;
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deUint64	readFinishTime;
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			render(drawCallCount);
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			waitStartTime = deGetMicroseconds();
5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			waitForGL();
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			readStartTime = deGetMicroseconds();
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			readPixels();
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			readFinishTime = deGetMicroseconds();
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			samples[ndx].numDrawCalls	= drawCallCount;
5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			samples[ndx].waitTime		= readStartTime-waitStartTime;
5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			samples[ndx].readPixelsTime	= readFinishTime-readStartTime;
5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (m_testCtx.getWatchDog())
5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				qpWatchDog_touch(m_testCtx.getWatchDog());
5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Analyze - sets test case result.
5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	analyzeResults(samples, params);
5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return STOP;
5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass WaitOnlyCase : public FlushFinishCase
5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	WaitOnlyCase (Context& context)
5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: FlushFinishCase(context, "wait", "Wait only", EXPECT_COEF_LESS_THAN, NO_CORR_COEF_THRESHOLD, EXPECT_COEF_GREATER_THAN, -1000.0f /* practically nothing is expected */)
5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Message << int(WAIT_TIME_MS) << " ms busy wait" << TestLog::EndMessage;
5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FlushFinishCase::init();
5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void waitForGL (void)
5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		busyWait(WAIT_TIME_MS);
5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FlushOnlyCase : public FlushFinishCase
5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FlushOnlyCase (Context& context)
5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: FlushFinishCase(context, "flush", "Flush only", EXPECT_COEF_LESS_THAN, FLUSH_COEF_THRESHOLD, EXPECT_COEF_GREATER_THAN, CORRELATED_COEF_THRESHOLD)
5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Message << "Single call to glFlush()" << TestLog::EndMessage;
5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FlushFinishCase::init();
5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void waitForGL (void)
5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_context.getRenderContext().getFunctions().flush();
5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FlushWaitCase : public FlushFinishCase
5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FlushWaitCase (Context& context)
6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: FlushFinishCase(context, "flush_wait", "Wait after flushing", EXPECT_COEF_LESS_THAN, FLUSH_COEF_THRESHOLD, EXPECT_COEF_LESS_THAN, NO_CORR_COEF_THRESHOLD)
6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Message << "glFlush() followed by " << int(WAIT_TIME_MS) << " ms busy wait" << TestLog::EndMessage;
6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FlushFinishCase::init();
6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void waitForGL (void)
6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_context.getRenderContext().getFunctions().flush();
6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		busyWait(WAIT_TIME_MS);
6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FinishOnlyCase : public FlushFinishCase
6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FinishOnlyCase (Context& context)
6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: FlushFinishCase(context, "finish", "Finish only", EXPECT_COEF_GREATER_THAN, CORRELATED_COEF_THRESHOLD, EXPECT_COEF_LESS_THAN, NO_CORR_COEF_THRESHOLD)
6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Message << "Single call to glFinish()" << TestLog::EndMessage;
6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FlushFinishCase::init();
6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void waitForGL (void)
6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_context.getRenderContext().getFunctions().finish();
6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FinishWaitCase : public FlushFinishCase
6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	FinishWaitCase (Context& context)
6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		: FlushFinishCase(context, "finish_wait", "Finish and wait", EXPECT_COEF_GREATER_THAN, CORRELATED_COEF_THRESHOLD, EXPECT_COEF_LESS_THAN, NO_CORR_COEF_THRESHOLD)
6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void init (void)
6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.getLog() << TestLog::Message << "glFinish() followed by " << int(WAIT_TIME_MS) << " ms busy wait" << TestLog::EndMessage;
6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		FlushFinishCase::init();
6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected:
6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void waitForGL (void)
6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_context.getRenderContext().getFunctions().finish();
6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		busyWait(WAIT_TIME_MS);
6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6643c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFlushFinishTests::FlushFinishTests (Context& context)
6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(context, "flush_finish", "Flush and Finish tests")
6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6693c827367444ee418f129b2c238299f49d3264554Jarkko PoyryFlushFinishTests::~FlushFinishTests (void)
6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid FlushFinishTests::init (void)
6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new WaitOnlyCase	(m_context));
6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FlushOnlyCase	(m_context));
6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FlushWaitCase	(m_context));
6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FinishOnlyCase	(m_context));
6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	addChild(new FinishWaitCase	(m_context));
6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional
6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles3
6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
685