Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 1 | /* |
| 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 Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 20 | #include <log/log.h> |
| 21 | |
Mathias Agopian | 39c24a2 | 2013-04-04 23:17:56 -0700 | [diff] [blame] | 22 | #include "../hooks.h" |
Cody Northrop | 9d5d33d | 2018-10-15 18:32:14 -0600 | [diff] [blame] | 23 | #include "egl_platform_entries.h" |
| 24 | |
Mathias Agopian | 7773c43 | 2012-02-13 20:06:08 -0800 | [diff] [blame] | 25 | #define VERSION_MAJOR 1 |
| 26 | #define VERSION_MINOR 4 |
Courtney Goeltzenleuchter | 015ed67 | 2018-07-27 13:43:23 -0600 | [diff] [blame] | 27 | #define EGL_MAKE_VERSION(major, minor, patch) (((major) << 22) | ((minor) << 12) | (patch)) |
Mathias Agopian | 7773c43 | 2012-02-13 20:06:08 -0800 | [diff] [blame] | 28 | |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 29 | namespace android { |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 30 | |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 31 | // EGLDisplay are global, not attached to a given thread |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 32 | const unsigned int NUM_DISPLAYS = 1; |
| 33 | |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 34 | extern const char* const platform_names[]; |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 35 | |
Mathias Agopian | 7773c43 | 2012-02-13 20:06:08 -0800 | [diff] [blame] | 36 | struct egl_connection_t { |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 37 | enum { GLESv1_INDEX = 0, GLESv2_INDEX = 1 }; |
Mathias Agopian | 7773c43 | 2012-02-13 20:06:08 -0800 | [diff] [blame] | 38 | |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 39 | inline egl_connection_t() |
| 40 | : dso(nullptr), |
| 41 | libEgl(nullptr), |
| 42 | libGles1(nullptr), |
| 43 | libGles2(nullptr), |
| 44 | systemDriverUnloaded(false) { |
| 45 | const char* const* entries = platform_names; |
Cody Northrop | 9d5d33d | 2018-10-15 18:32:14 -0600 | [diff] [blame] | 46 | EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&platform); |
| 47 | while (*entries) { |
| 48 | const char* name = *entries; |
| 49 | EGLFuncPointer f = FindPlatformImplAddr(name); |
| 50 | |
| 51 | if (f == nullptr) { |
| 52 | // If no entry found, update the lookup table: sPlatformImplMap |
| 53 | ALOGE("No entry found in platform lookup table for %s", name); |
| 54 | } |
| 55 | |
| 56 | *curr++ = f; |
| 57 | entries++; |
| 58 | } |
| 59 | } |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 60 | |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 61 | void* dso; |
| 62 | gl_hooks_t* hooks[2]; |
| 63 | EGLint major; |
| 64 | EGLint minor; |
| 65 | EGLint driverVersion; |
| 66 | egl_t egl; |
Jesse Hall | c07b520 | 2013-07-04 12:08:16 -0700 | [diff] [blame] | 67 | |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 68 | // Functions implemented or redirected by platform libraries |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 69 | platform_impl_t platform; |
Cody Northrop | 68d1035 | 2018-10-15 07:22:09 -0600 | [diff] [blame] | 70 | |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 71 | void* libEgl; |
| 72 | void* libGles1; |
| 73 | void* libGles2; |
Cody Northrop | 1f00e17 | 2018-04-02 11:23:31 -0600 | [diff] [blame] | 74 | |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 75 | bool systemDriverUnloaded; |
| 76 | bool useAngle; // Was ANGLE successfully loaded |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 77 | }; |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 78 | |
Mathias Agopian | ada798b | 2012-02-13 17:09:30 -0800 | [diff] [blame] | 79 | extern gl_hooks_t gHooks[2]; |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 80 | extern gl_hooks_t gHooksNoContext; |
| 81 | extern pthread_key_t gGLWrapperKey; |
| 82 | extern "C" void gl_unimplemented(); |
Mathias Agopian | 48d438d | 2012-01-28 21:44:00 -0800 | [diff] [blame] | 83 | extern "C" void gl_noop(); |
Yiwei Zhang | 8af0306 | 2020-08-12 21:28:15 -0700 | [diff] [blame] | 84 | extern const char* const gl_names[]; |
| 85 | extern const char* const gl_names_1[]; |
| 86 | extern const char* const egl_names[]; |
Mathias Agopian | ada798b | 2012-02-13 17:09:30 -0800 | [diff] [blame] | 87 | extern egl_connection_t gEGLImpl; |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 88 | |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 89 | }; // namespace android |
Mathias Agopian | 1cadb25 | 2011-05-23 17:26:14 -0700 | [diff] [blame] | 90 | |
| 91 | #endif /* ANDROID_EGLDEFS_H */ |