eglplatform.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #ifndef __eglplatform_h_
  2. #define __eglplatform_h_
  3. /*
  4. ** Copyright 2007-2020 The Khronos Group Inc.
  5. ** SPDX-License-Identifier: Apache-2.0
  6. */
  7. /* Platform-specific types and definitions for egl.h
  8. *
  9. * Adopters may modify khrplatform.h and this file to suit their platform.
  10. * You are encouraged to submit all modifications to the Khronos group so that
  11. * they can be included in future versions of this file. Please submit changes
  12. * by filing an issue or pull request on the public Khronos EGL Registry, at
  13. * https://www.github.com/KhronosGroup/EGL-Registry/
  14. */
  15. #include <KHR/khrplatform.h>
  16. /* Macros used in EGL function prototype declarations.
  17. *
  18. * EGL functions should be prototyped as:
  19. *
  20. * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
  21. * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
  22. *
  23. * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
  24. */
  25. #ifndef EGLAPI
  26. #define EGLAPI KHRONOS_APICALL
  27. #endif
  28. #ifndef EGLAPIENTRY
  29. #define EGLAPIENTRY KHRONOS_APIENTRY
  30. #endif
  31. #define EGLAPIENTRYP EGLAPIENTRY*
  32. /* The types NativeDisplayType, NativeWindowType, and NativePixmapType
  33. * are aliases of window-system-dependent types, such as X Display * or
  34. * Windows Device Context. They must be defined in platform-specific
  35. * code below. The EGL-prefixed versions of Native*Type are the same
  36. * types, renamed in EGL 1.3 so all types in the API start with "EGL".
  37. *
  38. * Khronos STRONGLY RECOMMENDS that you use the default definitions
  39. * provided below, since these changes affect both binary and source
  40. * portability of applications using EGL running on different EGL
  41. * implementations.
  42. */
  43. #if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES)
  44. typedef void *EGLNativeDisplayType;
  45. typedef void *EGLNativePixmapType;
  46. typedef void *EGLNativeWindowType;
  47. #elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
  48. #ifndef WIN32_LEAN_AND_MEAN
  49. #define WIN32_LEAN_AND_MEAN 1
  50. #endif
  51. #include <windows.h>
  52. typedef HDC EGLNativeDisplayType;
  53. typedef HBITMAP EGLNativePixmapType;
  54. typedef HWND EGLNativeWindowType;
  55. #elif defined(__EMSCRIPTEN__)
  56. typedef int EGLNativeDisplayType;
  57. typedef int EGLNativePixmapType;
  58. typedef int EGLNativeWindowType;
  59. #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
  60. typedef int EGLNativeDisplayType;
  61. typedef void *EGLNativePixmapType;
  62. typedef void *EGLNativeWindowType;
  63. #elif defined(WL_EGL_PLATFORM)
  64. typedef struct wl_display *EGLNativeDisplayType;
  65. typedef struct wl_egl_pixmap *EGLNativePixmapType;
  66. typedef struct wl_egl_window *EGLNativeWindowType;
  67. #elif defined(__GBM__)
  68. typedef struct gbm_device *EGLNativeDisplayType;
  69. typedef struct gbm_bo *EGLNativePixmapType;
  70. typedef void *EGLNativeWindowType;
  71. #elif defined(__ANDROID__) || defined(ANDROID)
  72. struct ANativeWindow;
  73. struct egl_native_pixmap_t;
  74. typedef void* EGLNativeDisplayType;
  75. typedef struct egl_native_pixmap_t* EGLNativePixmapType;
  76. typedef struct ANativeWindow* EGLNativeWindowType;
  77. #elif defined(USE_OZONE)
  78. typedef intptr_t EGLNativeDisplayType;
  79. typedef intptr_t EGLNativePixmapType;
  80. typedef intptr_t EGLNativeWindowType;
  81. #elif defined(USE_X11)
  82. /* X11 (tentative) */
  83. #include <X11/Xlib.h>
  84. #include <X11/Xutil.h>
  85. typedef Display *EGLNativeDisplayType;
  86. typedef Pixmap EGLNativePixmapType;
  87. typedef Window EGLNativeWindowType;
  88. #elif defined(__unix__)
  89. typedef void *EGLNativeDisplayType;
  90. typedef khronos_uintptr_t EGLNativePixmapType;
  91. typedef khronos_uintptr_t EGLNativeWindowType;
  92. #elif defined(__APPLE__)
  93. typedef int EGLNativeDisplayType;
  94. typedef void *EGLNativePixmapType;
  95. typedef void *EGLNativeWindowType;
  96. #elif defined(__HAIKU__)
  97. #include <kernel/image.h>
  98. typedef void *EGLNativeDisplayType;
  99. typedef khronos_uintptr_t EGLNativePixmapType;
  100. typedef khronos_uintptr_t EGLNativeWindowType;
  101. #elif defined(__Fuchsia__)
  102. typedef void *EGLNativeDisplayType;
  103. typedef khronos_uintptr_t EGLNativePixmapType;
  104. typedef khronos_uintptr_t EGLNativeWindowType;
  105. #else
  106. #error "Platform not recognized"
  107. #endif
  108. /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
  109. typedef EGLNativeDisplayType NativeDisplayType;
  110. typedef EGLNativePixmapType NativePixmapType;
  111. typedef EGLNativeWindowType NativeWindowType;
  112. /* Define EGLint. This must be a signed integral type large enough to contain
  113. * all legal attribute names and values passed into and out of EGL, whether
  114. * their type is boolean, bitmask, enumerant (symbolic constant), integer,
  115. * handle, or other. While in general a 32-bit integer will suffice, if
  116. * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
  117. * integer type.
  118. */
  119. typedef khronos_int32_t EGLint;
  120. /* C++ / C typecast macros for special EGL handle values */
  121. #if defined(__cplusplus)
  122. #define EGL_CAST(type, value) (static_cast<type>(value))
  123. #else
  124. #define EGL_CAST(type, value) ((type) (value))
  125. #endif
  126. #endif /* __eglplatform_h */