13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _EGLUPLATFORM_HPP 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _EGLUPLATFORM_HPP 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Tester Core 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ---------------------------------------- 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief EGL platform interface. 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "egluNativeDisplay.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluRenderContext.hpp" 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace tcu 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CommandLine; 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass FunctionLibrary; 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace eglu 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*! 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief EGL platform interface 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * EGL platform interface provides mechanism to implement platform-specific 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * bits of EGL API for use in EGL tests, or OpenGL (ES) context creation. 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * A single platform can support multiple native object types. This is 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * accomplished by registering multiple object factories. Command line 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * parameters (such as --deqp-egl-display-type=) are used to select 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * object types. 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See following classes for complete description of the porting layer: 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * * eglu::NativeDisplay, created by eglu::NativeDisplayFactory 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * * eglu::NativeWindow, created by eglu::NativeWindowFactory 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * * eglu::NativePixmap, created by eglu::NativePixmapFactory 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * If you implement EGL support, you may use it to enable GL support by 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * adding eglu::GLContextFactory to m_contextFactoryRegistry in your 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * glu::Platform implementation. 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * EGL platform implementation is required by EGL tests. OpenGL (ES) and 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * OpenCL tests can benefit from, but do not require EGL platform 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * implementation. 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass Platform 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic: 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry Platform (void); 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry // Code outside porting layer will never attempt to delete eglu::Platform 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual ~Platform (void); 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const NativeDisplayFactoryRegistry& getNativeDisplayFactoryRegistry (void) const { return m_nativeDisplayFactoryRegistry; } 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry /*--------------------------------------------------------------------*//*! 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Get fallback GL library 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * EGL tests use eglGetProcAddress() to load API entry points. However, 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * if the platform does not support EGL_KHR_get_all_proc_addresses extension, 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * core API entry points must be loaded using alternative method, namely 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * this default GL function library. 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may implement platform-specific way for loading GL entry points 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * by implementing this method. 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Default implementation provides entry points for ES2 and ES3 APIs 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * if binary is directly linked against GLES library. 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \param contextType GL context type 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \param cmdLine Reserved for future use 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry virtual tcu::FunctionLibrary* createDefaultGLFunctionLibrary (glu::ApiType apiType, const tcu::CommandLine& cmdLine) const; 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprotected: 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry /*--------------------------------------------------------------------*//*! 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Native display factory registry 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Native display factory registry holds list of eglu::NativeDisplayFactory 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * objects that can create eglu::NativeDisplay instances. You should 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * implement eglu::NativeDisplay and eglu::NativeDisplayFactory and add 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * instance of that factory implementation to this registry. 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * --deqp-egl-display-type command line argument is used to select the 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * display factory to use. If no type is given in command line, first entry 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * is used. 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry NativeDisplayFactoryRegistry m_nativeDisplayFactoryRegistry; 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry}; 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // eglu 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _EGLUPLATFORM_HPP 112