blob: 90a3c199a95effd9a9b0f8b0cd56f1ca1b5297bd [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),
Peiyong Lin9fc4cf32023-11-03 05:18:53 +000045 angleLoaded(false),
46 angleGetDisplayPlatformFunc(nullptr),
47 angleResetDisplayPlatformFunc(nullptr) {
Yiwei Zhang8af03062020-08-12 21:28:15 -070048 const char* const* entries = platform_names;
Cody Northrop9d5d33d2018-10-15 18:32:14 -060049 EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&platform);
50 while (*entries) {
51 const char* name = *entries;
52 EGLFuncPointer f = FindPlatformImplAddr(name);
53
54 if (f == nullptr) {
55 // If no entry found, update the lookup table: sPlatformImplMap
56 ALOGE("No entry found in platform lookup table for %s", name);
57 }
58
59 *curr++ = f;
60 entries++;
61 }
62 }
Cody Northrop68d10352018-10-15 07:22:09 -060063
Yiwei Zhang8af03062020-08-12 21:28:15 -070064 void* dso;
65 gl_hooks_t* hooks[2];
66 EGLint major;
67 EGLint minor;
68 EGLint driverVersion;
69 egl_t egl;
Jesse Hallc07b5202013-07-04 12:08:16 -070070
Cody Northrop68d10352018-10-15 07:22:09 -060071 // Functions implemented or redirected by platform libraries
Yiwei Zhang8af03062020-08-12 21:28:15 -070072 platform_impl_t platform;
Cody Northrop68d10352018-10-15 07:22:09 -060073
Yiwei Zhang8af03062020-08-12 21:28:15 -070074 void* libEgl;
75 void* libGles1;
76 void* libGles2;
Cody Northrop1f00e172018-04-02 11:23:31 -060077
Yiwei Zhang8af03062020-08-12 21:28:15 -070078 bool systemDriverUnloaded;
Peiyong Lin2f51e752023-06-15 22:35:14 +000079 bool angleLoaded; // Was ANGLE successfully loaded
Peiyong Lin9fc4cf32023-11-03 05:18:53 +000080
81 void* angleGetDisplayPlatformFunc;
82 void* angleResetDisplayPlatformFunc;
Mathias Agopian1cadb252011-05-23 17:26:14 -070083};
Mathias Agopian1cadb252011-05-23 17:26:14 -070084
Mathias Agopianada798b2012-02-13 17:09:30 -080085extern gl_hooks_t gHooks[2];
Mathias Agopian1cadb252011-05-23 17:26:14 -070086extern gl_hooks_t gHooksNoContext;
87extern pthread_key_t gGLWrapperKey;
88extern "C" void gl_unimplemented();
Mathias Agopian48d438d2012-01-28 21:44:00 -080089extern "C" void gl_noop();
Yiwei Zhang8af03062020-08-12 21:28:15 -070090extern const char* const gl_names[];
91extern const char* const gl_names_1[];
92extern const char* const egl_names[];
Mathias Agopianada798b2012-02-13 17:09:30 -080093extern egl_connection_t gEGLImpl;
Mathias Agopian1cadb252011-05-23 17:26:14 -070094
Mathias Agopian1cadb252011-05-23 17:26:14 -070095}; // namespace android
Mathias Agopian1cadb252011-05-23 17:26:14 -070096
97#endif /* ANDROID_EGLDEFS_H */