b70773a91144755fdefd5add5e70ac38cb08c7b1
[iec.git] / src / type3_AndroidCloud / anbox-master / external / android-emugl / host / include / OpenGLESDispatch / EGLDispatch.h
1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #pragma once
17
18 #include "OpenGLESDispatch/RenderEGL_functions.h"
19 #include "OpenGLESDispatch/RenderEGL_extensions_functions.h"
20
21 // This header is used to define the EGLDispatch structure that contains
22 // pointers to the EGL shared library used by libOpenglRender. Normally,
23 // this will be our own libEGL_translator, but one could imagine a
24 // vendor-specific being used instead.
25
26 // There is a single global instance of this structure, named |s_egl|,
27 // which must be initialized by calling init_egl_dispatch() before use.
28
29 // Note that our code requires the implementation of misc EGL extensions
30 // including eglSetSwapRectangleANDROID(), see RenderEGL_extensions_functions.h
31 // for a full list.
32
33 #define RENDER_EGL_DEFINE_TYPE(return_type, function_name, signature) \
34     typedef return_type (EGLAPIENTRY *function_name ## _t) signature;
35
36 #define RENDER_EGL_DECLARE_MEMBER(return_type, function_name, signature) \
37     function_name ## _t function_name;
38
39 // Define function typedefs.
40 LIST_RENDER_EGL_FUNCTIONS(RENDER_EGL_DEFINE_TYPE)
41 LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(RENDER_EGL_DEFINE_TYPE)
42
43 // Define EGLDispatch structure.
44 struct EGLDispatch {
45     bool initialized = false;
46     LIST_RENDER_EGL_FUNCTIONS(RENDER_EGL_DECLARE_MEMBER)
47     LIST_RENDER_EGL_EXTENSIONS_FUNCTIONS(RENDER_EGL_DECLARE_MEMBER)
48 };
49
50 // Initialize EGLDispatch function. Return true on success, false on failure.
51 bool init_egl_dispatch(const char *path);
52
53 // Global EGLDispatch instance. Call init_egl_dispatch() before using it.
54 extern EGLDispatch s_egl;