egl.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. /* -*- mode: c; tab-width: 8; -*- */
  2. /* vi: set sw=4 ts=8: */
  3. /* Reference version of egl.h for EGL 1.4.
  4. */
  5. /*
  6. ** Copyright (c) 2007-2009 The Khronos Group Inc.
  7. **
  8. ** Permission is hereby granted, free of charge, to any person obtaining a
  9. ** copy of this software and/or associated documentation files (the
  10. ** "Materials"), to deal in the Materials without restriction, including
  11. ** without limitation the rights to use, copy, modify, merge, publish,
  12. ** distribute, sublicense, and/or sell copies of the Materials, and to
  13. ** permit persons to whom the Materials are furnished to do so, subject to
  14. ** the following conditions:
  15. **
  16. ** The above copyright notice and this permission notice shall be included
  17. ** in all copies or substantial portions of the Materials.
  18. **
  19. ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  22. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  23. ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  24. ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  25. ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
  26. */
  27. #ifndef __egl_h_
  28. #define __egl_h_
  29. /* All platform-dependent types and macro boilerplate (such as EGLAPI
  30. * and EGLAPIENTRY) should go in eglplatform.h.
  31. */
  32. #include <EGL/eglplatform.h>
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. /* EGL Types */
  37. /* EGLint is defined in eglplatform.h */
  38. typedef unsigned int EGLBoolean;
  39. typedef unsigned int EGLenum;
  40. typedef void *EGLConfig;
  41. typedef void *EGLContext;
  42. typedef void *EGLDisplay;
  43. typedef void *EGLSurface;
  44. typedef void *EGLClientBuffer;
  45. /* EGL Versioning */
  46. #define EGL_VERSION_1_0 1
  47. #define EGL_VERSION_1_1 1
  48. #define EGL_VERSION_1_2 1
  49. #define EGL_VERSION_1_3 1
  50. #define EGL_VERSION_1_4 1
  51. /* EGL Enumerants. Bitmasks and other exceptional cases aside, most
  52. * enums are assigned unique values starting at 0x3000.
  53. */
  54. /* EGL aliases */
  55. #define EGL_FALSE 0
  56. #define EGL_TRUE 1
  57. /* Out-of-band handle values */
  58. #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
  59. #define EGL_NO_CONTEXT ((EGLContext)0)
  60. #define EGL_NO_DISPLAY ((EGLDisplay)0)
  61. #define EGL_NO_SURFACE ((EGLSurface)0)
  62. /* Out-of-band attribute value */
  63. #define EGL_DONT_CARE ((EGLint)-1)
  64. /* Errors / GetError return values */
  65. #define EGL_SUCCESS 0x3000
  66. #define EGL_NOT_INITIALIZED 0x3001
  67. #define EGL_BAD_ACCESS 0x3002
  68. #define EGL_BAD_ALLOC 0x3003
  69. #define EGL_BAD_ATTRIBUTE 0x3004
  70. #define EGL_BAD_CONFIG 0x3005
  71. #define EGL_BAD_CONTEXT 0x3006
  72. #define EGL_BAD_CURRENT_SURFACE 0x3007
  73. #define EGL_BAD_DISPLAY 0x3008
  74. #define EGL_BAD_MATCH 0x3009
  75. #define EGL_BAD_NATIVE_PIXMAP 0x300A
  76. #define EGL_BAD_NATIVE_WINDOW 0x300B
  77. #define EGL_BAD_PARAMETER 0x300C
  78. #define EGL_BAD_SURFACE 0x300D
  79. #define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
  80. /* Reserved 0x300F-0x301F for additional errors */
  81. /* Config attributes */
  82. #define EGL_BUFFER_SIZE 0x3020
  83. #define EGL_ALPHA_SIZE 0x3021
  84. #define EGL_BLUE_SIZE 0x3022
  85. #define EGL_GREEN_SIZE 0x3023
  86. #define EGL_RED_SIZE 0x3024
  87. #define EGL_DEPTH_SIZE 0x3025
  88. #define EGL_STENCIL_SIZE 0x3026
  89. #define EGL_CONFIG_CAVEAT 0x3027
  90. #define EGL_CONFIG_ID 0x3028
  91. #define EGL_LEVEL 0x3029
  92. #define EGL_MAX_PBUFFER_HEIGHT 0x302A
  93. #define EGL_MAX_PBUFFER_PIXELS 0x302B
  94. #define EGL_MAX_PBUFFER_WIDTH 0x302C
  95. #define EGL_NATIVE_RENDERABLE 0x302D
  96. #define EGL_NATIVE_VISUAL_ID 0x302E
  97. #define EGL_NATIVE_VISUAL_TYPE 0x302F
  98. #define EGL_PRESERVED_RESOURCES 0x3030
  99. #define EGL_SAMPLES 0x3031
  100. #define EGL_SAMPLE_BUFFERS 0x3032
  101. #define EGL_SURFACE_TYPE 0x3033
  102. #define EGL_TRANSPARENT_TYPE 0x3034
  103. #define EGL_TRANSPARENT_BLUE_VALUE 0x3035
  104. #define EGL_TRANSPARENT_GREEN_VALUE 0x3036
  105. #define EGL_TRANSPARENT_RED_VALUE 0x3037
  106. #define EGL_NONE 0x3038 /* Attrib list terminator */
  107. #define EGL_BIND_TO_TEXTURE_RGB 0x3039
  108. #define EGL_BIND_TO_TEXTURE_RGBA 0x303A
  109. #define EGL_MIN_SWAP_INTERVAL 0x303B
  110. #define EGL_MAX_SWAP_INTERVAL 0x303C
  111. #define EGL_LUMINANCE_SIZE 0x303D
  112. #define EGL_ALPHA_MASK_SIZE 0x303E
  113. #define EGL_COLOR_BUFFER_TYPE 0x303F
  114. #define EGL_RENDERABLE_TYPE 0x3040
  115. #define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
  116. #define EGL_CONFORMANT 0x3042
  117. /* Reserved 0x3041-0x304F for additional config attributes */
  118. /* Config attribute values */
  119. #define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
  120. #define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
  121. #define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
  122. #define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
  123. #define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
  124. /* More config attribute values, for EGL_TEXTURE_FORMAT */
  125. #define EGL_NO_TEXTURE 0x305C
  126. #define EGL_TEXTURE_RGB 0x305D
  127. #define EGL_TEXTURE_RGBA 0x305E
  128. #define EGL_TEXTURE_2D 0x305F
  129. /* Config attribute mask bits */
  130. #define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
  131. #define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
  132. #define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
  133. #define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
  134. #define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
  135. #define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
  136. #define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
  137. #define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
  138. #define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
  139. #define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
  140. #define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
  141. /* QueryString targets */
  142. #define EGL_VENDOR 0x3053
  143. #define EGL_VERSION 0x3054
  144. #define EGL_EXTENSIONS 0x3055
  145. #define EGL_CLIENT_APIS 0x308D
  146. /* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
  147. #define EGL_HEIGHT 0x3056
  148. #define EGL_WIDTH 0x3057
  149. #define EGL_LARGEST_PBUFFER 0x3058
  150. #define EGL_TEXTURE_FORMAT 0x3080
  151. #define EGL_TEXTURE_TARGET 0x3081
  152. #define EGL_MIPMAP_TEXTURE 0x3082
  153. #define EGL_MIPMAP_LEVEL 0x3083
  154. #define EGL_RENDER_BUFFER 0x3086
  155. #define EGL_VG_COLORSPACE 0x3087
  156. #define EGL_VG_ALPHA_FORMAT 0x3088
  157. #define EGL_HORIZONTAL_RESOLUTION 0x3090
  158. #define EGL_VERTICAL_RESOLUTION 0x3091
  159. #define EGL_PIXEL_ASPECT_RATIO 0x3092
  160. #define EGL_SWAP_BEHAVIOR 0x3093
  161. #define EGL_MULTISAMPLE_RESOLVE 0x3099
  162. /* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
  163. #define EGL_BACK_BUFFER 0x3084
  164. #define EGL_SINGLE_BUFFER 0x3085
  165. /* OpenVG color spaces */
  166. #define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
  167. #define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
  168. /* OpenVG alpha formats */
  169. #define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
  170. #define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
  171. /* Constant scale factor by which fractional display resolutions &
  172. * aspect ratio are scaled when queried as integer values.
  173. */
  174. #define EGL_DISPLAY_SCALING 10000
  175. /* Unknown display resolution/aspect ratio */
  176. #define EGL_UNKNOWN ((EGLint)-1)
  177. /* Back buffer swap behaviors */
  178. #define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
  179. #define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
  180. /* CreatePbufferFromClientBuffer buffer types */
  181. #define EGL_OPENVG_IMAGE 0x3096
  182. /* QueryContext targets */
  183. #define EGL_CONTEXT_CLIENT_TYPE 0x3097
  184. /* CreateContext attributes */
  185. #define EGL_CONTEXT_CLIENT_VERSION 0x3098
  186. /* Multisample resolution behaviors */
  187. #define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
  188. #define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
  189. /* BindAPI/QueryAPI targets */
  190. #define EGL_OPENGL_ES_API 0x30A0
  191. #define EGL_OPENVG_API 0x30A1
  192. #define EGL_OPENGL_API 0x30A2
  193. /* GetCurrentSurface targets */
  194. #define EGL_DRAW 0x3059
  195. #define EGL_READ 0x305A
  196. /* WaitNative engines */
  197. #define EGL_CORE_NATIVE_ENGINE 0x305B
  198. /* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
  199. #define EGL_COLORSPACE EGL_VG_COLORSPACE
  200. #define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
  201. #define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
  202. #define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
  203. #define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
  204. #define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
  205. /* EGL extensions must request enum blocks from the Khronos
  206. * API Registrar, who maintains the enumerant registry. Submit
  207. * a bug in Khronos Bugzilla against task "Registry".
  208. */
  209. /* EGL Functions */
  210. EGLAPI EGLint EGLAPIENTRY eglGetError(void);
  211. EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
  212. EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
  213. EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
  214. EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
  215. EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
  216. EGLint config_size, EGLint *num_config);
  217. EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
  218. EGLConfig *configs, EGLint config_size,
  219. EGLint *num_config);
  220. EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
  221. EGLint attribute, EGLint *value);
  222. EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
  223. EGLNativeWindowType win,
  224. const EGLint *attrib_list);
  225. EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
  226. const EGLint *attrib_list);
  227. EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
  228. EGLNativePixmapType pixmap,
  229. const EGLint *attrib_list);
  230. EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
  231. EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
  232. EGLint attribute, EGLint *value);
  233. EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
  234. EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
  235. EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
  236. EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
  237. EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
  238. EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
  239. EGLConfig config, const EGLint *attrib_list);
  240. EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
  241. EGLint attribute, EGLint value);
  242. EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
  243. EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
  244. EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
  245. EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
  246. EGLContext share_context,
  247. const EGLint *attrib_list);
  248. EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
  249. EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
  250. EGLSurface read, EGLContext ctx);
  251. EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
  252. EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
  253. EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
  254. EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
  255. EGLint attribute, EGLint *value);
  256. EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
  257. EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
  258. EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
  259. EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
  260. EGLNativePixmapType target);
  261. /* This is a generic function pointer type, whose name indicates it must
  262. * be cast to the proper type *and calling convention* before use.
  263. */
  264. typedef void (*__eglMustCastToProperFunctionPointerType)(void);
  265. /* Now, define eglGetProcAddress using the generic function ptr. type */
  266. EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
  267. eglGetProcAddress(const char *procname);
  268. #ifdef __cplusplus
  269. }
  270. #endif
  271. #endif /* __egl_h_ */