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 Test eglSwapBuffers() interaction with native window.
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSwapBuffersTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSimpleConfigCase.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeWindow.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUtil.hpp"
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUnique.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDefs.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuSurface.hpp"
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTexture.hpp"
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTextureUtil.hpp"
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuImageCompare.hpp"
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVector.hpp"
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuVectorUtil.hpp"
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deUniquePtr.hpp"
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deThread.hpp"
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string>
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <sstream>
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog;
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector;
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
643c827367444ee418f129b2c238299f49d3264554Jarkko PoyryEGLContext createGLES2Context (EGLDisplay display, EGLConfig config)
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLContext		context = EGL_NO_CONTEXT;
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const EGLint	attribList[] =
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_CONTEXT_CLIENT_VERSION, 2,
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_NONE
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK_EGL_CALL(eglBindAPI(EGL_OPENGL_ES_API));
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	context = eglCreateContext(display, config, EGL_NO_CONTEXT, attribList);
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK_EGL_MSG("eglCreateContext() failed");
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK(context);
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return context;
813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass SwapBuffersTest : public SimpleConfigCase
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						SwapBuffersTest		(EglTestContext& eglTestCtx, const char* name, const char* description, const vector<EGLint>& configIds);
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						~SwapBuffersTest	(void);
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void				executeForConfig	(tcu::egl::Display& display, EGLConfig config);
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	// Not allowed
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry						SwapBuffersTest		(const SwapBuffersTest&);
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SwapBuffersTest&	operator=			(const SwapBuffersTest&);
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
983c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySwapBuffersTest::SwapBuffersTest (EglTestContext& eglTestCtx, const char* name, const char* description, const vector<EGLint>& configIds)
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: SimpleConfigCase			(eglTestCtx, name, description, configIds)
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1033c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySwapBuffersTest::~SwapBuffersTest (void)
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystring getConfigIdString (EGLDisplay display, EGLConfig config)
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	std::ostringstream	stream;
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	EGLint				id;
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK_EGL_CALL(eglGetConfigAttrib(display, config , EGL_CONFIG_ID, &id));
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	stream << id;
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return stream.str();
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1193c827367444ee418f129b2c238299f49d3264554Jarkko PoyrydeUint32 createGLES2Program (const glw::Functions& gl, TestLog& log)
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char* const vertexShaderSource =
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"attribute highp vec2 a_pos;\n"
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"void main (void)\n"
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"{\n"
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"}";
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char* const fragmentShaderSource =
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"void main (void)\n"
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"{\n"
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"\tgl_FragColor = vec4(0.9, 0.1, 0.4, 1.0);\n"
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"}";
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32	program			= 0;
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32	vertexShader	= 0;
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32	fragmentShader	= 0;
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32		vertexCompileStatus;
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string		vertexInfoLog;
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32		fragmentCompileStatus;
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string		fragmentInfoLog;
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32		linkStatus;
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string		programInfoLog;
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		program			= gl.createProgram();
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		vertexShader	= gl.createShader(GL_VERTEX_SHADER);
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		fragmentShader	= gl.createShader(GL_FRAGMENT_SHADER);
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to create shaders and program");
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.shaderSource(vertexShader, 1, &vertexShaderSource, DE_NULL);
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.compileShader(vertexShader);
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup vertex shader");
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.shaderSource(fragmentShader, 1, &fragmentShaderSource, DE_NULL);
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.compileShader(fragmentShader);
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup fragment shader");
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deInt32		infoLogLength = 0;
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(vertexShader, GL_COMPILE_STATUS, &vertexCompileStatus);
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &infoLogLength);
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			vertexInfoLog.resize(infoLogLength, '\0');
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderInfoLog(vertexShader, (glw::GLsizei)vertexInfoLog.length(), &infoLogLength, &(vertexInfoLog[0]));
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to get vertex shader compile info");
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			vertexInfoLog.resize(infoLogLength);
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deInt32		infoLogLength = 0;
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(fragmentShader, GL_COMPILE_STATUS, &fragmentCompileStatus);
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &infoLogLength);
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			fragmentInfoLog.resize(infoLogLength, '\0');
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderInfoLog(fragmentShader, (glw::GLsizei)fragmentInfoLog.length(), &infoLogLength, &(fragmentInfoLog[0]));
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to get fragment shader compile info");
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			fragmentInfoLog.resize(infoLogLength);
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.attachShader(program, vertexShader);
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.attachShader(program, fragmentShader);
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.linkProgram(program);
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup program");
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deInt32		infoLogLength = 0;
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getProgramiv(program, GL_LINK_STATUS, &linkStatus);
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength);
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			programInfoLog.resize(infoLogLength, '\0');
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getProgramInfoLog(program, (glw::GLsizei)programInfoLog.length(), &infoLogLength, &(programInfoLog[0]));
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to get program link info");
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			programInfoLog.resize(infoLogLength);
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (linkStatus == 0 || vertexCompileStatus == 0 || fragmentCompileStatus == 0)
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log.startShaderProgram(linkStatus != 0, programInfoLog.c_str());
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Shader(QP_SHADER_TYPE_VERTEX, vertexShaderSource, vertexCompileStatus != 0, vertexInfoLog);
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Shader(QP_SHADER_TYPE_FRAGMENT, fragmentShaderSource, fragmentCompileStatus != 0, fragmentInfoLog);
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log.endShaderProgram();
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteShader(vertexShader);
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteShader(fragmentShader);
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to delete shaders");
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK(linkStatus != 0 && vertexCompileStatus != 0 && fragmentCompileStatus != 0);
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (program)
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteProgram(program);
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (vertexShader)
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteShader(vertexShader);
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (fragmentShader)
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteShader(fragmentShader);
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return program;
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool checkColor (tcu::TestLog& log, const tcu::TextureLevel& screen, const tcu::Vec4& color)
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::Vec4 threshold(0.01f, 0.01f, 0.01f, 1.00f);
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int y = 0; y < screen.getHeight(); y++)
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int x = 0; x < screen.getWidth(); x++)
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const tcu::Vec4	pixel(screen.getAccess().getPixel(x, y));
2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			const tcu::Vec4	diff(abs(pixel - color));
2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (!boolAll(lessThanEqual(diff, threshold)))
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			{
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				log << TestLog::Message << "Unexpected color values read from screen expected: " << color << TestLog::EndMessage;
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				log << TestLog::Image("Screen", "Screen", screen.getAccess());
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				return false;
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			}
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return true;
2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SwapBuffersTest::executeForConfig (tcu::egl::Display& display, EGLConfig config)
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const string			configIdStr	(getConfigIdString(display.getEGLDisplay(), config));
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::ScopedLogSection	logSection	(m_testCtx.getLog(), ("Config ID " + configIdStr).c_str(), ("Config ID " + configIdStr).c_str());
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int				waitFrames	= 5;
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestLog& log = m_testCtx.getLog();
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "EGL_RED_SIZE: " << eglu::getConfigAttribInt(display.getEGLDisplay(), config, EGL_RED_SIZE) << TestLog::EndMessage;
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "EGL_GREEN_SIZE: " << eglu::getConfigAttribInt(display.getEGLDisplay(), config, EGL_GREEN_SIZE) << TestLog::EndMessage;
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "EGL_BLUE_SIZE: " << eglu::getConfigAttribInt(display.getEGLDisplay(), config, EGL_BLUE_SIZE) << TestLog::EndMessage;
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "EGL_ALPHA_SIZE: " << eglu::getConfigAttribInt(display.getEGLDisplay(), config, EGL_ALPHA_SIZE) << TestLog::EndMessage;
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "EGL_DEPTH_SIZE: " << eglu::getConfigAttribInt(display.getEGLDisplay(), config, EGL_DEPTH_SIZE) << TestLog::EndMessage;
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "EGL_STENCIL_SIZE: " << eglu::getConfigAttribInt(display.getEGLDisplay(), config, EGL_STENCIL_SIZE) << TestLog::EndMessage;
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "EGL_SAMPLES: " << eglu::getConfigAttribInt(display.getEGLDisplay(), config, EGL_SAMPLES) << TestLog::EndMessage;
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Waiting " << waitFrames * 16 << "ms after eglSwapBuffers() and glFinish() for frame to become visible" << TestLog::EndMessage;
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if ((m_eglTestCtx.getNativeWindowFactory().getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw tcu::NotSupportedError("eglu::NativeWindow doesn't support readScreenPixels()", "", __FILE__, __LINE__);
2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	de::UniquePtr<eglu::NativeWindow>	window	(m_eglTestCtx.createNativeWindow(m_eglTestCtx.getDisplay().getEGLDisplay(), config, DE_NULL, 128, 128, eglu::WindowParams::VISIBILITY_VISIBLE));
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglu::UniqueSurface					surface	(display.getEGLDisplay(), eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *window, display.getEGLDisplay(), config, DE_NULL));
2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglu::UniqueContext					context	(display.getEGLDisplay(), createGLES2Context(display.getEGLDisplay(), config));
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	glw::Functions						gl;
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32							program = 0;
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel					whiteFrame;
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel					blackFrame;
2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel					frameBegin;
2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel					frameEnd;
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	m_eglTestCtx.getGLFunctions(gl, glu::ApiType::es(2,0));
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK_EGL_CALL(eglMakeCurrent(display.getEGLDisplay(), *surface, *surface, *context));
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const float positions1[] = {
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.00f,  0.00f,
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.75f,  0.00f,
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.75f,  0.75f,
3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.75f,  0.75f,
3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.00f,  0.75f,
3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.00f,  0.00f
3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		const float positions2[] = {
3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			-0.75f, -0.75f,
3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.00f, -0.75f,
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.00f,  0.00f,
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			 0.00f,  0.00f,
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			-0.75f,  0.00f,
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			-0.75f, -0.75f
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		};
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deUint32 posLocation;
3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		program	= createGLES2Program(gl, m_testCtx.getLog());
3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.useProgram(program);
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		posLocation	= gl.getAttribLocation(program, "a_pos");
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.enableVertexAttribArray(posLocation);
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup shader program for rendering");
3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Clear screen to white and check that sceen is white
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clear(GL_COLOR_BUFFER_BIT);
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to clear surface");
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_CALL(eglSwapBuffers(display.getEGLDisplay(), *surface));
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.finish();
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glFinish() failed");
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deSleep(waitFrames * 16);
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->processEvents();
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->readScreenPixels(&whiteFrame);
3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!checkColor(m_testCtx.getLog(), whiteFrame, tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f)))
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Couldn't reliably read pixels from screen");
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return;
3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		// Clear screen to black and check that sceen is black
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clear(GL_COLOR_BUFFER_BIT);
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to clear surface");
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_CALL(eglSwapBuffers(display.getEGLDisplay(), *surface));
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.finish();
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glFinish() failed");
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deSleep(waitFrames * 16);
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->processEvents();
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->readScreenPixels(&blackFrame);
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!checkColor(m_testCtx.getLog(), blackFrame, tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f)))
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Couldn't reliably read pixels from screen");
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			return;
3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clearColor(0.7f, 1.0f, 0.3f, 1.0f);
3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clear(GL_COLOR_BUFFER_BIT);
3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to clear surface");
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.vertexAttribPointer(posLocation, 2, GL_FLOAT, GL_FALSE, 0, positions1);
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.drawArrays(GL_TRIANGLES, 0, 6);
3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to render");
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_CALL(eglSwapBuffers(display.getEGLDisplay(), *surface));
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.finish();
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glFinish() failed");
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deSleep(waitFrames * 16);
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->processEvents();
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->readScreenPixels(&frameBegin);
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clearColor(0.7f, 0.7f, 1.0f, 1.0f);
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.clear(GL_COLOR_BUFFER_BIT);
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to clear surface");
3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.vertexAttribPointer(posLocation, 2, GL_FLOAT, GL_FALSE, 0, positions2);
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.drawArrays(GL_TRIANGLES, 0, 6);
3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to render");
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.finish();
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glFinish() failed");
3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deSleep(waitFrames * 16);
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->readScreenPixels(&frameEnd);
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_CALL(eglSwapBuffers(display.getEGLDisplay(), *surface));
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.finish();
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glFinish() failed");
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		deSleep(waitFrames * 16);
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		window->processEvents();
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.disableVertexAttribArray(posLocation);
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.useProgram(0);
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to release program state");
4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteProgram(program);
4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		program = 0;
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "glDeleteProgram()");
4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (!tcu::intThresholdCompare(m_testCtx.getLog(), "Compare end of frame against beginning of frame" , "Compare end of frame against beginning of frame", frameBegin.getAccess(), frameEnd.getAccess(), tcu::UVec4(0, 0, 0, 0), tcu::COMPARE_LOG_RESULT))
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Screen pixels changed during frame");
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (program != 0)
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteProgram(program);
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK_EGL_CALL(eglMakeCurrent(display.getEGLDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK_EGL_CALL(eglMakeCurrent(display.getEGLDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4293c827367444ee418f129b2c238299f49d3264554Jarkko PoyrySwapBuffersTests::SwapBuffersTests (EglTestContext& eglTestCtx)
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(eglTestCtx, "swap_buffers", "Swap buffers tests")
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid SwapBuffersTests::init (void)
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	eglu::FilterList filters;
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	filters << (eglu::ConfigSurfaceType() & EGL_WINDOW_BIT);
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	vector<NamedConfigIdSet> configIdSets;
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	NamedConfigIdSet::getDefaultSets(configIdSets, m_eglTestCtx.getConfigs(), filters);
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (vector<NamedConfigIdSet>::iterator i = configIdSets.begin(); i != configIdSets.end(); i++)
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(new SwapBuffersTest(m_eglTestCtx, i->getName(), i->getDescription(), i->getConfigIds()));
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
448