eglplatform.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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(__QNX__)
  56. typedef khronos_uintptr_t EGLNativeDisplayType;
  57. typedef struct _screen_pixmap* EGLNativePixmapType; /* screen_pixmap_t */
  58. typedef struct _screen_window* EGLNativeWindowType; /* screen_window_t */
  59. #elif defined(__EMSCRIPTEN__)
  60. typedef int EGLNativeDisplayType;
  61. typedef int EGLNativePixmapType;
  62. typedef int EGLNativeWindowType;
  63. #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
  64. typedef int EGLNativeDisplayType;
  65. typedef void *EGLNativePixmapType;
  66. typedef void *EGLNativeWindowType;
  67. #elif defined(WL_EGL_PLATFORM)
  68. typedef struct wl_display *EGLNativeDisplayType;
  69. typedef struct wl_egl_pixmap *EGLNativePixmapType;
  70. typedef struct wl_egl_window *EGLNativeWindowType;
  71. #elif defined(__GBM__)
  72. typedef struct gbm_device *EGLNativeDisplayType;
  73. typedef struct gbm_bo *EGLNativePixmapType;
  74. typedef void *EGLNativeWindowType;
  75. #elif defined(__ANDROID__) || defined(ANDROID)
  76. struct ANativeWindow;
  77. struct egl_native_pixmap_t;
  78. typedef void* EGLNativeDisplayType;
  79. typedef struct egl_native_pixmap_t* EGLNativePixmapType;
  80. typedef struct ANativeWindow* EGLNativeWindowType;
  81. #elif defined(USE_OZONE)
  82. typedef intptr_t EGLNativeDisplayType;
  83. typedef intptr_t EGLNativePixmapType;
  84. typedef intptr_t EGLNativeWindowType;
  85. #elif defined(USE_X11)
  86. /* X11 (tentative) */
  87. #include <X11/Xlib.h>
  88. #include <X11/Xutil.h>
  89. typedef Display *EGLNativeDisplayType;
  90. typedef Pixmap EGLNativePixmapType;
  91. typedef Window EGLNativeWindowType;
  92. #elif defined(__unix__)
  93. typedef void *EGLNativeDisplayType;
  94. typedef khronos_uintptr_t EGLNativePixmapType;
  95. typedef khronos_uintptr_t EGLNativeWindowType;
  96. #elif defined(__APPLE__)
  97. typedef int EGLNativeDisplayType;
  98. typedef void *EGLNativePixmapType;
  99. typedef void *EGLNativeWindowType;
  100. #elif defined(__HAIKU__)
  101. #include <kernel/image.h>
  102. typedef void *EGLNativeDisplayType;
  103. typedef khronos_uintptr_t EGLNativePixmapType;
  104. typedef khronos_uintptr_t EGLNativeWindowType;
  105. #elif defined(__Fuchsia__)
  106. typedef void *EGLNativeDisplayType;
  107. typedef khronos_uintptr_t EGLNativePixmapType;
  108. typedef khronos_uintptr_t EGLNativeWindowType;
  109. #else
  110. #error "Platform not recognized"
  111. #endif
  112. /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
  113. typedef EGLNativeDisplayType NativeDisplayType;
  114. typedef EGLNativePixmapType NativePixmapType;
  115. typedef EGLNativeWindowType NativeWindowType;
  116. /* Define EGLint. This must be a signed integral type large enough to contain
  117. * all legal attribute names and values passed into and out of EGL, whether
  118. * their type is boolean, bitmask, enumerant (symbolic constant), integer,
  119. * handle, or other. While in general a 32-bit integer will suffice, if
  120. * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
  121. * integer type.
  122. */
  123. typedef khronos_int32_t EGLint;
  124. /* C++ / C typecast macros for special EGL handle values */
  125. #if defined(__cplusplus)
  126. #define EGL_CAST(type, value) (static_cast<type>(value))
  127. #else
  128. #define EGL_CAST(type, value) ((type) (value))
  129. #endif
  130. #endif /* __eglplatform_h */