blob: 7c710d58d9af1fb03443de55685b4fcc1937836d [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
Mathias Agopian39c24a22013-04-04 23:17:56 -070020#include "../hooks.h"
Cody Northrop9d5d33d2018-10-15 18:32:14 -060021#include "egl_platform_entries.h"
22
23#include <log/log.h>
Mathias Agopian1cadb252011-05-23 17:26:14 -070024
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 -070029// ----------------------------------------------------------------------------
30namespace android {
31// ----------------------------------------------------------------------------
32
Mathias Agopian1cadb252011-05-23 17:26:14 -070033// EGLDisplay are global, not attached to a given thread
34const unsigned int NUM_DISPLAYS = 1;
35
Mathias Agopian1cadb252011-05-23 17:26:14 -070036// ----------------------------------------------------------------------------
37
Cody Northrop9d5d33d2018-10-15 18:32:14 -060038extern char const * const platform_names[];
39
Courtney Goeltzenleuchter015ed672018-07-27 13:43:23 -060040// clang-format off
Mathias Agopian7773c432012-02-13 20:06:08 -080041struct egl_connection_t {
42 enum {
43 GLESv1_INDEX = 0,
44 GLESv2_INDEX = 1
45 };
46
Cody Northrop9d5d33d2018-10-15 18:32:14 -060047 inline egl_connection_t() : dso(nullptr) {
48
49 char const* const* entries = platform_names;
50 EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&platform);
51 while (*entries) {
52 const char* name = *entries;
53 EGLFuncPointer f = FindPlatformImplAddr(name);
54
55 if (f == nullptr) {
56 // If no entry found, update the lookup table: sPlatformImplMap
57 ALOGE("No entry found in platform lookup table for %s", name);
58 }
59
60 *curr++ = f;
61 entries++;
62 }
63 }
Cody Northrop68d10352018-10-15 07:22:09 -060064
Mathias Agopian1cadb252011-05-23 17:26:14 -070065 void * dso;
66 gl_hooks_t * hooks[2];
67 EGLint major;
68 EGLint minor;
Courtney Goeltzenleuchter015ed672018-07-27 13:43:23 -060069 EGLint driverVersion;
Mathias Agopian1cadb252011-05-23 17:26:14 -070070 egl_t egl;
Jesse Hallc07b5202013-07-04 12:08:16 -070071
Cody Northrop68d10352018-10-15 07:22:09 -060072 // Functions implemented or redirected by platform libraries
73 platform_impl_t platform;
74
Michael Chockc0ec5e22014-01-27 08:14:33 -080075 void* libEgl;
Jesse Hallc07b5202013-07-04 12:08:16 -070076 void* libGles1;
77 void* libGles2;
Cody Northrop1f00e172018-04-02 11:23:31 -060078
79 bool useAngle;
Courtney Goeltzenleuchter555f1df2018-09-25 14:34:29 -060080 EGLint angleBackend;
Cody Northrop1f00e172018-04-02 11:23:31 -060081 void* vendorEGL;
Mathias Agopian1cadb252011-05-23 17:26:14 -070082};
Courtney Goeltzenleuchter015ed672018-07-27 13:43:23 -060083// clang-format on
Mathias Agopian1cadb252011-05-23 17:26:14 -070084
85// ----------------------------------------------------------------------------
86
Mathias Agopianada798b2012-02-13 17:09:30 -080087extern gl_hooks_t gHooks[2];
Mathias Agopian1cadb252011-05-23 17:26:14 -070088extern gl_hooks_t gHooksNoContext;
89extern pthread_key_t gGLWrapperKey;
90extern "C" void gl_unimplemented();
Mathias Agopian48d438d2012-01-28 21:44:00 -080091extern "C" void gl_noop();
Mathias Agopian1cadb252011-05-23 17:26:14 -070092
93extern char const * const gl_names[];
Yiwei Zhang7cc58922018-10-10 11:37:43 -070094extern char const * const gl_names_1[];
Mathias Agopian1cadb252011-05-23 17:26:14 -070095extern char const * const egl_names[];
96
Mathias Agopianada798b2012-02-13 17:09:30 -080097extern egl_connection_t gEGLImpl;
Mathias Agopian1cadb252011-05-23 17:26:14 -070098
99// ----------------------------------------------------------------------------
100}; // namespace android
101// ----------------------------------------------------------------------------
102
103#endif /* ANDROID_EGLDEFS_H */