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 20 #include <log/log.h> 21 22 #include "../hooks.h" 23 #include "egl_platform_entries.h" 24 25 #define VERSION_MAJOR 1 26 #define VERSION_MINOR 4 27 #define EGL_MAKE_VERSION(major, minor, patch) (((major) << 22) | ((minor) << 12) | (patch)) 28 29 namespace android { 30 31 // EGLDisplay are global, not attached to a given thread 32 const unsigned int NUM_DISPLAYS = 1; 33 34 extern const char* const platform_names[]; 35 36 struct egl_connection_t { 37 enum { GLESv1_INDEX = 0, GLESv2_INDEX = 1 }; 38 egl_connection_tegl_connection_t39 inline egl_connection_t() 40 : dso(nullptr), 41 libEgl(nullptr), 42 libGles1(nullptr), 43 libGles2(nullptr), 44 systemDriverUnloaded(false), 45 angleLoaded(false), 46 angleGetDisplayPlatformFunc(nullptr), 47 angleResetDisplayPlatformFunc(nullptr) { 48 const char* const* entries = platform_names; 49 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 } 63 64 void* dso; 65 gl_hooks_t* hooks[2]; 66 EGLint major; 67 EGLint minor; 68 EGLint driverVersion; 69 egl_t egl; 70 71 // Functions implemented or redirected by platform libraries 72 platform_impl_t platform; 73 74 void* libEgl; 75 void* libGles1; 76 void* libGles2; 77 78 bool systemDriverUnloaded; 79 bool angleLoaded; // Was ANGLE successfully loaded 80 81 void* angleGetDisplayPlatformFunc; 82 void* angleResetDisplayPlatformFunc; 83 }; 84 85 extern gl_hooks_t gHooks[2]; 86 extern gl_hooks_t gHooksNoContext; 87 extern pthread_key_t gGLWrapperKey; 88 extern "C" void gl_unimplemented(); 89 extern "C" void gl_noop(); 90 extern const char* const gl_names[]; 91 extern const char* const gl_names_1[]; 92 extern const char* const egl_names[]; 93 extern egl_connection_t gEGLImpl; 94 95 }; // namespace android 96 97 #endif /* ANDROID_EGLDEFS_H */ 98