blob: 77654b09317db3eac139c5ab71b02b2464d2a41a [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
27
Mathias Agopian1cadb252011-05-23 17:26:14 -070028// ----------------------------------------------------------------------------
29namespace android {
30// ----------------------------------------------------------------------------
31
Mathias Agopian1cadb252011-05-23 17:26:14 -070032// EGLDisplay are global, not attached to a given thread
33const unsigned int NUM_DISPLAYS = 1;
34
Mathias Agopian1cadb252011-05-23 17:26:14 -070035// ----------------------------------------------------------------------------
36
Cody Northrop9d5d33d2018-10-15 18:32:14 -060037extern char const * const platform_names[];
38
Mathias Agopian7773c432012-02-13 20:06:08 -080039struct egl_connection_t {
40 enum {
41 GLESv1_INDEX = 0,
42 GLESv2_INDEX = 1
43 };
44
Cody Northrop9d5d33d2018-10-15 18:32:14 -060045 inline egl_connection_t() : dso(nullptr) {
46
47 char const* const* entries = platform_names;
48 EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&platform);
49 while (*entries) {
50 const char* name = *entries;
51 EGLFuncPointer f = FindPlatformImplAddr(name);
52
53 if (f == nullptr) {
54 // If no entry found, update the lookup table: sPlatformImplMap
55 ALOGE("No entry found in platform lookup table for %s", name);
56 }
57
58 *curr++ = f;
59 entries++;
60 }
61 }
Cody Northrop68d10352018-10-15 07:22:09 -060062
Mathias Agopian1cadb252011-05-23 17:26:14 -070063 void * dso;
64 gl_hooks_t * hooks[2];
65 EGLint major;
66 EGLint minor;
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
70 platform_impl_t platform;
71
Michael Chockc0ec5e22014-01-27 08:14:33 -080072 void* libEgl;
Jesse Hallc07b5202013-07-04 12:08:16 -070073 void* libGles1;
74 void* libGles2;
Cody Northrop1f00e172018-04-02 11:23:31 -060075
76 bool useAngle;
Courtney Goeltzenleuchter555f1df2018-09-25 14:34:29 -060077 EGLint angleBackend;
Cody Northrop1f00e172018-04-02 11:23:31 -060078 void* vendorEGL;
Mathias Agopian1cadb252011-05-23 17:26:14 -070079};
80
81// ----------------------------------------------------------------------------
82
Mathias Agopianada798b2012-02-13 17:09:30 -080083extern gl_hooks_t gHooks[2];
Mathias Agopian1cadb252011-05-23 17:26:14 -070084extern gl_hooks_t gHooksNoContext;
85extern pthread_key_t gGLWrapperKey;
86extern "C" void gl_unimplemented();
Mathias Agopian48d438d2012-01-28 21:44:00 -080087extern "C" void gl_noop();
Mathias Agopian1cadb252011-05-23 17:26:14 -070088
89extern char const * const gl_names[];
Yiwei Zhang7cc58922018-10-10 11:37:43 -070090extern char const * const gl_names_1[];
Mathias Agopian1cadb252011-05-23 17:26:14 -070091extern char const * const egl_names[];
92
Mathias Agopianada798b2012-02-13 17:09:30 -080093extern egl_connection_t gEGLImpl;
Mathias Agopian1cadb252011-05-23 17:26:14 -070094
95// ----------------------------------------------------------------------------
96}; // namespace android
97// ----------------------------------------------------------------------------
98
99#endif /* ANDROID_EGLDEFS_H */