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