eglplatform.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef __eglplatform_h_
  2. #define __eglplatform_h_
  3. /*
  4. ** Copyright (c) 2007-2009 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. *
  27. * Adopters may modify khrplatform.h and this file to suit their platform.
  28. * You are encouraged to submit all modifications to the Khronos group so that
  29. * they can be included in future versions of this file. Please submit changes
  30. * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
  31. * by filing a bug against product "EGL" component "Registry".
  32. */
  33. #include <KHR/khrplatform.h>
  34. /* Macros used in EGL function prototype declarations.
  35. *
  36. * EGL functions should be prototyped as:
  37. *
  38. * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
  39. * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
  40. *
  41. * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
  42. */
  43. #ifndef EGLAPI
  44. #define EGLAPI KHRONOS_APICALL
  45. #endif
  46. #define EGLAPIENTRY KHRONOS_APIENTRY
  47. #define EGLAPIENTRYP KHRONOS_APIENTRY*
  48. /* The types NativeDisplayType, NativeWindowType, and NativePixmapType
  49. * are aliases of window-system-dependent types, such as X Display * or
  50. * Windows Device Context. They must be defined in platform-specific
  51. * code below. The EGL-prefixed versions of Native*Type are the same
  52. * types, renamed in EGL 1.3 so all types in the API start with "EGL".
  53. */
  54. #if defined(_WIN32) && !defined(__WINSCW__) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
  55. #ifndef WIN32_LEAN_AND_MEAN
  56. #define WIN32_LEAN_AND_MEAN 1
  57. #endif
  58. #include <windows.h>
  59. typedef HDC EGLNativeDisplayType;
  60. typedef HBITMAP EGLNativePixmapType;
  61. typedef HWND EGLNativeWindowType;
  62. #elif defined(SUPPORT_X11)
  63. /* X11 (tentative) */
  64. #include <X11/Xlib.h>
  65. #include <X11/Xutil.h>
  66. typedef Display *EGLNativeDisplayType;
  67. typedef Pixmap EGLNativePixmapType;
  68. typedef Window EGLNativeWindowType;
  69. #elif defined(ANDROID)
  70. struct android_native_window_t;
  71. struct egl_native_pixmap_t;
  72. typedef struct android_native_window_t* EGLNativeWindowType;
  73. typedef struct egl_native_pixmap_t* EGLNativePixmapType;
  74. typedef void* EGLNativeDisplayType;
  75. #else
  76. #if defined(_WIN64) || __WORDSIZE == 64
  77. typedef khronos_int64_t EGLNativeDisplayType;
  78. #else
  79. typedef int EGLNativeDisplayType;
  80. #endif
  81. typedef void *EGLNativeWindowType;
  82. typedef void *EGLNativePixmapType;
  83. #endif
  84. /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
  85. typedef EGLNativeDisplayType NativeDisplayType;
  86. typedef EGLNativePixmapType NativePixmapType;
  87. typedef EGLNativeWindowType NativeWindowType;
  88. /* Define EGLint. This must be a signed integral type large enough to contain
  89. * all legal attribute names and values passed into and out of EGL, whether
  90. * their type is boolean, bitmask, enumerant (symbolic constant), integer,
  91. * handle, or other. While in general a 32-bit integer will suffice, if
  92. * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
  93. * integer type.
  94. */
  95. #if defined(_WIN64) || __WORDSIZE == 64
  96. typedef khronos_int64_t EGLint;
  97. #else
  98. typedef khronos_int32_t EGLint;
  99. #endif
  100. #endif /* __eglplatform_h */