blob: fcc11f1b5545c5d353da3a2cb4031893bfcb8b47 [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),
44 systemDriverUnloaded(false) {
45 const char* const* entries = platform_names;
Cody Northrop9d5d33d2018-10-15 18:32:14 -060046 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 Northrop68d10352018-10-15 07:22:09 -060060
Yiwei Zhang8af03062020-08-12 21:28:15 -070061 void* dso;
62 gl_hooks_t* hooks[2];
63 EGLint major;
64 EGLint minor;
65 EGLint driverVersion;
66 egl_t egl;
Jesse Hallc07b5202013-07-04 12:08:16 -070067
Cody Northrop68d10352018-10-15 07:22:09 -060068 // Functions implemented or redirected by platform libraries
Yiwei Zhang8af03062020-08-12 21:28:15 -070069 platform_impl_t platform;
Cody Northrop68d10352018-10-15 07:22:09 -060070
Yiwei Zhang8af03062020-08-12 21:28:15 -070071 void* libEgl;
72 void* libGles1;
73 void* libGles2;
Cody Northrop1f00e172018-04-02 11:23:31 -060074
Yiwei Zhang8af03062020-08-12 21:28:15 -070075 bool systemDriverUnloaded;
76 bool useAngle; // Was ANGLE successfully loaded
Mathias Agopian1cadb252011-05-23 17:26:14 -070077};
Mathias Agopian1cadb252011-05-23 17:26:14 -070078
Mathias Agopianada798b2012-02-13 17:09:30 -080079extern gl_hooks_t gHooks[2];
Mathias Agopian1cadb252011-05-23 17:26:14 -070080extern gl_hooks_t gHooksNoContext;
81extern pthread_key_t gGLWrapperKey;
82extern "C" void gl_unimplemented();
Mathias Agopian48d438d2012-01-28 21:44:00 -080083extern "C" void gl_noop();
Yiwei Zhang8af03062020-08-12 21:28:15 -070084extern const char* const gl_names[];
85extern const char* const gl_names_1[];
86extern const char* const egl_names[];
Mathias Agopianada798b2012-02-13 17:09:30 -080087extern egl_connection_t gEGLImpl;
Mathias Agopian1cadb252011-05-23 17:26:14 -070088
Mathias Agopian1cadb252011-05-23 17:26:14 -070089}; // namespace android
Mathias Agopian1cadb252011-05-23 17:26:14 -070090
91#endif /* ANDROID_EGLDEFS_H */