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