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 EGL Test Case 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "teglTestCase.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuPlatform.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluUtil.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluGLFunctionLoader.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluPlatform.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwInitFunctions.hpp" 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <set> 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::vector; 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing std::set; 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace egl 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid split (std::vector<std::string>& dst, const std::string& src) 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t start = 0; 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry size_t end = std::string::npos; 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry while ((end = src.find(' ', start)) != std::string::npos) 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry dst.push_back(src.substr(start, end-start)); 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry start = end+1; 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (start < end) 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry dst.push_back(src.substr(start, end-start)); 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 633c827367444ee418f129b2c238299f49d3264554Jarkko PoyryEGLint parseAPI (const std::string& api) 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (api == "OpenGL") 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return EGL_OPENGL_API; 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else if (api == "OpenGL_ES") 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return EGL_OPENGL_ES_API; 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else if (api == "OpenVG") 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return EGL_OPENVG_API; 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::print("Warning: Unknown API '%s'", api.c_str()); 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return 0; 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // anonymous 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 803c827367444ee418f129b2c238299f49d3264554Jarkko PoyryEglTestContext::EglTestContext (tcu::TestContext& testCtx, const eglu::NativeDisplayFactory& displayFactory, const eglu::NativeWindowFactory* windowFactory, const eglu::NativePixmapFactory* pixmapFactory) 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : m_testCtx (testCtx) 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_displayFactory (displayFactory) 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_windowFactory (windowFactory) 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_pixmapFactory (pixmapFactory) 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_defaultNativeDisplay (DE_NULL) 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_defaultEGLDisplay (DE_NULL) 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Temporarily allocate default display for storing config list 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry try 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLDisplay eglDisplay = EGL_NO_DISPLAY; 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLint majorVersion; 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLint minorVersion; 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultNativeDisplay = m_displayFactory.createDisplay(); 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry eglDisplay = eglu::getDisplay(*m_defaultNativeDisplay); 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TCU_CHECK_EGL_CALL(eglInitialize(eglDisplay, &majorVersion, &minorVersion)); 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay = new tcu::egl::Display(eglDisplay, majorVersion, minorVersion); 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Create config list 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry vector<EGLConfig> configs; 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry set<EGLint> idSet; // For checking for duplicate config IDs 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay->getConfigs(configs); 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_configs.resize(configs.size()); 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int ndx = 0; ndx < (int)configs.size(); ndx++) 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay->describeConfig(configs[ndx], m_configs[ndx]); 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLint id = m_configs[ndx].configId; 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (idSet.find(id) != idSet.end()) 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::print("Warning: Duplicate config ID %d\n", id); 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry idSet.insert(id); 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Query supported APIs 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const char* clientAPIs = eglQueryString(eglDisplay, EGL_CLIENT_APIS); 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<std::string> apis; 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TCU_CHECK(clientAPIs); 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry split(apis, clientAPIs); 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (std::vector<std::string>::const_iterator apiIter = apis.begin(); apiIter != apis.end(); apiIter++) 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLint parsedAPI = parseAPI(*apiIter); 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (parsedAPI != 0) 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_supportedAPIs.insert(parsedAPI); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultEGLDisplay; 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay = DE_NULL; 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultNativeDisplay; 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultNativeDisplay = DE_NULL; 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry catch (...) 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultEGLDisplay; 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay = DE_NULL; 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultNativeDisplay; 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultNativeDisplay = DE_NULL; 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw; 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1513c827367444ee418f129b2c238299f49d3264554Jarkko PoyryEglTestContext::~EglTestContext (void) 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (GLLibraryMap::iterator iter = m_glLibraries.begin(); iter != m_glLibraries.end(); ++iter) 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete iter->second; 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultEGLDisplay; 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultNativeDisplay; 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid EglTestContext::createDefaultDisplay (void) 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLDisplay eglDisplay = EGL_NO_DISPLAY; 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLint majorVersion; 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry EGLint minorVersion; 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(!m_defaultEGLDisplay); 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(!m_defaultNativeDisplay); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry try 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultNativeDisplay = m_displayFactory.createDisplay(); 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry eglDisplay = eglu::getDisplay(*m_defaultNativeDisplay); 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry TCU_CHECK_EGL_CALL(eglInitialize(eglDisplay, &majorVersion, &minorVersion)); 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay = new tcu::egl::Display(eglDisplay, majorVersion, minorVersion); 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry catch (const std::exception&) 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultEGLDisplay; 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay = DE_NULL; 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultNativeDisplay; 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultNativeDisplay = DE_NULL; 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw; 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst eglu::NativeWindowFactory& EglTestContext::getNativeWindowFactory (void) const 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_windowFactory) 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return *m_windowFactory; 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("No default native window factory available", "", __FILE__, __LINE__); 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst eglu::NativePixmapFactory& EglTestContext::getNativePixmapFactory (void) const 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (m_pixmapFactory) 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return *m_pixmapFactory; 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("No default native pixmap factory available", "", __FILE__, __LINE__); 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid EglTestContext::destroyDefaultDisplay (void) 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_defaultEGLDisplay); 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry DE_ASSERT(m_defaultNativeDisplay); 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultEGLDisplay; 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultEGLDisplay = DE_NULL; 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry delete m_defaultNativeDisplay; 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_defaultNativeDisplay = DE_NULL; 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyryeglu::NativeWindow* EglTestContext::createNativeWindow (EGLDisplay display, EGLConfig config, const EGLAttrib* attribList, int width, int height, eglu::WindowParams::Visibility visibility) 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_windowFactory) 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Windows not supported", "", __FILE__, __LINE__); 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return m_windowFactory->createWindow(m_defaultNativeDisplay, display, config, attribList, eglu::WindowParams(width, height, visibility)); 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyryeglu::NativePixmap* EglTestContext::createNativePixmap (EGLDisplay display, EGLConfig config, const EGLAttrib* attribList, int width, int height) 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (!m_pixmapFactory) 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry throw tcu::NotSupportedError("Pixmaps not supported", "", __FILE__, __LINE__); 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return m_pixmapFactory->createPixmap(m_defaultNativeDisplay, display, config, attribList, width, height); 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// \todo [2014-10-06 pyry] Quite hacky, expose ApiType internals? 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic deUint32 makeKey (glu::ApiType apiType) 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return (apiType.getMajorVersion() << 8) | (apiType.getMinorVersion() << 4) | apiType.getProfile(); 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyryconst tcu::FunctionLibrary* EglTestContext::getGLLibrary (glu::ApiType apiType) const 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry tcu::FunctionLibrary* library = DE_NULL; 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const deUint32 key = makeKey(apiType); 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLLibraryMap::iterator iter = m_glLibraries.find(key); 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (iter == m_glLibraries.end()) 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry library = m_testCtx.getPlatform().getEGLPlatform().createDefaultGLFunctionLibrary(apiType, m_testCtx.getCommandLine()); 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry m_glLibraries.insert(std::make_pair(key, library)); 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry else 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry library = iter->second; 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return library; 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2553c827367444ee418f129b2c238299f49d3264554Jarkko PoyrydeFunctionPtr EglTestContext::getGLFunction (glu::ApiType apiType, const char* name) const 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \todo [2014-03-11 pyry] This requires fall-back to eglGetProcAddress(), right? 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::FunctionLibrary* const library = getGLLibrary(apiType); 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return library->getFunction(name); 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid EglTestContext::getGLFunctions (glw::Functions& gl, glu::ApiType apiType) const 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const tcu::FunctionLibrary* const library = getGLLibrary(apiType); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const eglu::GLFunctionLoader loader (library); 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // \note There may not be current context, so we can't use initFunctions(). 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::initCoreFunctions(&gl, &loader, apiType); 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2713c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCaseGroup::TestCaseGroup (EglTestContext& eglTestCtx, const char* name, const char* description) 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : tcu::TestCaseGroup (eglTestCtx.getTestContext(), name, description) 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_eglTestCtx (eglTestCtx) 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2773c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCaseGroup::~TestCaseGroup (void) 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2813c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCase::TestCase (EglTestContext& eglTestCtx, const char* name, const char* description) 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : tcu::TestCase (eglTestCtx.getTestContext(), name, description) 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_eglTestCtx (eglTestCtx) 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2873c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCase::TestCase (EglTestContext& eglTestCtx, tcu::TestNodeType type, const char* name, const char* description) 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry : tcu::TestCase (eglTestCtx.getTestContext(), type, name, description) 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry , m_eglTestCtx (eglTestCtx) 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2933c827367444ee418f129b2c238299f49d3264554Jarkko PoyryTestCase::~TestCase (void) 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // egl 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 299