egldefs.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #ifndef ANDROID_EGLDEFS_H
  17. #define ANDROID_EGLDEFS_H
  18. #include "../hooks.h"
  19. #include "egl_platform_entries.h"
  20. #include <log/log.h>
  21. #define VERSION_MAJOR 1
  22. #define VERSION_MINOR 4
  23. #define EGL_MAKE_VERSION(major, minor, patch) (((major) << 22) | ((minor) << 12) | (patch))
  24. // ----------------------------------------------------------------------------
  25. namespace android {
  26. // ----------------------------------------------------------------------------
  27. // EGLDisplay are global, not attached to a given thread
  28. const unsigned int NUM_DISPLAYS = 1;
  29. // ----------------------------------------------------------------------------
  30. extern char const * const platform_names[];
  31. // clang-format off
  32. struct egl_connection_t {
  33. enum {
  34. GLESv1_INDEX = 0,
  35. GLESv2_INDEX = 1
  36. };
  37. inline egl_connection_t() : dso(nullptr),
  38. libEgl(nullptr),
  39. libGles1(nullptr),
  40. libGles2(nullptr),
  41. systemDriverUnloaded(false) {
  42. char const* const* entries = platform_names;
  43. EGLFuncPointer* curr = reinterpret_cast<EGLFuncPointer*>(&platform);
  44. while (*entries) {
  45. const char* name = *entries;
  46. EGLFuncPointer f = FindPlatformImplAddr(name);
  47. if (f == nullptr) {
  48. // If no entry found, update the lookup table: sPlatformImplMap
  49. ALOGE("No entry found in platform lookup table for %s", name);
  50. }
  51. *curr++ = f;
  52. entries++;
  53. }
  54. }
  55. void * dso;
  56. gl_hooks_t * hooks[2];
  57. EGLint major;
  58. EGLint minor;
  59. EGLint driverVersion;
  60. egl_t egl;
  61. // Functions implemented or redirected by platform libraries
  62. platform_impl_t platform;
  63. void* libEgl;
  64. void* libGles1;
  65. void* libGles2;
  66. bool systemDriverUnloaded;
  67. bool shouldUseAngle; // Should we attempt to load ANGLE
  68. bool angleDecided; // Have we tried to load ANGLE
  69. bool useAngle; // Was ANGLE successfully loaded
  70. EGLint angleBackend;
  71. void* vendorEGL;
  72. };
  73. // clang-format on
  74. // ----------------------------------------------------------------------------
  75. extern gl_hooks_t gHooks[2];
  76. extern gl_hooks_t gHooksNoContext;
  77. extern pthread_key_t gGLWrapperKey;
  78. extern "C" void gl_unimplemented();
  79. extern "C" void gl_noop();
  80. extern char const * const gl_names[];
  81. extern char const * const gl_names_1[];
  82. extern char const * const egl_names[];
  83. extern egl_connection_t gEGLImpl;
  84. // ----------------------------------------------------------------------------
  85. }; // namespace android
  86. // ----------------------------------------------------------------------------
  87. #endif /* ANDROID_EGLDEFS_H */