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