1*35238bceSAndroid Build Coastguard Worker #ifndef _EGLUPLATFORM_HPP 2*35238bceSAndroid Build Coastguard Worker #define _EGLUPLATFORM_HPP 3*35238bceSAndroid Build Coastguard Worker /*------------------------------------------------------------------------- 4*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program Tester Core 5*35238bceSAndroid Build Coastguard Worker * ---------------------------------------- 6*35238bceSAndroid Build Coastguard Worker * 7*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project 8*35238bceSAndroid Build Coastguard Worker * 9*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 10*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 11*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at 12*35238bceSAndroid Build Coastguard Worker * 13*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 14*35238bceSAndroid Build Coastguard Worker * 15*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 16*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 17*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 19*35238bceSAndroid Build Coastguard Worker * limitations under the License. 20*35238bceSAndroid Build Coastguard Worker * 21*35238bceSAndroid Build Coastguard Worker *//*! 22*35238bceSAndroid Build Coastguard Worker * \file 23*35238bceSAndroid Build Coastguard Worker * \brief EGL platform interface. 24*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 25*35238bceSAndroid Build Coastguard Worker 26*35238bceSAndroid Build Coastguard Worker #include "tcuDefs.hpp" 27*35238bceSAndroid Build Coastguard Worker #include "egluNativeDisplay.hpp" 28*35238bceSAndroid Build Coastguard Worker #include "gluRenderContext.hpp" 29*35238bceSAndroid Build Coastguard Worker 30*35238bceSAndroid Build Coastguard Worker namespace tcu 31*35238bceSAndroid Build Coastguard Worker { 32*35238bceSAndroid Build Coastguard Worker class CommandLine; 33*35238bceSAndroid Build Coastguard Worker class FunctionLibrary; 34*35238bceSAndroid Build Coastguard Worker } // namespace tcu 35*35238bceSAndroid Build Coastguard Worker 36*35238bceSAndroid Build Coastguard Worker namespace eglu 37*35238bceSAndroid Build Coastguard Worker { 38*35238bceSAndroid Build Coastguard Worker 39*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*! 40*35238bceSAndroid Build Coastguard Worker * \brief EGL platform interface 41*35238bceSAndroid Build Coastguard Worker * 42*35238bceSAndroid Build Coastguard Worker * EGL platform interface provides mechanism to implement platform-specific 43*35238bceSAndroid Build Coastguard Worker * bits of EGL API for use in EGL tests, or OpenGL (ES) context creation. 44*35238bceSAndroid Build Coastguard Worker * 45*35238bceSAndroid Build Coastguard Worker * A single platform can support multiple native object types. This is 46*35238bceSAndroid Build Coastguard Worker * accomplished by registering multiple object factories. Command line 47*35238bceSAndroid Build Coastguard Worker * parameters (such as --deqp-egl-display-type=) are used to select 48*35238bceSAndroid Build Coastguard Worker * object types. 49*35238bceSAndroid Build Coastguard Worker * 50*35238bceSAndroid Build Coastguard Worker * See following classes for complete description of the porting layer: 51*35238bceSAndroid Build Coastguard Worker * 52*35238bceSAndroid Build Coastguard Worker * * eglu::NativeDisplay, created by eglu::NativeDisplayFactory 53*35238bceSAndroid Build Coastguard Worker * * eglu::NativeWindow, created by eglu::NativeWindowFactory 54*35238bceSAndroid Build Coastguard Worker * * eglu::NativePixmap, created by eglu::NativePixmapFactory 55*35238bceSAndroid Build Coastguard Worker * 56*35238bceSAndroid Build Coastguard Worker * If you implement EGL support, you may use it to enable GL support by 57*35238bceSAndroid Build Coastguard Worker * adding eglu::GLContextFactory to m_contextFactoryRegistry in your 58*35238bceSAndroid Build Coastguard Worker * glu::Platform implementation. 59*35238bceSAndroid Build Coastguard Worker * 60*35238bceSAndroid Build Coastguard Worker * EGL platform implementation is required by EGL tests. OpenGL (ES) and 61*35238bceSAndroid Build Coastguard Worker * OpenCL tests can benefit from, but do not require EGL platform 62*35238bceSAndroid Build Coastguard Worker * implementation. 63*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 64*35238bceSAndroid Build Coastguard Worker class Platform 65*35238bceSAndroid Build Coastguard Worker { 66*35238bceSAndroid Build Coastguard Worker public: 67*35238bceSAndroid Build Coastguard Worker Platform(void); 68*35238bceSAndroid Build Coastguard Worker // Code outside porting layer will never attempt to delete eglu::Platform 69*35238bceSAndroid Build Coastguard Worker virtual ~Platform(void); 70*35238bceSAndroid Build Coastguard Worker getNativeDisplayFactoryRegistry(void) const71*35238bceSAndroid Build Coastguard Worker const NativeDisplayFactoryRegistry &getNativeDisplayFactoryRegistry(void) const 72*35238bceSAndroid Build Coastguard Worker { 73*35238bceSAndroid Build Coastguard Worker return m_nativeDisplayFactoryRegistry; 74*35238bceSAndroid Build Coastguard Worker } 75*35238bceSAndroid Build Coastguard Worker 76*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*! 77*35238bceSAndroid Build Coastguard Worker * \brief Get fallback GL library 78*35238bceSAndroid Build Coastguard Worker * 79*35238bceSAndroid Build Coastguard Worker * EGL tests use eglGetProcAddress() to load API entry points. However, 80*35238bceSAndroid Build Coastguard Worker * if the platform does not support EGL_KHR_get_all_proc_addresses extension, 81*35238bceSAndroid Build Coastguard Worker * core API entry points must be loaded using alternative method, namely 82*35238bceSAndroid Build Coastguard Worker * this default GL function library. 83*35238bceSAndroid Build Coastguard Worker * 84*35238bceSAndroid Build Coastguard Worker * You may implement platform-specific way for loading GL entry points 85*35238bceSAndroid Build Coastguard Worker * by implementing this method. 86*35238bceSAndroid Build Coastguard Worker * 87*35238bceSAndroid Build Coastguard Worker * Default implementation provides entry points for ES2 and ES3 APIs 88*35238bceSAndroid Build Coastguard Worker * if binary is directly linked against GLES library. 89*35238bceSAndroid Build Coastguard Worker * 90*35238bceSAndroid Build Coastguard Worker * \param contextType GL context type 91*35238bceSAndroid Build Coastguard Worker * \param cmdLine Reserved for future use 92*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 93*35238bceSAndroid Build Coastguard Worker virtual tcu::FunctionLibrary *createDefaultGLFunctionLibrary(glu::ApiType apiType, 94*35238bceSAndroid Build Coastguard Worker const tcu::CommandLine &cmdLine) const; 95*35238bceSAndroid Build Coastguard Worker 96*35238bceSAndroid Build Coastguard Worker protected: 97*35238bceSAndroid Build Coastguard Worker /*--------------------------------------------------------------------*//*! 98*35238bceSAndroid Build Coastguard Worker * \brief Native display factory registry 99*35238bceSAndroid Build Coastguard Worker * 100*35238bceSAndroid Build Coastguard Worker * Native display factory registry holds list of eglu::NativeDisplayFactory 101*35238bceSAndroid Build Coastguard Worker * objects that can create eglu::NativeDisplay instances. You should 102*35238bceSAndroid Build Coastguard Worker * implement eglu::NativeDisplay and eglu::NativeDisplayFactory and add 103*35238bceSAndroid Build Coastguard Worker * instance of that factory implementation to this registry. 104*35238bceSAndroid Build Coastguard Worker * 105*35238bceSAndroid Build Coastguard Worker * --deqp-egl-display-type command line argument is used to select the 106*35238bceSAndroid Build Coastguard Worker * display factory to use. If no type is given in command line, first entry 107*35238bceSAndroid Build Coastguard Worker * is used. 108*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/ 109*35238bceSAndroid Build Coastguard Worker NativeDisplayFactoryRegistry m_nativeDisplayFactoryRegistry; 110*35238bceSAndroid Build Coastguard Worker }; 111*35238bceSAndroid Build Coastguard Worker 112*35238bceSAndroid Build Coastguard Worker } // namespace eglu 113*35238bceSAndroid Build Coastguard Worker 114*35238bceSAndroid Build Coastguard Worker #endif // _EGLUPLATFORM_HPP 115