xref: /aosp_15_r20/external/deqp/framework/egl/egluPlatform.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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 } // namespace tcu
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 
getNativeDisplayFactoryRegistry(void) const71     const NativeDisplayFactoryRegistry &getNativeDisplayFactoryRegistry(void) const
72     {
73         return m_nativeDisplayFactoryRegistry;
74     }
75 
76     /*--------------------------------------------------------------------*//*!
77      * \brief Get fallback GL library
78      *
79      * EGL tests use eglGetProcAddress() to load API entry points. However,
80      * if the platform does not support EGL_KHR_get_all_proc_addresses extension,
81      * core API entry points must be loaded using alternative method, namely
82      * this default GL function library.
83      *
84      * You may implement platform-specific way for loading GL entry points
85      * by implementing this method.
86      *
87      * Default implementation provides entry points for ES2 and ES3 APIs
88      * if binary is directly linked against GLES library.
89      *
90      * \param contextType    GL context type
91      * \param cmdLine        Reserved for future use
92      *//*--------------------------------------------------------------------*/
93     virtual tcu::FunctionLibrary *createDefaultGLFunctionLibrary(glu::ApiType apiType,
94                                                                  const tcu::CommandLine &cmdLine) const;
95 
96 protected:
97     /*--------------------------------------------------------------------*//*!
98      * \brief Native display factory registry
99      *
100      * Native display factory registry holds list of eglu::NativeDisplayFactory
101      * objects that can create eglu::NativeDisplay instances. You should
102      * implement eglu::NativeDisplay and eglu::NativeDisplayFactory and add
103      * instance of that factory implementation to this registry.
104      *
105      * --deqp-egl-display-type command line argument is used to select the
106      * display factory to use. If no type is given in command line, first entry
107      * is used.
108      *//*--------------------------------------------------------------------*/
109     NativeDisplayFactoryRegistry m_nativeDisplayFactoryRegistry;
110 };
111 
112 } // namespace eglu
113 
114 #endif // _EGLUPLATFORM_HPP
115