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 for mapping client color values to native surface colors
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglNativeColorMappingTests.hpp"
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglSimpleConfigCase.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTexture.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeDisplay.hpp"
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeWindow.hpp"
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativePixmap.hpp"
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUnique.hpp"
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUtil.hpp"
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwLibrary.hpp"
373c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos#include "eglwEnums.hpp"
383c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluDefs.hpp"
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwFunctions.hpp"
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp"
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuImageCompare.hpp"
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTestLog.hpp"
453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTexture.hpp"
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuTextureUtil.hpp"
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deUniquePtr.hpp"
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deStringUtil.hpp"
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deThread.hpp"
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string>
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <limits>
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog;
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector;
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::string;
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
613c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosusing namespace eglw;
623c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
703c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry HaulosEGLContext createGLES2Context (const Library& egl, EGLDisplay display, EGLConfig config)
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	EGLContext		context			= EGL_NO_CONTEXT;
733c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const EGLint	attribList[]	=
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_CONTEXT_CLIENT_VERSION, 2,
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		EGL_NONE
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
793c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	context = egl.createContext(display, config, EGL_NO_CONTEXT, attribList);
823c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	EGLU_CHECK_MSG(egl, "eglCreateContext() failed");
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	TCU_CHECK(context);
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return context;
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
883c827367444ee418f129b2c238299f49d3264554Jarkko PoyrydeUint32 createGLES2Program (const glw::Functions& gl, TestLog& log)
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char* const vertexShaderSource =
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"attribute highp vec2 a_pos;\n"
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"void main (void)\n"
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"{\n"
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"\tgl_Position = vec4(a_pos, 0.0, 1.0);\n"
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"}";
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char* const fragmentShaderSource =
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"uniform mediump vec4 u_color;\n"
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"void main (void)\n"
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"{\n"
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"\tgl_FragColor = u_color;\n"
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	"}";
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32	program			= 0;
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32	vertexShader	= 0;
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32	fragmentShader	= 0;
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32		vertexCompileStatus;
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string		vertexInfoLog;
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32		fragmentCompileStatus;
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string		fragmentInfoLog;
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deInt32		linkStatus;
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	string		programInfoLog;
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		program			= gl.createProgram();
1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		vertexShader	= gl.createShader(GL_VERTEX_SHADER);
1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		fragmentShader	= gl.createShader(GL_FRAGMENT_SHADER);
1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to create shaders and program");
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.shaderSource(vertexShader, 1, &vertexShaderSource, DE_NULL);
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.compileShader(vertexShader);
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup vertex shader");
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.shaderSource(fragmentShader, 1, &fragmentShaderSource, DE_NULL);
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.compileShader(fragmentShader);
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup fragment shader");
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deInt32		infoLogLength = 0;
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(vertexShader, GL_COMPILE_STATUS, &vertexCompileStatus);
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(vertexShader, GL_INFO_LOG_LENGTH, &infoLogLength);
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			vertexInfoLog.resize(infoLogLength, '\0');
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderInfoLog(vertexShader, (glw::GLsizei)vertexInfoLog.length(), &infoLogLength, &(vertexInfoLog[0]));
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to get vertex shader compile info");
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			vertexInfoLog.resize(infoLogLength);
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deInt32		infoLogLength = 0;
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(fragmentShader, GL_COMPILE_STATUS, &fragmentCompileStatus);
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderiv(fragmentShader, GL_INFO_LOG_LENGTH, &infoLogLength);
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			fragmentInfoLog.resize(infoLogLength, '\0');
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getShaderInfoLog(fragmentShader, (glw::GLsizei)fragmentInfoLog.length(), &infoLogLength, &(fragmentInfoLog[0]));
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to get fragment shader compile info");
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			fragmentInfoLog.resize(infoLogLength);
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.attachShader(program, vertexShader);
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.attachShader(program, fragmentShader);
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.linkProgram(program);
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup program");
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deInt32		infoLogLength = 0;
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getProgramiv(program, GL_LINK_STATUS, &linkStatus);
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength);
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			programInfoLog.resize(infoLogLength, '\0');
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.getProgramInfoLog(program, (glw::GLsizei)programInfoLog.length(), &infoLogLength, &(programInfoLog[0]));
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to get program link info");
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			programInfoLog.resize(infoLogLength);
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (linkStatus == 0 || vertexCompileStatus == 0 || fragmentCompileStatus == 0)
1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log.startShaderProgram(linkStatus != 0, programInfoLog.c_str());
1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Shader(QP_SHADER_TYPE_VERTEX, vertexShaderSource, vertexCompileStatus != 0, vertexInfoLog);
1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log << TestLog::Shader(QP_SHADER_TYPE_FRAGMENT, fragmentShaderSource, fragmentCompileStatus != 0, fragmentInfoLog);
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			log.endShaderProgram();
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteShader(vertexShader);
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		gl.deleteShader(fragmentShader);
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to delete shaders");
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TCU_CHECK(linkStatus != 0 && vertexCompileStatus != 0 && fragmentCompileStatus != 0);
1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (program)
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteProgram(program);
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (vertexShader)
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteShader(vertexShader);
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (fragmentShader)
2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteShader(fragmentShader);
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return program;
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid clear (const glw::Functions& gl, const tcu::Vec4& color)
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.clearColor(color.x(), color.y(), color.z(), color.w());
2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.clear(GL_COLOR_BUFFER_BIT);
2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "Color clear failed");
2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid render (const glw::Functions& gl, deUint32 program, const tcu::Vec4& color)
2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const float positions[] =
2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		-1.0f, -1.0f,
2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		 1.0f, -1.0f,
2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		 1.0f,  1.0f,
2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		 1.0f,  1.0f,
2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		-1.0f,  1.0f,
2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		-1.0f, -1.0f
2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32 posLocation;
2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32 colorLocation;
2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.useProgram(program);
2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	posLocation	= gl.getAttribLocation(program, "a_pos");
2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.enableVertexAttribArray(posLocation);
2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to setup shader program for rendering");
2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	colorLocation = gl.getUniformLocation(program, "u_color");
2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.uniform4fv(colorLocation, 1, color.getPtr());
2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.vertexAttribPointer(posLocation, 2, GL_FLOAT, GL_FALSE, 0, positions);
2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	gl.drawArrays(GL_TRIANGLES, 0, 6);
2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to render");
2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2483c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosbool validate (TestLog& log, const Library& egl, EGLDisplay display, EGLConfig config, const tcu::TextureLevel& result, const tcu::Vec4& color)
2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2503c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const tcu::UVec4 eglBitDepth((deUint32)eglu::getConfigAttribInt(egl, display, config, EGL_RED_SIZE),
2513c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos								 (deUint32)eglu::getConfigAttribInt(egl, display, config, EGL_GREEN_SIZE),
2523c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos								 (deUint32)eglu::getConfigAttribInt(egl, display, config, EGL_BLUE_SIZE),
2533c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos								 (deUint32)eglu::getConfigAttribInt(egl, display, config, EGL_ALPHA_SIZE));
2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::UVec4 nativeBitDepth(tcu::getTextureFormatBitDepth(result.getFormat()).asUint());
2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::UVec4 bitDepth(deMinu32(nativeBitDepth.x(), eglBitDepth.x()),
2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							  deMinu32(nativeBitDepth.y(), eglBitDepth.y()),
2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							  deMinu32(nativeBitDepth.z(), eglBitDepth.z()),
2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry							  deMinu32(nativeBitDepth.w(), eglBitDepth.w()));
2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
26135f4933c31a65a00084b6533e4a0deb098036d66Jarkko Pöyry	const tcu::UVec4 uColor = tcu::UVec4((deUint32)((float)((1u << bitDepth.x()) - 1u) * color.x()),
26235f4933c31a65a00084b6533e4a0deb098036d66Jarkko Pöyry										 (deUint32)((float)((1u << bitDepth.y()) - 1u) * color.y()),
26335f4933c31a65a00084b6533e4a0deb098036d66Jarkko Pöyry										 (deUint32)((float)((1u << bitDepth.z()) - 1u) * color.z()),
26435f4933c31a65a00084b6533e4a0deb098036d66Jarkko Pöyry										 (deUint32)((float)((1u << bitDepth.w()) - 1u) * color.w()));
2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel reference(result.getFormat(), result.getWidth(), result.getHeight());
2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	for (int y = 0; y < result.getHeight(); y++)
2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int x = 0; x < result.getWidth(); x++)
2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			reference.getAccess().setPixel(uColor, x, y);
2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return tcu::intThresholdCompare(log, "Result compare", "Compare results", reference.getAccess(), result.getAccess(), tcu::UVec4(1u, 1u, 1u, (bitDepth.w() > 0 ? 1u : std::numeric_limits<deUint32>::max())), tcu::COMPARE_LOG_RESULT);
2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass NativeColorMappingCase : public SimpleConfigCase
2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	enum NativeType
2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		NATIVETYPE_WINDOW = 0,
2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		NATIVETYPE_PIXMAP,
2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		NATIVETYPE_PBUFFER_COPY_TO_PIXMAP
2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2873c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos				NativeColorMappingCase	(EglTestContext& eglTestCtx, const char* name, const char* description, bool render, NativeType nativeType, const eglu::FilterList& filters);
2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				~NativeColorMappingCase	(void);
2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
2913c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	void		executeForConfig		(EGLDisplay display, EGLConfig config);
2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	NativeType	m_nativeType;
2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool		m_render;
2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2973c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry HaulosNativeColorMappingCase::NativeColorMappingCase (EglTestContext& eglTestCtx, const char* name, const char* description, bool render, NativeType nativeType, const eglu::FilterList& filters)
2983c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	: SimpleConfigCase	(eglTestCtx, name, description, filters)
2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_nativeType		(nativeType)
3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	, m_render			(render)
3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3043c827367444ee418f129b2c238299f49d3264554Jarkko PoyryNativeColorMappingCase::~NativeColorMappingCase	(void)
3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deinit();
3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3093c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid logConfigInfo (TestLog& log, const Library& egl, EGLDisplay display, EGLConfig config, NativeColorMappingCase::NativeType nativeType, int waitFrames)
3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3113c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	log << TestLog::Message << "EGL_RED_SIZE: "		<< eglu::getConfigAttribInt(egl, display, config, EGL_RED_SIZE)		<< TestLog::EndMessage;
3123c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	log << TestLog::Message << "EGL_GREEN_SIZE: "	<< eglu::getConfigAttribInt(egl, display, config, EGL_GREEN_SIZE)	<< TestLog::EndMessage;
3133c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	log << TestLog::Message << "EGL_BLUE_SIZE: "	<< eglu::getConfigAttribInt(egl, display, config, EGL_BLUE_SIZE)	<< TestLog::EndMessage;
3143c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	log << TestLog::Message << "EGL_ALPHA_SIZE: "	<< eglu::getConfigAttribInt(egl, display, config, EGL_ALPHA_SIZE)	<< TestLog::EndMessage;
3153c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	log << TestLog::Message << "EGL_DEPTH_SIZE: "	<< eglu::getConfigAttribInt(egl, display, config, EGL_DEPTH_SIZE)	<< TestLog::EndMessage;
3163c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	log << TestLog::Message << "EGL_STENCIL_SIZE: "	<< eglu::getConfigAttribInt(egl, display, config, EGL_STENCIL_SIZE)	<< TestLog::EndMessage;
3173c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	log << TestLog::Message << "EGL_SAMPLES: "		<< eglu::getConfigAttribInt(egl, display, config, EGL_SAMPLES)		<< TestLog::EndMessage;
3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	if (nativeType == NativeColorMappingCase::NATIVETYPE_WINDOW)
3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		log << TestLog::Message << "Waiting " << waitFrames * 16 << "ms after eglSwapBuffers() and glFinish() for frame to become visible" << TestLog::EndMessage;
3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool testNativeWindow (TestLog& log, eglu::NativeDisplay& nativeDisplay, eglu::NativeWindow& nativeWindow, EGLDisplay display, EGLContext context, EGLConfig config, const glw::Functions& gl, bool renderColor, int waitFrames, size_t colorCount, const tcu::Vec4* colors)
3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3253c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const Library&		egl			= nativeDisplay.getLibrary();
3263c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	eglu::UniqueSurface	surface		(egl, display, eglu::createWindowSurface(nativeDisplay, nativeWindow, display, config, DE_NULL));
3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel	result;
3283c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	deUint32			program		= 0;
3293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	bool				isOk		= true;
3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3333c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, *surface, *surface, context));
3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (renderColor)
3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			program = createGLES2Program(gl, log);
3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int colorNdx = 0; colorNdx < (int)colorCount; colorNdx++)
3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (renderColor)
3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				render(gl, program, colors[colorNdx]);
3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				clear(gl, colors[colorNdx]);
3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3453c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLU_CHECK_CALL(egl, swapBuffers(display, *surface));
3463c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLU_CHECK_CALL(egl, waitClient());
3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			deSleep(waitFrames*16);
3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			nativeWindow.readScreenPixels(&result);
3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3503c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			if (!validate(log, egl, display, config, result, colors[colorNdx]))
3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (program)
3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteProgram(program);
3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return isOk;
3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyrybool testNativePixmap (TestLog& log, eglu::NativeDisplay& nativeDisplay, eglu::NativePixmap& nativePixmap, EGLDisplay display, EGLContext context, EGLConfig config, const glw::Functions& gl, bool renderColor, size_t colorCount, const tcu::Vec4* colors)
3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
3683c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const Library&		egl			= nativeDisplay.getLibrary();
3693c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	eglu::UniqueSurface	surface		(egl, display, eglu::createPixmapSurface(nativeDisplay, nativePixmap, display, config, DE_NULL));
3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel	result;
3713c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	deUint32			program		= 0;
3723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	bool				isOk		= true;
3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, *surface, *surface, context));
3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (renderColor)
3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			program = createGLES2Program(gl, log);
3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int colorNdx = 0; colorNdx < (int)colorCount; colorNdx++)
3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (renderColor)
3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				render(gl, program, colors[colorNdx]);
3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				clear(gl, colors[colorNdx]);
3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3883c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLU_CHECK_CALL(egl, waitClient());
3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			nativePixmap.readPixels(&result);
3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3913c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			if (!validate(log, egl, display, config, result, colors[colorNdx]))
3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
3953c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (program)
4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteProgram(program);
4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return isOk;
4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4073c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosbool testNativePixmapCopy (TestLog& log, const Library& egl, eglu::NativePixmap& nativePixmap, EGLDisplay display, EGLContext context, EGLConfig config, const glw::Functions& gl, bool renderColor, size_t colorCount, const tcu::Vec4* colors)
4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4093c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	eglu::UniqueSurface	surface		(egl, display, egl.createPbufferSurface(display, config, DE_NULL));
4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	tcu::TextureLevel	result;
4113c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	deUint32			program		= 0;
4123c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	bool				isOk		= true;
4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	try
4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4163c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, *surface, *surface, context));
4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (renderColor)
4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			program = createGLES2Program(gl, log);
4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		for (int colorNdx = 0; colorNdx < (int)colorCount; colorNdx++)
4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			if (renderColor)
4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				render(gl, program, colors[colorNdx]);
4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			else
4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				clear(gl, colors[colorNdx]);
4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4283c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLU_CHECK_CALL(egl, copyBuffers(display, *surface, nativePixmap.getLegacyNative()));
4293c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			EGLU_CHECK_CALL(egl, waitClient());
4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			nativePixmap.readPixels(&result);
4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4323c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			if (!validate(log, egl, display, config, result, colors[colorNdx]))
4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				isOk = false;
4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		EGLU_CHECK_CALL(egl, makeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	catch (...)
4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		if (program)
4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			gl.deleteProgram(program);
4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		throw;
4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	return isOk;
4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4483c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosvoid NativeColorMappingCase::executeForConfig (EGLDisplay display, EGLConfig config)
4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int width		= 128;
4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const int height	= 128;
4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const tcu::Vec4 colors[] =
4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f),
4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f),
4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f),
4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 1.0f, 1.0f, 1.0f),
4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(1.0f, 0.0f, 0.0f, 1.0f),
4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(1.0f, 0.0f, 1.0f, 1.0f),
4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(1.0f, 1.0f, 0.0f, 1.0f),
4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(1.0f, 1.0f, 1.0f, 1.0f),
4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 0.0f, 0.0f, 1.0f),
4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 0.0f, 0.5f, 1.0f),
4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 0.5f, 0.0f, 1.0f),
4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.0f, 0.5f, 0.5f, 1.0f),
4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.5f, 0.0f, 0.0f, 1.0f),
4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.5f, 0.0f, 0.5f, 1.0f),
4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.5f, 0.5f, 0.0f, 1.0f),
4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		tcu::Vec4(0.5f, 0.5f, 0.5f, 1.0f)
4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	};
4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4743c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const Library&						egl				= m_eglTestCtx.getLibrary();
4753c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const string						configIdStr		(de::toString(eglu::getConfigAttribInt(egl, display, config, EGL_CONFIG_ID)));
4763c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	tcu::ScopedLogSection				logSection		(m_testCtx.getLog(), ("Config ID " + configIdStr).c_str(), ("Config ID " + configIdStr).c_str());
4773c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	const int							waitFrames		= 5;
478485844e764f2821545146b832726a36012f86238Mika Isojärvi	const eglu::NativeWindowFactory*	windowFactory;
479485844e764f2821545146b832726a36012f86238Mika Isojärvi	const eglu::NativePixmapFactory*	pixmapFactory;
4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
4813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	logConfigInfo(m_testCtx.getLog(), egl, display, config, m_nativeType, waitFrames);
4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
483485844e764f2821545146b832726a36012f86238Mika Isojärvi	try
484485844e764f2821545146b832726a36012f86238Mika Isojärvi	{
485485844e764f2821545146b832726a36012f86238Mika Isojärvi		windowFactory = &eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
486485844e764f2821545146b832726a36012f86238Mika Isojärvi
487485844e764f2821545146b832726a36012f86238Mika Isojärvi		if ((windowFactory->getCapabilities() & eglu::NativeWindow::CAPABILITY_READ_SCREEN_PIXELS) == 0)
488485844e764f2821545146b832726a36012f86238Mika Isojärvi			TCU_THROW(NotSupportedError, "Native window doesn't support readPixels()");
489485844e764f2821545146b832726a36012f86238Mika Isojärvi	}
490485844e764f2821545146b832726a36012f86238Mika Isojärvi	catch (const tcu::NotSupportedError&)
491485844e764f2821545146b832726a36012f86238Mika Isojärvi	{
492485844e764f2821545146b832726a36012f86238Mika Isojärvi		if (m_nativeType == NATIVETYPE_WINDOW)
493485844e764f2821545146b832726a36012f86238Mika Isojärvi			throw;
494485844e764f2821545146b832726a36012f86238Mika Isojärvi		else
495485844e764f2821545146b832726a36012f86238Mika Isojärvi			windowFactory = DE_NULL;
496485844e764f2821545146b832726a36012f86238Mika Isojärvi	}
497485844e764f2821545146b832726a36012f86238Mika Isojärvi
498485844e764f2821545146b832726a36012f86238Mika Isojärvi	try
499485844e764f2821545146b832726a36012f86238Mika Isojärvi	{
500485844e764f2821545146b832726a36012f86238Mika Isojärvi		pixmapFactory = &eglu::selectNativePixmapFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
501485844e764f2821545146b832726a36012f86238Mika Isojärvi
502485844e764f2821545146b832726a36012f86238Mika Isojärvi		if (m_nativeType == NATIVETYPE_PIXMAP)
503485844e764f2821545146b832726a36012f86238Mika Isojärvi		{
504485844e764f2821545146b832726a36012f86238Mika Isojärvi			if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0)
505485844e764f2821545146b832726a36012f86238Mika Isojärvi				TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels()");
506485844e764f2821545146b832726a36012f86238Mika Isojärvi		}
507485844e764f2821545146b832726a36012f86238Mika Isojärvi		else if (m_nativeType == NATIVETYPE_PBUFFER_COPY_TO_PIXMAP)
508485844e764f2821545146b832726a36012f86238Mika Isojärvi		{
509485844e764f2821545146b832726a36012f86238Mika Isojärvi			if ((pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_READ_PIXELS) == 0 ||
510485844e764f2821545146b832726a36012f86238Mika Isojärvi				(pixmapFactory->getCapabilities() & eglu::NativePixmap::CAPABILITY_CREATE_SURFACE_LEGACY) == 0)
511485844e764f2821545146b832726a36012f86238Mika Isojärvi				TCU_THROW(NotSupportedError, "Native pixmap doesn't support readPixels() or legacy create surface");
512485844e764f2821545146b832726a36012f86238Mika Isojärvi		}
513485844e764f2821545146b832726a36012f86238Mika Isojärvi	}
514485844e764f2821545146b832726a36012f86238Mika Isojärvi	catch (const tcu::NotSupportedError&)
515485844e764f2821545146b832726a36012f86238Mika Isojärvi	{
516485844e764f2821545146b832726a36012f86238Mika Isojärvi		if (m_nativeType == NATIVETYPE_PIXMAP || m_nativeType == NATIVETYPE_PBUFFER_COPY_TO_PIXMAP)
517485844e764f2821545146b832726a36012f86238Mika Isojärvi			throw;
518485844e764f2821545146b832726a36012f86238Mika Isojärvi		else
519485844e764f2821545146b832726a36012f86238Mika Isojärvi			pixmapFactory = DE_NULL;
520485844e764f2821545146b832726a36012f86238Mika Isojärvi	}
521485844e764f2821545146b832726a36012f86238Mika Isojärvi
522485844e764f2821545146b832726a36012f86238Mika Isojärvi	DE_ASSERT(m_nativeType != NATIVETYPE_WINDOW || windowFactory);
523485844e764f2821545146b832726a36012f86238Mika Isojärvi	DE_ASSERT((m_nativeType != NATIVETYPE_PIXMAP && m_nativeType != NATIVETYPE_PBUFFER_COPY_TO_PIXMAP) || pixmapFactory);
5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
525653ad0e8a4209754304cbd5b5ceb4fdc7b29c01aPyry Haulos	eglu::UniqueContext		context		(egl, display, createGLES2Context(egl, display, config));
5263c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	glw::Functions			gl;
5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5283c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	m_eglTestCtx.initGLFunctions(&gl, glu::ApiType::es(2,0));
5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	switch (m_nativeType)
5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case NATIVETYPE_WINDOW:
5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5343c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			de::UniquePtr<eglu::NativeWindow>	nativeWindow	(windowFactory->createWindow(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, eglu::WindowParams(width, height, eglu::WindowParams::VISIBILITY_VISIBLE)));
5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5363c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			if (!testNativeWindow(m_testCtx.getLog(), m_eglTestCtx.getNativeDisplay(), *nativeWindow, display, *context, config, gl, m_render, waitFrames, DE_LENGTH_OF_ARRAY(colors), colors))
5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid color rendered");
5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case NATIVETYPE_PIXMAP:
5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5433c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			de::UniquePtr<eglu::NativePixmap> nativePixmap		(pixmapFactory->createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5453c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			if (!testNativePixmap(m_testCtx.getLog(), m_eglTestCtx.getNativeDisplay(), *nativePixmap, display, *context, config, gl, m_render, DE_LENGTH_OF_ARRAY(colors), colors))
5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid color rendered");
5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case NATIVETYPE_PBUFFER_COPY_TO_PIXMAP:
5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		{
5523c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			de::UniquePtr<eglu::NativePixmap> nativePixmap		(pixmapFactory->createPixmap(&m_eglTestCtx.getNativeDisplay(), display, config, DE_NULL, width, height));
5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5543c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			if (!testNativePixmapCopy(m_testCtx.getLog(), egl, *nativePixmap, display, *context, config, gl, m_render, DE_LENGTH_OF_ARRAY(colors), colors))
5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry				m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid color rendered");
5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		}
5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(DE_FALSE);
5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5643c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulostemplate<deUint32 Type>
5653c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulosstatic bool surfaceType (const eglu::CandidateConfig& c)
5663c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos{
5673c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	return (c.surfaceType() & Type) == Type;
5683c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos}
5693c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos
5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid addTestGroups (EglTestContext& eglTestCtx, TestCaseGroup* group, NativeColorMappingCase::NativeType type)
5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
5723c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	eglu::FilterList baseFilters;
5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	switch (type)
5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case NativeColorMappingCase::NATIVETYPE_WINDOW:
5773c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			baseFilters << surfaceType<EGL_WINDOW_BIT>;
5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case NativeColorMappingCase::NATIVETYPE_PIXMAP:
5813c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			baseFilters << surfaceType<EGL_PIXMAP_BIT>;
5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		case NativeColorMappingCase::NATIVETYPE_PBUFFER_COPY_TO_PIXMAP:
5853c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos			baseFilters << surfaceType<EGL_PBUFFER_BIT>;
5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			break;
5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		default:
5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry			DE_ASSERT(DE_FALSE);
5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5923c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	vector<NamedFilterList> filterLists;
5933c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	getDefaultFilterLists(filterLists, baseFilters);
5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
5953c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos	for (vector<NamedFilterList>::iterator i = filterLists.begin(); i != filterLists.end(); i++)
5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
5973c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		group->addChild(new NativeColorMappingCase(eglTestCtx, (string(i->getName()) + "_clear").c_str(), i->getDescription(), false, type, *i));
5983c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4Pyry Haulos		group->addChild(new NativeColorMappingCase(eglTestCtx, (string(i->getName()) + "_render").c_str(), i->getDescription(), true, type, *i));
5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous
6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6043c827367444ee418f129b2c238299f49d3264554Jarkko PoyryNativeColorMappingTests::NativeColorMappingTests (EglTestContext& eglTestCtx)
6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	: TestCaseGroup(eglTestCtx, "native_color_mapping", "Tests for mapping client colors to native surface")
6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid NativeColorMappingTests::init (void)
6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestCaseGroup* windowGroup = new TestCaseGroup(m_eglTestCtx, "native_window", "Tests for mapping client color to native window");
6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addTestGroups(m_eglTestCtx, windowGroup, NativeColorMappingCase::NATIVETYPE_WINDOW);
6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(windowGroup);
6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestCaseGroup* pixmapGroup = new TestCaseGroup(m_eglTestCtx, "native_pixmap", "Tests for mapping client color to native pixmap");
6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addTestGroups(m_eglTestCtx, pixmapGroup, NativeColorMappingCase::NATIVETYPE_PIXMAP);
6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(pixmapGroup);
6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	{
6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		TestCaseGroup* pbufferGroup = new TestCaseGroup(m_eglTestCtx, "pbuffer_to_native_pixmap", "Tests for mapping client color to native pixmap with eglCopyBuffers()");
6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addTestGroups(m_eglTestCtx, pbufferGroup, NativeColorMappingCase::NATIVETYPE_PBUFFER_COPY_TO_PIXMAP);
6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry		addChild(pbufferGroup);
6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	}
6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}
6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl
6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp
632