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 Base class for rendering tests.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglRenderCase.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSimpleConfigCase.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeDisplay.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeWindow.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativePixmap.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUtil.hpp"
323c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "egluUnique.hpp"
333c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
343c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwLibrary.hpp"
353c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwEnums.hpp"
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuRenderTarget.hpp"
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuCommandLine.hpp"
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp"
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deUniquePtr.hpp"
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <algorithm>
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <iterator>
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <memory>
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <set>
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing std::string;
553c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing std::vector;
563c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing std::set;
573c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing tcu::TestLog;
583c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing namespace eglw;
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
603c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic void postSurface (const Library& egl, EGLDisplay display, EGLSurface surface, EGLint typeBit)
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
623c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	if (typeBit == EGL_WINDOW_BIT)
633c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, swapBuffers(display, surface));
643c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	else if (typeBit == EGL_PIXMAP_BIT)
653c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, waitClient());
663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	else if (typeBit == EGL_PBUFFER_BIT)
673c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, waitClient());
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	else
693c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		DE_ASSERT(false);
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// RenderCase
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
7443105a34f40257cf4887e3401404c0f783e896c2Mika IsojärviRenderCase::RenderCase (EglTestContext& eglTestCtx, const char* name, const char* description, EGLint surfaceTypeMask, const eglu::FilterList& filters)
753c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	: SimpleConfigCase	(eglTestCtx, name, description, filters)
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_surfaceTypeMask	(surfaceTypeMask)
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
803c827367444ee418f129b2c238299f49d3264554Jarkko PoyryRenderCase::~RenderCase (void)
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry HaulosEGLint getBuildClientAPIMask (void)
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLint apiMask = 0;
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
883c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	// Always supported regardless of flags - dynamically loaded
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	apiMask |= EGL_OPENGL_ES2_BIT;
903c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	apiMask |= EGL_OPENGL_ES3_BIT;
913c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	apiMask |= EGL_OPENGL_BIT;
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined(DEQP_SUPPORT_GLES1)
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	apiMask |= EGL_OPENGL_ES_BIT;
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#if defined(DEQP_SUPPORT_VG)
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	apiMask |= EGL_OPENVG_BIT;
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return apiMask;
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1043c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic void checkBuildClientAPISupport (EGLint requiredAPIs)
1053c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos{
1063c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const EGLint	builtClientAPIs		= getBuildClientAPIMask();
1073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
1083c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	if ((requiredAPIs & builtClientAPIs) != requiredAPIs)
1093c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		TCU_THROW(InternalError, "Test case requires client API not supported in current build");
1103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos}
1113c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
1123c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid RenderCase::executeForConfig (EGLDisplay display, EGLConfig config)
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1143c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const Library&						egl				= m_eglTestCtx.getLibrary();
1153c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	tcu::TestLog&						log				= m_testCtx.getLog();
1163c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const int							width			= 128;
1173c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const int							height			= 128;
1183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const EGLint						configId		= eglu::getConfigID(egl, display, config);
1193c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
1203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const eglu::NativeDisplayFactory&	displayFactory	= m_eglTestCtx.getNativeDisplayFactory();
1213c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	eglu::NativeDisplay&				nativeDisplay	= m_eglTestCtx.getNativeDisplay();
1223c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
1233c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	bool								isOk			= true;
1243c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	string								failReason		= "";
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_surfaceTypeMask & EGL_WINDOW_BIT)
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1283c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		tcu::ScopedLogSection(log,
1293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos							  string("Config") + de::toString(configId) + "-Window",
1303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos							  string("Config ID ") + de::toString(configId) + ", window surface");
1313c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
132485844e764f2821545146b832726a36012f86238Mika Isojärvi		const eglu::NativeWindowFactory&	windowFactory	= eglu::selectNativeWindowFactory(displayFactory, m_testCtx.getCommandLine());
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		try
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			const eglu::WindowParams			params		(width, height, eglu::parseWindowVisibility(m_testCtx.getCommandLine()));
137485844e764f2821545146b832726a36012f86238Mika Isojärvi			de::UniquePtr<eglu::NativeWindow>	window		(windowFactory.createWindow(&nativeDisplay, display, config, DE_NULL, params));
1383c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLSurface							eglSurface	= createWindowSurface(nativeDisplay, *window, display, config, DE_NULL);
1393c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			eglu::UniqueSurface					surface		(egl, display, eglSurface);
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1413c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			executeForSurface(display, *surface, Config(config, EGL_WINDOW_BIT, 0));
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		catch (const tcu::TestError& e)
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << e;
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			isOk = false;
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			failReason = e.what();
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_surfaceTypeMask & EGL_PIXMAP_BIT)
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1533c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		tcu::ScopedLogSection(log,
1543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos							  string("Config") + de::toString(configId) + "-Pixmap",
1553c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos							  string("Config ID ") + de::toString(configId) + ", pixmap surface");
1563c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
157485844e764f2821545146b832726a36012f86238Mika Isojärvi		const eglu::NativePixmapFactory&	pixmapFactory	= eglu::selectNativePixmapFactory(displayFactory, m_testCtx.getCommandLine());
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		try
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
161485844e764f2821545146b832726a36012f86238Mika Isojärvi			std::auto_ptr<eglu::NativePixmap>	pixmap		(pixmapFactory.createPixmap(&nativeDisplay, display, config, DE_NULL, width, height));
1623c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLSurface							eglSurface	= createPixmapSurface(nativeDisplay, *pixmap, display, config, DE_NULL);
1633c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			eglu::UniqueSurface					surface		(egl, display, eglSurface);
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1653c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			executeForSurface(display, *surface, Config(config, EGL_PIXMAP_BIT, 0));
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		catch (const tcu::TestError& e)
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << e;
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			isOk = false;
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			failReason = e.what();
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (m_surfaceTypeMask & EGL_PBUFFER_BIT)
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1773c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		tcu::ScopedLogSection(log,
1783c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos							  string("Config") + de::toString(configId) + "-Pbuffer",
1793c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos							  string("Config ID ") + de::toString(configId) + ", pbuffer surface");
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		try
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1823c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			const EGLint surfaceAttribs[] =
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				EGL_WIDTH,	width,
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				EGL_HEIGHT,	height,
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				EGL_NONE
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			};
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1893c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			eglu::UniqueSurface surface(egl, display, egl.createPbufferSurface(display, config, surfaceAttribs));
1903c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLU_CHECK_MSG(egl, "eglCreatePbufferSurface()");
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1923c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			executeForSurface(display, *surface, Config(config, EGL_PBUFFER_BIT, 0));
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		catch (const tcu::TestError& e)
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << e;
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			isOk = false;
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			failReason = e.what();
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (!isOk && m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, failReason.c_str());
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// SingleContextRenderCase
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2083c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry HaulosSingleContextRenderCase::SingleContextRenderCase (EglTestContext& eglTestCtx, const char* name, const char* description, EGLint apiMask, EGLint surfaceTypeMask, const eglu::FilterList& filters)
20943105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	: RenderCase	(eglTestCtx, name, description, surfaceTypeMask, filters)
21043105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	, m_apiMask		(apiMask)
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2143c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySingleContextRenderCase::~SingleContextRenderCase (void)
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid SingleContextRenderCase::executeForSurface (EGLDisplay display, EGLSurface surface, const Config& config)
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
22043105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	const Library&		egl				= m_eglTestCtx.getLibrary();
22143105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	const EGLint		apis[]			= { EGL_OPENGL_ES2_BIT, EGL_OPENGL_ES3_BIT_KHR, EGL_OPENGL_ES_BIT, EGL_OPENVG_BIT };
22243105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	tcu::TestLog&		log				= m_testCtx.getLog();
22343105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	const EGLint		configApiMask	= eglu::getConfigAttribInt(egl, display, config.config, EGL_RENDERABLE_TYPE);
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2253c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	checkBuildClientAPISupport(m_apiMask);
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int apiNdx = 0; apiNdx < DE_LENGTH_OF_ARRAY(apis); apiNdx++)
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGLint apiBit = apis[apiNdx];
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
23143105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi		// Skip API if build or current config doesn't support it.
23243105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi		if ((apiBit & m_apiMask) == 0 || (apiBit & configApiMask) == 0)
23343105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi			continue;
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGLint			api		= EGL_NONE;
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const char*		apiName	= DE_NULL;
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		vector<EGLint>	contextAttribs;
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Select api enum and build context attributes.
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		switch (apiBit)
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			case EGL_OPENGL_ES2_BIT:
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				api		= EGL_OPENGL_ES_API;
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				apiName	= "OpenGL ES 2.x";
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				contextAttribs.push_back(EGL_CONTEXT_CLIENT_VERSION);
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				contextAttribs.push_back(2);
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			case EGL_OPENGL_ES3_BIT_KHR:
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				api		= EGL_OPENGL_ES_API;
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				apiName	= "OpenGL ES 3.x";
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				contextAttribs.push_back(EGL_CONTEXT_MAJOR_VERSION_KHR);
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				contextAttribs.push_back(3);
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			case EGL_OPENGL_ES_BIT:
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				api		= EGL_OPENGL_ES_API;
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				apiName	= "OpenGL ES 1.x";
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				contextAttribs.push_back(EGL_CONTEXT_CLIENT_VERSION);
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				contextAttribs.push_back(1);
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			case EGL_OPENVG_BIT:
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				api		= EGL_OPENVG_API;
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				apiName	= "OpenVG";
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				break;
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			default:
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				DE_ASSERT(DE_FALSE);
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		contextAttribs.push_back(EGL_NONE);
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << apiName << TestLog::EndMessage;
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, bindAPI(api));
2773c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
2783c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		eglu::UniqueContext	context	(egl, display, egl.createContext(display, config.config, EGL_NO_CONTEXT, &contextAttribs[0]));
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2803c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, surface, surface, *context));
2813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		executeForContext(display, *context, surface, Config(config.config, config.surfaceTypeBit, apiBit));
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Call SwapBuffers() / WaitClient() to finish rendering
2843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		postSurface(egl, display, surface, config.surfaceTypeBit);
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2863c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
2873c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	EGLU_CHECK_CALL(egl, makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// MultiContextRenderCase
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2923c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry HaulosMultiContextRenderCase::MultiContextRenderCase (EglTestContext& eglTestCtx, const char* name, const char* description, EGLint api, EGLint surfaceType, const eglu::FilterList& filters, int numContextsPerApi)
29343105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	: RenderCase			(eglTestCtx, name, description, surfaceType, filters)
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_numContextsPerApi	(numContextsPerApi)
29543105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	, m_apiMask				(api)
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2993c827367444ee418f129b2c238299f49d3264554Jarkko PoyryMultiContextRenderCase::~MultiContextRenderCase (void)
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3033c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid MultiContextRenderCase::executeForSurface (EGLDisplay display, EGLSurface surface, const Config& config)
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
30543105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	const Library&							egl				= m_eglTestCtx.getLibrary();
30643105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	const EGLint							configApiMask	= eglu::getConfigAttribInt(egl, display, config.config, EGL_RENDERABLE_TYPE);
3073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	vector<std::pair<EGLint, EGLContext> >	contexts;
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	contexts.reserve(3*m_numContextsPerApi); // 3 types of contexts at maximum.
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	checkBuildClientAPISupport(m_apiMask);
3113c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
31243105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	// ConfigFilter should make sure that config always supports all of the APIs.
31343105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi	TCU_CHECK_INTERNAL((configApiMask & m_apiMask) == m_apiMask);
31443105a34f40257cf4887e3401404c0f783e896c2Mika Isojärvi
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Create contexts that will participate in rendering.
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int ndx = 0; ndx < m_numContextsPerApi; ndx++)
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (m_apiMask & EGL_OPENGL_ES2_BIT)
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				static const EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
3233c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
3243c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				contexts.push_back(std::make_pair(EGL_OPENGL_ES2_BIT, egl.createContext(display, config.config, EGL_NO_CONTEXT, &attribs[0])));
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (m_apiMask & EGL_OPENGL_ES3_BIT_KHR)
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				static const EGLint attribs[] = { EGL_CONTEXT_MAJOR_VERSION_KHR, 3, EGL_NONE };
3303c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
3313c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				contexts.push_back(std::make_pair(EGL_OPENGL_ES3_BIT_KHR, egl.createContext(display, config.config, EGL_NO_CONTEXT, &attribs[0])));
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (m_apiMask & EGL_OPENGL_ES_BIT)
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				static const EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE };
3373c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
3383c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				contexts.push_back(std::make_pair(EGL_OPENGL_ES_BIT, egl.createContext(display, config.config, EGL_NO_CONTEXT, &attribs[0])));
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (m_apiMask & EGL_OPENVG_BIT)
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				static const EGLint attribs[] = { EGL_NONE };
3443c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENVG_API));
3453c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				contexts.push_back(std::make_pair(EGL_OPENVG_BIT, egl.createContext(display, config.config, EGL_NO_CONTEXT, &attribs[0])));
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3493c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_MSG(egl, "eglCreateContext()");
3503c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Execute for contexts.
3523c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		executeForContexts(display, surface, Config(config.config, config.surfaceTypeBit, m_apiMask), contexts);
3533c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
3543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3563c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	catch (...)
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Make sure all contexts have been destroyed.
3593c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		for (vector<std::pair<EGLint, EGLContext> >::iterator i = contexts.begin(); i != contexts.end(); i++)
3603c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			egl.destroyContext(display, i->second);
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Destroy contexts.
3653c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	for (vector<std::pair<EGLint, EGLContext> >::iterator i = contexts.begin(); i != contexts.end(); i++)
3663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		egl.destroyContext(display, i->second);
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Utilities
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3713c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulostemplate <int Red, int Green, int Blue, int Alpha>
3723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic bool colorBits (const eglu::CandidateConfig& c)
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3743c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	return c.redSize()		== Red		&&
3753c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		   c.greenSize()	== Green	&&
3763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		   c.blueSize()		== Blue		&&
3773c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		   c.alphaSize()	== Alpha;
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3803c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulostemplate <int Red, int Green, int Blue, int Alpha>
3813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic bool notColorBits (const eglu::CandidateConfig& c)
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3833c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	return c.redSize()		!= Red		||
3843c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		   c.greenSize()	!= Green	||
3853c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		   c.blueSize()		!= Blue		||
3863c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		   c.alphaSize()	!= Alpha;
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3893c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulostemplate <deUint32 Type>
3903c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic bool surfaceType (const eglu::CandidateConfig& c)
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3923c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	return (c.surfaceType() & Type) == Type;
3933c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos}
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
395a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvistatic bool isConformant (const eglu::CandidateConfig& c)
396a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi{
397a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi	return c.get(EGL_CONFIG_CAVEAT) != EGL_NON_CONFORMANT_CONFIG;
398a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi}
399a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi
4003c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid getDefaultRenderFilterLists (vector<RenderFilterList>& filterLists, const eglu::FilterList& baseFilters)
4013c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos{
4023c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	static const struct
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4043c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		const char*			name;
4053c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		eglu::ConfigFilter	filter;
4063c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	} s_colorRules[] =
4073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	{
4083c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "rgb565",		colorBits<5, 6, 5, 0>	},
4093c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "rgb888",		colorBits<8, 8, 8, 0>	},
4103c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "rgba4444",	colorBits<4, 4, 4, 4>	},
4113c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "rgba5551",	colorBits<5, 5, 5, 1>	},
4123c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "rgba8888",	colorBits<8, 8, 8, 8>	},
4133c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	};
4143c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
4153c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	static const struct
4163c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	{
4173c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		const char*			name;
4183c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLint				bits;
4193c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		eglu::ConfigFilter	filter;
4203c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	} s_surfaceRules[] =
4213c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	{
4223c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "window",		EGL_WINDOW_BIT,		surfaceType<EGL_WINDOW_BIT>		},
4233c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "pixmap",		EGL_PIXMAP_BIT,		surfaceType<EGL_PIXMAP_BIT>,	},
4243c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		{ "pbuffer",	EGL_PBUFFER_BIT,	surfaceType<EGL_PBUFFER_BIT>	}
4253c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	};
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4273c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	for (int colorNdx = 0; colorNdx < DE_LENGTH_OF_ARRAY(s_colorRules); colorNdx++)
4283c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	{
4293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		for (int surfaceNdx = 0; surfaceNdx < DE_LENGTH_OF_ARRAY(s_surfaceRules); surfaceNdx++)
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4313c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			const string		name	= string(s_colorRules[colorNdx].name) + "_" + s_surfaceRules[surfaceNdx].name;
4323c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			RenderFilterList	filters	(name.c_str(), "", s_surfaceRules[surfaceNdx].bits);
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4343c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			filters << baseFilters
4353c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos					<< s_colorRules[colorNdx].filter
436a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi					<< s_surfaceRules[surfaceNdx].filter
437a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi					<< isConformant;
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4393c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			filterLists.push_back(filters);
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4413c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	}
4423c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
4433c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	// Add other config ids to "other" set
4443c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	{
4453c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		RenderFilterList	filters	("other", "", EGL_WINDOW_BIT|EGL_PIXMAP_BIT|EGL_PBUFFER_BIT);
4463c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
4473c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		filters << baseFilters
4483c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				<< notColorBits<5, 6, 5, 0>
4493c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				<< notColorBits<8, 8, 8, 0>
4503c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				<< notColorBits<4, 4, 4, 4>
4513c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				<< notColorBits<5, 5, 5, 1>
452a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi				<< notColorBits<8, 8, 8, 8>
453a396e5b66bc656e29921fb16d105a9de1908c5c5Mika Isojärvi				<< isConformant;
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4553c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		filterLists.push_back(filters);
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
461