os/graphics/egl/eglinterface/include/1.2/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 #include <egl/egltypes.h>
    34 
    35 /*
    36 ** egltypes.h is platform dependent. It defines:
    37 **
    38 **     - EGL types and resources
    39 **     - Native types
    40 **     - EGL and native handle values
    41 **
    42 ** EGL types and resources are to be typedef'ed with appropriate platform
    43 ** dependent resource handle types. EGLint must be an integer of at least
    44 ** 32-bit.
    45 **
    46 ** NativeDisplayType, NativeWindowType and NativePixmapType are to be
    47 ** replaced with corresponding types of the native window system in egl.h.
    48 **
    49 ** EGL and native handle values must match their types.
    50 **
    51 ** Example egltypes.h:
    52 */
    53 
    54 #if 0
    55 
    56 #include <sys/types.h>
    57 #include <native_window_system.h>
    58 
    59 /*
    60 ** Types and resources
    61 */
    62 typedef int EGLBoolean;
    63 typedef int32_t EGLint;
    64 typedef int EGLenum;
    65 typedef void *EGLDisplay;
    66 typedef void *EGLConfig;
    67 typedef void *EGLSurface;
    68 typedef void *EGLContext;
    69 typedef void* EGLClientBuffer;
    70 
    71 /*
    72 ** EGL and native handle values
    73 */
    74 #define EGL_DEFAULT_DISPLAY ((NativeDisplayType)0)
    75 #define EGL_NO_CONTEXT ((EGLContext)0)
    76 #define EGL_NO_DISPLAY ((EGLDisplay)0)
    77 #define EGL_NO_SURFACE ((EGLSurface)0)
    78 
    79 #endif
    80 
    81 /*
    82 ** Versioning and extensions
    83 */
    84 #define EGL_VERSION_1_0                1
    85 #define EGL_VERSION_1_1                1
    86 #define EGL_VERSION_1_2                1
    87 
    88 /*
    89 ** Boolean
    90 */
    91 #define EGL_FALSE                      0
    92 #define EGL_TRUE                       1
    93 
    94 /*
    95 ** Errors
    96 */
    97 #define EGL_SUCCESS                    0x3000
    98 #define EGL_NOT_INITIALIZED            0x3001
    99 #define EGL_BAD_ACCESS                 0x3002
   100 #define EGL_BAD_ALLOC                  0x3003
   101 #define EGL_BAD_ATTRIBUTE              0x3004
   102 #define EGL_BAD_CONFIG                 0x3005
   103 #define EGL_BAD_CONTEXT                0x3006
   104 #define EGL_BAD_CURRENT_SURFACE        0x3007
   105 #define EGL_BAD_DISPLAY                0x3008
   106 #define EGL_BAD_MATCH                  0x3009
   107 #define EGL_BAD_NATIVE_PIXMAP          0x300A
   108 #define EGL_BAD_NATIVE_WINDOW          0x300B
   109 #define EGL_BAD_PARAMETER              0x300C
   110 #define EGL_BAD_SURFACE                0x300D
   111 #define EGL_CONTEXT_LOST               0x300E
   112 /* 0x300F - 0x301F reserved for additional errors. */
   113 
   114 /*
   115 ** Config attributes
   116 */
   117 #define EGL_BUFFER_SIZE                0x3020
   118 #define EGL_ALPHA_SIZE                 0x3021
   119 #define EGL_BLUE_SIZE                  0x3022
   120 #define EGL_GREEN_SIZE                 0x3023
   121 #define EGL_RED_SIZE                   0x3024
   122 #define EGL_DEPTH_SIZE                 0x3025
   123 #define EGL_STENCIL_SIZE               0x3026
   124 #define EGL_CONFIG_CAVEAT              0x3027
   125 #define EGL_CONFIG_ID                  0x3028
   126 #define EGL_LEVEL                      0x3029
   127 #define EGL_MAX_PBUFFER_HEIGHT         0x302A
   128 #define EGL_MAX_PBUFFER_PIXELS         0x302B
   129 #define EGL_MAX_PBUFFER_WIDTH          0x302C
   130 #define EGL_NATIVE_RENDERABLE          0x302D
   131 #define EGL_NATIVE_VISUAL_ID           0x302E
   132 #define EGL_NATIVE_VISUAL_TYPE         0x302F
   133 #define EGL_PRESERVED_RESOURCES        0x3030
   134 #define EGL_SAMPLES                    0x3031
   135 #define EGL_SAMPLE_BUFFERS             0x3032
   136 #define EGL_SURFACE_TYPE               0x3033
   137 #define EGL_TRANSPARENT_TYPE           0x3034
   138 #define EGL_TRANSPARENT_BLUE_VALUE     0x3035
   139 #define EGL_TRANSPARENT_GREEN_VALUE    0x3036
   140 #define EGL_TRANSPARENT_RED_VALUE      0x3037
   141 #define EGL_NONE                       0x3038   /* Also a config value */
   142 #define EGL_BIND_TO_TEXTURE_RGB        0x3039
   143 #define EGL_BIND_TO_TEXTURE_RGBA       0x303A
   144 #define EGL_MIN_SWAP_INTERVAL          0x303B
   145 #define EGL_MAX_SWAP_INTERVAL          0x303C
   146 #define EGL_LUMINANCE_SIZE             0x303D
   147 #define EGL_ALPHA_MASK_SIZE            0x303E
   148 #define EGL_COLOR_BUFFER_TYPE          0x303F
   149 #define EGL_RENDERABLE_TYPE            0x3040
   150 
   151 /*
   152 ** Config values
   153 */
   154 #define EGL_DONT_CARE                  ((EGLint) -1)
   155 
   156 #define EGL_SLOW_CONFIG                0x3050   /* EGL_CONFIG_CAVEAT value */
   157 #define EGL_NON_CONFORMANT_CONFIG      0x3051   /* " */
   158 #define EGL_TRANSPARENT_RGB	           0x3052   /* EGL_TRANSPARENT_TYPE value */
   159 #define EGL_RGB_BUFFER                 0x308E   /* EGL_COLOR_BUFFER_TYPE value */
   160 #define EGL_LUMINANCE_BUFFER           0x308F   /* EGL_COLOR_BUFFER_TYPE value */
   161 #define EGL_NO_TEXTURE                 0x305C   /* EGL_TEXTURE_FORMAT/TARGET value */
   162 #define EGL_TEXTURE_RGB                0x305D   /* EGL_TEXTURE_FORMAT value */
   163 #define EGL_TEXTURE_RGBA               0x305E   /* " */
   164 #define EGL_TEXTURE_2D                 0x305F   /* EGL_TEXTURE_TARGET value */
   165 
   166 /*
   167 ** Config attribute mask bits
   168 */
   169 #define EGL_PBUFFER_BIT                0x01   /* EGL_SURFACE_TYPE mask bits */
   170 #define EGL_PIXMAP_BIT                 0x02   /* EGL_SURFACE_TYPE mask bits */
   171 #define EGL_WINDOW_BIT                 0x04   /* EGL_SURFACE_TYPE mask bits */
   172 #define EGL_OPENGL_ES_BIT              0x01   /* EGL_RENDERABLE_TYPE mask bits */
   173 #define EGL_OPENVG_BIT                 0x02   /* EGL_RENDERABLE_TYPE mask bits */
   174 
   175 /*
   176 ** String names
   177 */
   178 #define EGL_VENDOR                     0x3053
   179 #define EGL_VERSION                    0x3054
   180 #define EGL_EXTENSIONS                 0x3055
   181 #define EGL_CLIENT_APIS                0x308D
   182 
   183 /*
   184 ** Surface attributes
   185 */
   186 #define EGL_HEIGHT                     0x3056
   187 #define EGL_WIDTH                      0x3057
   188 #define EGL_LARGEST_PBUFFER            0x3058
   189 #define EGL_TEXTURE_FORMAT             0x3080   /* For pbuffers bound as textures */
   190 #define EGL_TEXTURE_TARGET             0x3081   /* " */
   191 #define EGL_MIPMAP_TEXTURE             0x3082   /* " */
   192 #define EGL_MIPMAP_LEVEL               0x3083   /* " */
   193 #define EGL_RENDER_BUFFER              0x3086
   194 #define EGL_COLORSPACE                 0x3087
   195 #define EGL_ALPHA_FORMAT               0x3088
   196 #define EGL_HORIZONTAL_RESOLUTION      0x3090
   197 #define EGL_VERTICAL_RESOLUTION        0x3091
   198 #define EGL_PIXEL_ASPECT_RATIO         0x3092
   199 #define EGL_SWAP_BEHAVIOR              0x3093
   200 
   201 /* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
   202 #define EGL_BACK_BUFFER                0x3084
   203 #define EGL_SINGLE_BUFFER              0x3085
   204 
   205 /* OpenVG color spaces */
   206 #define EGL_COLORSPACE_sRGB            0x3089   /* EGL_COLORSPACE value */
   207 #define EGL_COLORSPACE_LINEAR          0x308A   /* EGL_COLORSPACE value */
   208 
   209 /* OpenVG alpha formats */
   210 #define EGL_ALPHA_FORMAT_NONPRE        0x308B   /* EGL_ALPHA_FORMAT value */
   211 #define EGL_ALPHA_FORMAT_PRE           0x308C   /* EGL_ALPHA_FORMAT value */
   212 
   213 /* Constant scale factor by which fractional display resolutions &
   214  * aspect ratio are scaled when queried as integer values.
   215  */
   216 #define EGL_DISPLAY_SCALING            10000
   217 
   218 /* Unknown display resolution/aspect ratio */
   219 #define EGL_UNKNOWN                    ((EGLint)-1)
   220 
   221 /* Back buffer swap behaviors */
   222 #define EGL_BUFFER_PRESERVED           0x3094   /* EGL_SWAP_BEHAVIOR value */
   223 #define EGL_BUFFER_DESTROYED           0x3095   /* EGL_SWAP_BEHAVIOR value */
   224 
   225 /* CreatePbufferFromClientBuffer buffer types */
   226 #define EGL_OPENVG_IMAGE               0x3096
   227 
   228 /* QueryContext targets */
   229 #define EGL_CONTEXT_CLIENT_TYPE        0x3097
   230 
   231 /* BindAPI/QueryAPI targets */
   232 #define EGL_OPENGL_ES_API              0x30A0
   233 #define EGL_OPENVG_API                 0x30A1
   234 
   235 /*
   236 ** Current surfaces
   237 */
   238 #define EGL_DRAW                       0x3059
   239 #define EGL_READ                       0x305A
   240 
   241 /*
   242 ** Engines
   243 */
   244 #define EGL_CORE_NATIVE_ENGINE         0x305B
   245 
   246 /* 0x305C-0x3FFFF reserved for future use */
   247 
   248 /*
   249 ** Functions
   250 */
   251 #ifdef __cplusplus
   252 extern "C" {
   253 #endif
   254 
   255 EGLAPI EGLint EGL_APIENTRY eglGetError (void);
   256 
   257 EGLAPI EGLDisplay EGL_APIENTRY eglGetDisplay (NativeDisplayType display_id);
   258 EGLAPI EGLBoolean EGL_APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
   259 EGLAPI EGLBoolean EGL_APIENTRY eglTerminate (EGLDisplay dpy);
   260 EGLAPI const char * EGL_APIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
   261 #ifdef __cplusplus
   262 EGLAPI void (* EGL_APIENTRY eglGetProcAddress (const char *procname))(...);
   263 #else
   264 EGLAPI void (* EGL_APIENTRY eglGetProcAddress (const char *procname))();
   265 #endif
   266 
   267 EGLAPI EGLBoolean EGL_APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
   268 EGLAPI EGLBoolean EGL_APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
   269 EGLAPI EGLBoolean EGL_APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
   270 
   271 EGLAPI EGLSurface EGL_APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType win, const EGLint *attrib_list);
   272 EGLAPI EGLSurface EGL_APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
   273 EGLAPI EGLSurface EGL_APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
   274 EGLAPI EGLBoolean EGL_APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
   275 EGLAPI EGLBoolean EGL_APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
   276 
   277 /* EGL 1.1 render-to-texture APIs */
   278 EGLAPI EGLBoolean EGL_APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
   279 EGLAPI EGLBoolean EGL_APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
   280 EGLAPI EGLBoolean EGL_APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
   281 
   282 /* EGL 1.1 swap control API */
   283 EGLAPI EGLBoolean EGL_APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
   284 
   285 EGLAPI EGLContext EGL_APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
   286 EGLAPI EGLBoolean EGL_APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
   287 EGLAPI EGLBoolean EGL_APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
   288 EGLAPI EGLContext EGL_APIENTRY eglGetCurrentContext (void);
   289 EGLAPI EGLSurface EGL_APIENTRY eglGetCurrentSurface (EGLint readdraw);
   290 EGLAPI EGLDisplay EGL_APIENTRY eglGetCurrentDisplay (void);
   291 EGLAPI EGLBoolean EGL_APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
   292 
   293 EGLAPI EGLBoolean EGL_APIENTRY eglWaitGL (void);
   294 EGLAPI EGLBoolean EGL_APIENTRY eglWaitNative (EGLint engine);
   295 EGLAPI EGLBoolean EGL_APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
   296 EGLAPI EGLBoolean EGL_APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
   297 
   298 EGLAPI EGLSurface EGL_APIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
   299 EGLAPI EGLBoolean EGL_APIENTRY eglWaitClient (void);
   300 EGLAPI EGLBoolean EGL_APIENTRY eglBindAPI (EGLenum api);
   301 EGLAPI EGLenum EGL_APIENTRY eglQueryAPI (void);
   302 EGLAPI EGLBoolean EGL_APIENTRY eglReleaseThread (void);
   303 
   304 #ifdef __cplusplus
   305 }
   306 #endif
   307 
   308 #endif /* ___egl_h_ */