blob: 3bd37cb39906b2698033515441371984a23bd5b3 [file] [log] [blame]
Mathias Agopian1cadb252011-05-23 17:26:14 -07001/*
2 ** Copyright 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
17#ifndef ANDROID_EGLDEFS_H
18#define ANDROID_EGLDEFS_H
19
Yiwei Zhang8af03062020-08-12 21:28:15 -070020#include <log/log.h>
21
Mathias Agopian39c24a22013-04-04 23:17:56 -070022#include "../hooks.h"
Cody Northrop9d5d33d2018-10-15 18:32:14 -060023#include "egl_platform_entries.h"
24
Mathias Agopian7773c432012-02-13 20:06:08 -080025#define VERSION_MAJOR 1
26#define VERSION_MINOR 4
Courtney Goeltzenleuchter015ed672018-07-27 13:43:23 -060027#define EGL_MAKE_VERSION(major, minor, patch) (((major) << 22) | ((minor) << 12) | (patch))
Mathias Agopian7773c432012-02-13 20:06:08 -080028
Mathias Agopian1cadb252011-05-23 17:26:14 -070029namespace android {
Mathias Agopian1cadb252011-05-23 17:26:14 -070030
Yiwei Zhang8af03062020-08-12 21:28:15 -070031// EGLDisplay are global, not attached to a given thread
Mathias Agopian1cadb252011-05-23 17:26:14 -070032const unsigned int NUM_DISPLAYS = 1;
33
Yiwei Zhang8af03062020-08-12 21:28:15 -070034extern const char* const platform_names[];
Mathias Agopian1cadb252011-05-23 17:26:14 -070035
Mathias Agopian7773c432012-02-13 20:06:08 -080036struct egl_connection_t {
Yiwei Zhang8af03062020-08-12 21:28:15 -070037 enum { GLESv1_INDEX = 0, GLESv2_INDEX = 1 };
Mathias Agopian7773c432012-02-13 20:06:08 -080038
Yiwei Zhang8af03062020-08-12 21:28:15 -070039 inline egl_connection_t()
40 : dso(nullptr),
41 libEgl(nullptr),
42 libGles1(nullptr),
43 libGles2(nullptr),
Peiyong Lin2f51e752023-06-15 22:35:14 +000044 systemDriverUnloaded(false),
45 angleLoaded(false) {
Yiwei Zhang8af03062020-08-12 21:28:15 -070046 const char* const* entries = platform_names;
Cody Northrop9d5d33d2018-10-15 18:32:14 -060047 EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&platform);
48 while (*entries) {
49 const char* name = *entries;
50 EGLFuncPointer f = FindPlatformImplAddr(name);
51
52 if (f == nullptr) {
53 // If no entry found, update the lookup table: sPlatformImplMap
54 ALOGE("No entry found in platform lookup table for %s", name);
55 }
56
57 *curr++ = f;
58 entries++;
59 }
60 }
Cody Northrop68d10352018-10-15 07:22:09 -060061
Yiwei Zhang8af03062020-08-12 21:28:15 -070062 void* dso;
63 gl_hooks_t* hooks[2];
64 EGLint major;
65 EGLint minor;
66 EGLint driverVersion;
67 egl_t egl;
Jesse Hallc07b5202013-07-04 12:08:16 -070068
Cody Northrop68d10352018-10-15 07:22:09 -060069 // Functions implemented or redirected by platform libraries
Yiwei Zhang8af03062020-08-12 21:28:15 -070070 platform_impl_t platform;
Cody Northrop68d10352018-10-15 07:22:09 -060071
Yiwei Zhang8af03062020-08-12 21:28:15 -070072 void* libEgl;
73 void* libGles1;
74 void* libGles2;
Cody Northrop1f00e172018-04-02 11:23:31 -060075
Yiwei Zhang8af03062020-08-12 21:28:15 -070076 bool systemDriverUnloaded;
Peiyong Lin2f51e752023-06-15 22:35:14 +000077 bool angleLoaded; // Was ANGLE successfully loaded
Mathias Agopian1cadb252011-05-23 17:26:14 -070078};
Mathias Agopian1cadb252011-05-23 17:26:14 -070079
Mathias Agopianada798b2012-02-13 17:09:30 -080080extern gl_hooks_t gHooks[2];
Mathias Agopian1cadb252011-05-23 17:26:14 -070081extern gl_hooks_t gHooksNoContext;
82extern pthread_key_t gGLWrapperKey;
83extern "C" void gl_unimplemented();
Mathias Agopian48d438d2012-01-28 21:44:00 -080084extern "C" void gl_noop();
Yiwei Zhang8af03062020-08-12 21:28:15 -070085extern const char* const gl_names[];
86extern const char* const gl_names_1[];
87extern const char* const egl_names[];
Mathias Agopianada798b2012-02-13 17:09:30 -080088extern egl_connection_t gEGLImpl;
Mathias Agopian1cadb252011-05-23 17:26:14 -070089
Mathias Agopian1cadb252011-05-23 17:26:14 -070090}; // namespace android
Mathias Agopian1cadb252011-05-23 17:26:14 -070091
92#endif /* ANDROID_EGLDEFS_H */