1/* Reference egl.h for EGL 1.2 2 * Last modified 2006/10/24 3 */ 4 5#ifndef __egl_h_ 6#define __egl_h_ 7 8/* EGL Types */ 9#include <sys/types.h> 10 11typedef int32_t EGLint; 12typedef unsigned int EGLBoolean; 13typedef void *EGLConfig; 14typedef void *EGLContext; 15typedef void *EGLDisplay; 16typedef void *EGLSurface; 17 18/* Define NativeDisplayType, NativeWindowType, NativePixmapType in egltypes.h */ 19#include <EGL/egltypes.h> 20 21/* EGL Versioning */ 22#define EGL_VERSION_1_0 1 23#define EGL_VERSION_1_1 1 24#define EGL_VERSION_1_2 1 25 26/* EGL Enumerants. Exceptional cases aside, most 27 * enums are assigned unique values starting at 0x3000. 28 */ 29 30/* EGL aliases */ 31#define EGL_FALSE 0 32#define EGL_TRUE 1 33 34/* Out-of-band handle values */ 35/* These values may vary depending on semantics of native concepts */ 36#define EGL_DEFAULT_DISPLAY ((void *)0) 37#define EGL_NO_CONTEXT ((EGLContext)0) 38#define EGL_NO_DISPLAY ((EGLDisplay)0) 39#define EGL_NO_SURFACE ((EGLSurface)0) 40 41/* Out-of-band attribute value */ 42#define EGL_DONT_CARE ((EGLint)-1) 43 44/* Errors / GetError return values */ 45#define EGL_SUCCESS 0x3000 46#define EGL_NOT_INITIALIZED 0x3001 47#define EGL_BAD_ACCESS 0x3002 48#define EGL_BAD_ALLOC 0x3003 49#define EGL_BAD_ATTRIBUTE 0x3004 50#define EGL_BAD_CONFIG 0x3005 51#define EGL_BAD_CONTEXT 0x3006 52#define EGL_BAD_CURRENT_SURFACE 0x3007 53#define EGL_BAD_DISPLAY 0x3008 54#define EGL_BAD_MATCH 0x3009 55#define EGL_BAD_NATIVE_PIXMAP 0x300A 56#define EGL_BAD_NATIVE_WINDOW 0x300B 57#define EGL_BAD_PARAMETER 0x300C 58#define EGL_BAD_SURFACE 0x300D 59#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ 60 61/* Reserved 0x300F-0x301F for additional errors */ 62 63/* Config attributes */ 64#define EGL_BUFFER_SIZE 0x3020 65#define EGL_ALPHA_SIZE 0x3021 66#define EGL_BLUE_SIZE 0x3022 67#define EGL_GREEN_SIZE 0x3023 68#define EGL_RED_SIZE 0x3024 69#define EGL_DEPTH_SIZE 0x3025 70#define EGL_STENCIL_SIZE 0x3026 71#define EGL_CONFIG_CAVEAT 0x3027 72#define EGL_CONFIG_ID 0x3028 73#define EGL_LEVEL 0x3029 74#define EGL_MAX_PBUFFER_HEIGHT 0x302A 75#define EGL_MAX_PBUFFER_PIXELS 0x302B 76#define EGL_MAX_PBUFFER_WIDTH 0x302C 77#define EGL_NATIVE_RENDERABLE 0x302D 78#define EGL_NATIVE_VISUAL_ID 0x302E 79#define EGL_NATIVE_VISUAL_TYPE 0x302F 80#define EGL_PRESERVED_RESOURCES 0x3030 81#define EGL_SAMPLES 0x3031 82#define EGL_SAMPLE_BUFFERS 0x3032 83#define EGL_SURFACE_TYPE 0x3033 84#define EGL_TRANSPARENT_TYPE 0x3034 85#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 86#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 87#define EGL_TRANSPARENT_RED_VALUE 0x3037 88#define EGL_NONE 0x3038 /* Attrib list terminator */ 89#define EGL_BIND_TO_TEXTURE_RGB 0x3039 90#define EGL_BIND_TO_TEXTURE_RGBA 0x303A 91#define EGL_MIN_SWAP_INTERVAL 0x303B 92#define EGL_MAX_SWAP_INTERVAL 0x303C 93#define EGL_LUMINANCE_SIZE 0x303D 94#define EGL_ALPHA_MASK_SIZE 0x303E 95#define EGL_COLOR_BUFFER_TYPE 0x303F 96#define EGL_RENDERABLE_TYPE 0x3040 97 98/* Reserved 0x3041-0x304F for additional config attributes */ 99 100/* Config attribute values */ 101#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ 102#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ 103#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ 104#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ 105#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ 106 107/* More config attribute values, for EGL_TEXTURE_FORMAT */ 108#define EGL_NO_TEXTURE 0x305C 109#define EGL_TEXTURE_RGB 0x305D 110#define EGL_TEXTURE_RGBA 0x305E 111#define EGL_TEXTURE_2D 0x305F 112 113/* Config attribute mask bits */ 114#define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bits */ 115#define EGL_PIXMAP_BIT 0x02 /* EGL_SURFACE_TYPE mask bits */ 116#define EGL_WINDOW_BIT 0x04 /* EGL_SURFACE_TYPE mask bits */ 117#define EGL_OPENGL_ES_BIT 0x01 /* EGL_RENDERABLE_TYPE mask bits */ 118#define EGL_OPENVG_BIT 0x02 /* EGL_RENDERABLE_TYPE mask bits */ 119 120/* QueryString targets */ 121#define EGL_VENDOR 0x3053 122#define EGL_VERSION 0x3054 123#define EGL_EXTENSIONS 0x3055 124#define EGL_CLIENT_APIS 0x308D 125 126/* QuerySurface / CreatePbufferSurface targets */ 127#define EGL_HEIGHT 0x3056 128#define EGL_WIDTH 0x3057 129#define EGL_LARGEST_PBUFFER 0x3058 130#define EGL_TEXTURE_FORMAT 0x3080 131#define EGL_TEXTURE_TARGET 0x3081 132#define EGL_MIPMAP_TEXTURE 0x3082 133#define EGL_MIPMAP_LEVEL 0x3083 134#define EGL_RENDER_BUFFER 0x3086 135#define EGL_COLORSPACE 0x3087 136#define EGL_ALPHA_FORMAT 0x3088 137#define EGL_HORIZONTAL_RESOLUTION 0x3090 138#define EGL_VERTICAL_RESOLUTION 0x3091 139#define EGL_PIXEL_ASPECT_RATIO 0x3092 140#define EGL_SWAP_BEHAVIOR 0x3093 141 142/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ 143#define EGL_BACK_BUFFER 0x3084 144#define EGL_SINGLE_BUFFER 0x3085 145 146/* OpenVG color spaces */ 147#define EGL_COLORSPACE_sRGB 0x3089 /* EGL_COLORSPACE value */ 148#define EGL_COLORSPACE_LINEAR 0x308A /* EGL_COLORSPACE value */ 149 150/* OpenVG alpha formats */ 151#define EGL_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ 152#define EGL_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ 153 154/* Constant scale factor by which fractional display resolutions & 155 * aspect ratio are scaled when queried as integer values. 156 */ 157#define EGL_DISPLAY_SCALING 10000 158 159/* Unknown display resolution/aspect ratio */ 160#define EGL_UNKNOWN ((EGLint)-1) 161 162/* Back buffer swap behaviors */ 163#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ 164#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ 165 166/* CreatePbufferFromClientBuffer buffer types */ 167#define EGL_OPENVG_IMAGE 0x3096 168 169/* QueryContext targets */ 170#define EGL_CONTEXT_CLIENT_TYPE 0x3097 171 172/* BindAPI/QueryAPI targets */ 173#define EGL_OPENGL_ES_API 0x30A0 174#define EGL_OPENVG_API 0x30A1 175 176/* GetCurrentSurface targets */ 177#define EGL_DRAW 0x3059 178#define EGL_READ 0x305A 179 180/* WaitNative engines */ 181#define EGL_CORE_NATIVE_ENGINE 0x305B 182 183/* EGL extensions must request enum blocks from the OpenGL ARB 184 * Secretary, who maintains the EGL enumerant registry. 185 */ 186 187 188 189/* EGL Functions */ 190 191EGLint eglGetError(); 192 193EGLDisplay eglGetDisplay(NativeDisplayType display_id); 194EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); 195EGLBoolean eglTerminate(EGLDisplay dpy); 196 197const char *eglQueryString(EGLDisplay dpy, EGLint name); 198 199EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, 200 EGLint config_size, EGLint *num_config); 201EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, 202 EGLConfig *configs, EGLint config_size, 203 EGLint *num_config); 204EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, 205 EGLint attribute, EGLint *value); 206 207EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, 208 NativeWindowType win, 209 const EGLint *attrib_list); 210EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, 211 const EGLint *attrib_list); 212EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, 213 NativePixmapType pixmap, 214 const EGLint *attrib_list); 215EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface); 216EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, 217 EGLint attribute, EGLint *value); 218 219EGLBoolean eglBindAPI(EGLenum api); 220EGLenum eglQueryAPI(void); 221 222EGLBoolean eglWaitClient(void); 223 224EGLBoolean eglReleaseThread(void); 225 226EGLSurface eglCreatePbufferFromClientBuffer( 227 EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, 228 EGLConfig config, const EGLint *attrib_list); 229 230EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, 231 EGLint attribute, EGLint value); 232EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); 233EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); 234 235 236EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval); 237 238 239EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, 240 EGLContext share_context, 241 const EGLint *attrib_list); 242EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx); 243EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, 244 EGLSurface read, EGLContext ctx); 245 246EGLContext eglGetCurrentContext(void); 247EGLSurface eglGetCurrentSurface(EGLint readdraw); 248EGLDisplay eglGetCurrentDisplay(void); 249EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, 250 EGLint attribute, EGLint *value); 251 252EGLBoolean eglWaitGL(void); 253EGLBoolean eglWaitNative(EGLint engine); 254EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); 255EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, 256 NativePixmapType target); 257 258void (*eglGetProcAddress(const char *procname))(); 259 260#endif /* __egl_h_ */ 261