1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
5 * Copyright 2010-2011 LunarG, Inc.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
28 **************************************************************************/
31 #ifndef EGLAPI_INCLUDED
32 #define EGLAPI_INCLUDED
35 * A generic function ptr type
37 typedef void (*_EGLProc
)(void);
41 * Typedefs for all EGL API entrypoint functions.
45 typedef EGLBoolean (*Initialize_t
)(_EGLDriver
*, _EGLDisplay
*dpy
);
46 typedef EGLBoolean (*Terminate_t
)(_EGLDriver
*, _EGLDisplay
*dpy
);
49 typedef EGLBoolean (*GetConfigs_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
50 typedef EGLBoolean (*ChooseConfig_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, const EGLint
*attrib_list
, EGLConfig
*configs
, EGLint config_size
, EGLint
*num_config
);
51 typedef EGLBoolean (*GetConfigAttrib_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*config
, EGLint attribute
, EGLint
*value
);
54 typedef _EGLContext
*(*CreateContext_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*config
, _EGLContext
*share_list
, const EGLint
*attrib_list
);
55 typedef EGLBoolean (*DestroyContext_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*ctx
);
56 /* this is the only function (other than Initialize) that may be called with an uninitialized display */
57 typedef EGLBoolean (*MakeCurrent_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*draw
, _EGLSurface
*read
, _EGLContext
*ctx
);
58 typedef EGLBoolean (*QueryContext_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*ctx
, EGLint attribute
, EGLint
*value
);
61 typedef _EGLSurface
*(*CreateWindowSurface_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*config
, EGLNativeWindowType window
, const EGLint
*attrib_list
);
62 typedef _EGLSurface
*(*CreatePixmapSurface_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*config
, EGLNativePixmapType pixmap
, const EGLint
*attrib_list
);
63 typedef _EGLSurface
*(*CreatePbufferSurface_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*config
, const EGLint
*attrib_list
);
64 typedef EGLBoolean (*DestroySurface_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*surface
);
65 typedef EGLBoolean (*QuerySurface_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*surface
, EGLint attribute
, EGLint
*value
);
66 typedef EGLBoolean (*SurfaceAttrib_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*surface
, EGLint attribute
, EGLint value
);
67 typedef EGLBoolean (*BindTexImage_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*surface
, EGLint buffer
);
68 typedef EGLBoolean (*ReleaseTexImage_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*surface
, EGLint buffer
);
69 typedef EGLBoolean (*SwapInterval_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*surf
, EGLint interval
);
70 typedef EGLBoolean (*SwapBuffers_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*draw
);
71 typedef EGLBoolean (*CopyBuffers_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSurface
*surface
, EGLNativePixmapType target
);
74 typedef const char *(*QueryString_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLint name
);
75 typedef EGLBoolean (*WaitClient_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*ctx
);
76 typedef EGLBoolean (*WaitNative_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLint engine
);
78 /* this function may be called from multiple threads at the same time */
79 typedef _EGLProc (*GetProcAddress_t
)(_EGLDriver
*drv
, const char *procname
);
83 #ifdef EGL_MESA_screen_surface
84 typedef EGLBoolean (*ChooseModeMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLScreen
*screen
, const EGLint
*attrib_list
, EGLModeMESA
*modes
, EGLint modes_size
, EGLint
*num_modes
);
85 typedef EGLBoolean (*GetModesMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLScreen
*screen
, EGLModeMESA
*modes
, EGLint mode_size
, EGLint
*num_mode
);
86 typedef EGLBoolean (*GetModeAttribMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLMode
*mode
, EGLint attribute
, EGLint
*value
);
87 typedef EGLBoolean (*CopyContextMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*source
, _EGLContext
*dest
, EGLint mask
);
88 typedef EGLBoolean (*GetScreensMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLScreenMESA
*screens
, EGLint max_screens
, EGLint
*num_screens
);
89 typedef _EGLSurface
*(*CreateScreenSurfaceMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLConfig
*config
, const EGLint
*attrib_list
);
90 typedef EGLBoolean (*ShowScreenSurfaceMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLScreen
*screen
, _EGLSurface
*surface
, _EGLMode
*mode
);
91 typedef EGLBoolean (*ScreenPositionMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLScreen
*screen
, EGLint x
, EGLint y
);
92 typedef EGLBoolean (*QueryScreenMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLScreen
*screen
, EGLint attribute
, EGLint
*value
);
93 typedef EGLBoolean (*QueryScreenSurfaceMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLScreen
*screen
, _EGLSurface
**surface
);
94 typedef EGLBoolean (*QueryScreenModeMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLScreen
*screen
, _EGLMode
**mode
);
95 typedef const char * (*QueryModeStringMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLMode
*mode
);
96 #endif /* EGL_MESA_screen_surface */
99 #ifdef EGL_VERSION_1_2
100 typedef _EGLSurface
*(*CreatePbufferFromClientBuffer_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLenum buftype
, EGLClientBuffer buffer
, _EGLConfig
*config
, const EGLint
*attrib_list
);
101 #endif /* EGL_VERSION_1_2 */
104 #ifdef EGL_KHR_image_base
105 typedef _EGLImage
*(*CreateImageKHR_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*ctx
, EGLenum target
, EGLClientBuffer buffer
, const EGLint
*attr_list
);
106 typedef EGLBoolean (*DestroyImageKHR_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLImage
*image
);
107 #endif /* EGL_KHR_image_base */
110 #ifdef EGL_KHR_reusable_sync
111 typedef _EGLSync
*(*CreateSyncKHR_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, EGLenum type
, const EGLint
*attrib_list
);
112 typedef EGLBoolean (*DestroySyncKHR_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSync
*sync
);
113 typedef EGLint (*ClientWaitSyncKHR_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSync
*sync
, EGLint flags
, EGLTimeKHR timeout
);
114 typedef EGLBoolean (*SignalSyncKHR_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSync
*sync
, EGLenum mode
);
115 typedef EGLBoolean (*GetSyncAttribKHR_t
)(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSync
*sync
, EGLint attribute
, EGLint
*value
);
116 #endif /* EGL_KHR_reusable_sync */
119 #ifdef EGL_NOK_swap_region
120 typedef EGLBoolean (*SwapBuffersRegionNOK_t
)(_EGLDriver
*drv
, _EGLDisplay
*disp
, _EGLSurface
*surf
, EGLint numRects
, const EGLint
*rects
);
123 #ifdef EGL_MESA_drm_image
124 typedef _EGLImage
*(*CreateDRMImageMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*disp
, const EGLint
*attr_list
);
125 typedef EGLBoolean (*ExportDRMImageMESA_t
)(_EGLDriver
*drv
, _EGLDisplay
*disp
, _EGLImage
*img
, EGLint
*name
, EGLint
*handle
, EGLint
*stride
);
128 #ifdef EGL_WL_bind_wayland_display
130 typedef EGLBoolean (*BindWaylandDisplayWL_t
)(_EGLDriver
*drv
, _EGLDisplay
*disp
, struct wl_display
*display
);
131 typedef EGLBoolean (*UnbindWaylandDisplayWL_t
)(_EGLDriver
*drv
, _EGLDisplay
*disp
, struct wl_display
*display
);
135 * The API dispatcher jumps through these functions
139 Initialize_t Initialize
;
140 Terminate_t Terminate
;
142 GetConfigs_t GetConfigs
;
143 ChooseConfig_t ChooseConfig
;
144 GetConfigAttrib_t GetConfigAttrib
;
146 CreateContext_t CreateContext
;
147 DestroyContext_t DestroyContext
;
148 MakeCurrent_t MakeCurrent
;
149 QueryContext_t QueryContext
;
151 CreateWindowSurface_t CreateWindowSurface
;
152 CreatePixmapSurface_t CreatePixmapSurface
;
153 CreatePbufferSurface_t CreatePbufferSurface
;
154 DestroySurface_t DestroySurface
;
155 QuerySurface_t QuerySurface
;
156 SurfaceAttrib_t SurfaceAttrib
;
157 BindTexImage_t BindTexImage
;
158 ReleaseTexImage_t ReleaseTexImage
;
159 SwapInterval_t SwapInterval
;
160 SwapBuffers_t SwapBuffers
;
161 CopyBuffers_t CopyBuffers
;
163 QueryString_t QueryString
;
164 WaitClient_t WaitClient
;
165 WaitNative_t WaitNative
;
166 GetProcAddress_t GetProcAddress
;
168 #ifdef EGL_MESA_screen_surface
169 ChooseModeMESA_t ChooseModeMESA
;
170 GetModesMESA_t GetModesMESA
;
171 GetModeAttribMESA_t GetModeAttribMESA
;
172 CopyContextMESA_t CopyContextMESA
;
173 GetScreensMESA_t GetScreensMESA
;
174 CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA
;
175 ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA
;
176 ScreenPositionMESA_t ScreenPositionMESA
;
177 QueryScreenMESA_t QueryScreenMESA
;
178 QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA
;
179 QueryScreenModeMESA_t QueryScreenModeMESA
;
180 QueryModeStringMESA_t QueryModeStringMESA
;
181 #endif /* EGL_MESA_screen_surface */
183 #ifdef EGL_VERSION_1_2
184 CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer
;
187 #ifdef EGL_KHR_image_base
188 CreateImageKHR_t CreateImageKHR
;
189 DestroyImageKHR_t DestroyImageKHR
;
190 #endif /* EGL_KHR_image_base */
192 #ifdef EGL_KHR_reusable_sync
193 CreateSyncKHR_t CreateSyncKHR
;
194 DestroySyncKHR_t DestroySyncKHR
;
195 ClientWaitSyncKHR_t ClientWaitSyncKHR
;
196 SignalSyncKHR_t SignalSyncKHR
;
197 GetSyncAttribKHR_t GetSyncAttribKHR
;
198 #endif /* EGL_KHR_reusable_sync */
200 #ifdef EGL_NOK_swap_region
201 SwapBuffersRegionNOK_t SwapBuffersRegionNOK
;
204 #ifdef EGL_MESA_drm_image
205 CreateDRMImageMESA_t CreateDRMImageMESA
;
206 ExportDRMImageMESA_t ExportDRMImageMESA
;
209 #ifdef EGL_WL_bind_wayland_display
210 BindWaylandDisplayWL_t BindWaylandDisplayWL
;
211 UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL
;
215 #endif /* EGLAPI_INCLUDED */