eglplatform.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #ifndef __eglplatform_h_
  2. #define __eglplatform_h_
  3. /*
  4. ** Copyright (c) 2007-2016 The Khronos Group Inc.
  5. **
  6. ** Permission is hereby granted, free of charge, to any person obtaining a
  7. ** copy of this software and/or associated documentation files (the
  8. ** "Materials"), to deal in the Materials without restriction, including
  9. ** without limitation the rights to use, copy, modify, merge, publish,
  10. ** distribute, sublicense, and/or sell copies of the Materials, and to
  11. ** permit persons to whom the Materials are furnished to do so, subject to
  12. ** the following conditions:
  13. **
  14. ** The above copyright notice and this permission notice shall be included
  15. ** in all copies or substantial portions of the Materials.
  16. **
  17. ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  21. ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  22. ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  23. ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  24. */
  25. /* Platform-specific types and definitions for egl.h
  26. * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
  27. *
  28. * Adopters may modify khrplatform.h and this file to suit their platform.
  29. * You are encouraged to submit all modifications to the Khronos group so that
  30. * they can be included in future versions of this file. Please submit changes
  31. * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
  32. * by filing a bug against product "EGL" component "Registry".
  33. */
  34. #include <KHR/khrplatform.h>
  35. /* Macros used in EGL function prototype declarations.
  36. *
  37. * EGL functions should be prototyped as:
  38. *
  39. * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
  40. * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
  41. *
  42. * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
  43. */
  44. #ifndef EGLAPI
  45. #define EGLAPI KHRONOS_APICALL
  46. #endif
  47. #ifndef EGLAPIENTRY
  48. #define EGLAPIENTRY KHRONOS_APIENTRY
  49. #endif
  50. #define EGLAPIENTRYP EGLAPIENTRY*
  51. #if defined(MESA_EGL_NO_X11_HEADERS) && !defined(EGL_NO_X11)
  52. #warning "`MESA_EGL_NO_X11_HEADERS` is deprecated, and doesn't work with the unmodified Khronos header"
  53. #warning "Please use `EGL_NO_X11` instead, as `MESA_EGL_NO_X11_HEADERS` will be removed soon"
  54. #define EGL_NO_X11
  55. #endif
  56. /* The types NativeDisplayType, NativeWindowType, and NativePixmapType
  57. * are aliases of window-system-dependent types, such as X Display * or
  58. * Windows Device Context. They must be defined in platform-specific
  59. * code below. The EGL-prefixed versions of Native*Type are the same
  60. * types, renamed in EGL 1.3 so all types in the API start with "EGL".
  61. *
  62. * Khronos STRONGLY RECOMMENDS that you use the default definitions
  63. * provided below, since these changes affect both binary and source
  64. * portability of applications using EGL running on different EGL
  65. * implementations.
  66. */
  67. #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
  68. #ifndef WIN32_LEAN_AND_MEAN
  69. #define WIN32_LEAN_AND_MEAN 1
  70. #endif
  71. #include <windows.h>
  72. typedef HDC EGLNativeDisplayType;
  73. typedef HBITMAP EGLNativePixmapType;
  74. typedef HWND EGLNativeWindowType;
  75. #elif defined(__EMSCRIPTEN__)
  76. typedef int EGLNativeDisplayType;
  77. typedef int EGLNativePixmapType;
  78. typedef int EGLNativeWindowType;
  79. #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
  80. typedef int EGLNativeDisplayType;
  81. typedef void *EGLNativePixmapType;
  82. typedef void *EGLNativeWindowType;
  83. #elif defined(WL_EGL_PLATFORM)
  84. typedef struct wl_display *EGLNativeDisplayType;
  85. typedef struct wl_egl_pixmap *EGLNativePixmapType;
  86. typedef struct wl_egl_window *EGLNativeWindowType;
  87. #elif defined(__GBM__)
  88. typedef struct gbm_device *EGLNativeDisplayType;
  89. typedef struct gbm_bo *EGLNativePixmapType;
  90. typedef void *EGLNativeWindowType;
  91. #elif defined(__ANDROID__) || defined(ANDROID)
  92. struct ANativeWindow;
  93. struct egl_native_pixmap_t;
  94. typedef void* EGLNativeDisplayType;
  95. typedef struct egl_native_pixmap_t* EGLNativePixmapType;
  96. typedef struct ANativeWindow* EGLNativeWindowType;
  97. #elif defined(USE_OZONE)
  98. typedef intptr_t EGLNativeDisplayType;
  99. typedef intptr_t EGLNativePixmapType;
  100. typedef intptr_t EGLNativeWindowType;
  101. #elif defined(__unix__) && defined(EGL_NO_X11) || 0
  102. typedef void *EGLNativeDisplayType;
  103. typedef khronos_uintptr_t EGLNativePixmapType;
  104. typedef khronos_uintptr_t EGLNativeWindowType;
  105. #elif defined(__unix__) || defined(USE_X11)
  106. /* X11 (tentative) */
  107. #include <X11/Xlib.h>
  108. #include <X11/Xutil.h>
  109. typedef Display *EGLNativeDisplayType;
  110. typedef Pixmap EGLNativePixmapType;
  111. typedef Window EGLNativeWindowType;
  112. #elif defined(__APPLE__)
  113. typedef int EGLNativeDisplayType;
  114. typedef void *EGLNativePixmapType;
  115. typedef void *EGLNativeWindowType;
  116. #elif defined(__HAIKU__)
  117. #include <kernel/image.h>
  118. typedef void *EGLNativeDisplayType;
  119. typedef khronos_uintptr_t EGLNativePixmapType;
  120. typedef khronos_uintptr_t EGLNativeWindowType;
  121. #else
  122. #error "Platform not recognized"
  123. #endif
  124. /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
  125. typedef EGLNativeDisplayType NativeDisplayType;
  126. typedef EGLNativePixmapType NativePixmapType;
  127. typedef EGLNativeWindowType NativeWindowType;
  128. /* Define EGLint. This must be a signed integral type large enough to contain
  129. * all legal attribute names and values passed into and out of EGL, whether
  130. * their type is boolean, bitmask, enumerant (symbolic constant), integer,
  131. * handle, or other. While in general a 32-bit integer will suffice, if
  132. * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
  133. * integer type.
  134. */
  135. typedef khronos_int32_t EGLint;
  136. /* C++ / C typecast macros for special EGL handle values */
  137. #if defined(__cplusplus)
  138. #define EGL_CAST(type, value) (static_cast<type>(value))
  139. #else
  140. #define EGL_CAST(type, value) ((type) (value))
  141. #endif
  142. #endif /* __eglplatform_h */