st/xa: Fix crosscompile builds with nonstandard ld locations
[mesa.git] / src / egl / main / eglapi.h
1 #ifndef EGLAPI_INCLUDED
2 #define EGLAPI_INCLUDED
3
4 /**
5 * A generic function ptr type
6 */
7 typedef void (*_EGLProc)(void);
8
9
10 /**
11 * Typedefs for all EGL API entrypoint functions.
12 */
13
14 /* driver funcs */
15 typedef EGLBoolean (*Initialize_t)(_EGLDriver *, _EGLDisplay *dpy);
16 typedef EGLBoolean (*Terminate_t)(_EGLDriver *, _EGLDisplay *dpy);
17
18 /* config funcs */
19 typedef EGLBoolean (*GetConfigs_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
20 typedef EGLBoolean (*ChooseConfig_t)(_EGLDriver *drv, _EGLDisplay *dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
21 typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLint attribute, EGLint *value);
22
23 /* context funcs */
24 typedef _EGLContext *(*CreateContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, _EGLContext *share_list, const EGLint *attrib_list);
25 typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
26 /* this is the only function (other than Initialize) that may be called with an uninitialized display */
27 typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx);
28 typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value);
29
30 /* surface funcs */
31 typedef _EGLSurface *(*CreateWindowSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativeWindowType window, const EGLint *attrib_list);
32 typedef _EGLSurface *(*CreatePixmapSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
33 typedef _EGLSurface *(*CreatePbufferSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list);
34 typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
35 typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint *value);
36 typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint value);
37 typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
38 typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
39 typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
40 typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
41 typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLNativePixmapType target);
42
43 /* misc funcs */
44 typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
45 typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
46 typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine);
47
48 /* this function may be called from multiple threads at the same time */
49 typedef _EGLProc (*GetProcAddress_t)(_EGLDriver *drv, const char *procname);
50
51
52
53 #ifdef EGL_MESA_screen_surface
54 typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
55 typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
56 typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode, EGLint attribute, EGLint *value);
57 typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *source, _EGLContext *dest, EGLint mask);
58 typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
59 typedef _EGLSurface *(*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list);
60 typedef EGLBoolean (*ShowScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface *surface, _EGLMode *mode);
61 typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint x, EGLint y);
62 typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint attribute, EGLint *value);
63 typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface **surface);
64 typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLMode **mode);
65 typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode);
66 #endif /* EGL_MESA_screen_surface */
67
68
69 #ifdef EGL_VERSION_1_2
70 typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum buftype, EGLClientBuffer buffer, _EGLConfig *config, const EGLint *attrib_list);
71 #endif /* EGL_VERSION_1_2 */
72
73
74 #ifdef EGL_KHR_image_base
75 typedef _EGLImage *(*CreateImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list);
76 typedef EGLBoolean (*DestroyImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
77 #endif /* EGL_KHR_image_base */
78
79
80 #ifdef EGL_KHR_reusable_sync
81 typedef _EGLSync *(*CreateSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum type, const EGLint *attrib_list);
82 typedef EGLBoolean (*DestroySyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync);
83 typedef EGLint (*ClientWaitSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint flags, EGLTimeKHR timeout);
84 typedef EGLBoolean (*SignalSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLenum mode);
85 typedef EGLBoolean (*GetSyncAttribKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint attribute, EGLint *value);
86 #endif /* EGL_KHR_reusable_sync */
87
88
89 #ifdef EGL_NOK_swap_region
90 typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects);
91 #endif
92
93 #ifdef EGL_MESA_drm_image
94 typedef _EGLImage *(*CreateDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attr_list);
95 typedef EGLBoolean (*ExportDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *name, EGLint *handle, EGLint *stride);
96 #endif
97
98 #ifdef EGL_WL_bind_wayland_display
99 struct wl_display;
100 typedef EGLBoolean (*BindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display);
101 typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display);
102 #endif
103
104 /**
105 * The API dispatcher jumps through these functions
106 */
107 struct _egl_api
108 {
109 Initialize_t Initialize;
110 Terminate_t Terminate;
111
112 GetConfigs_t GetConfigs;
113 ChooseConfig_t ChooseConfig;
114 GetConfigAttrib_t GetConfigAttrib;
115
116 CreateContext_t CreateContext;
117 DestroyContext_t DestroyContext;
118 MakeCurrent_t MakeCurrent;
119 QueryContext_t QueryContext;
120
121 CreateWindowSurface_t CreateWindowSurface;
122 CreatePixmapSurface_t CreatePixmapSurface;
123 CreatePbufferSurface_t CreatePbufferSurface;
124 DestroySurface_t DestroySurface;
125 QuerySurface_t QuerySurface;
126 SurfaceAttrib_t SurfaceAttrib;
127 BindTexImage_t BindTexImage;
128 ReleaseTexImage_t ReleaseTexImage;
129 SwapInterval_t SwapInterval;
130 SwapBuffers_t SwapBuffers;
131 CopyBuffers_t CopyBuffers;
132
133 QueryString_t QueryString;
134 WaitClient_t WaitClient;
135 WaitNative_t WaitNative;
136 GetProcAddress_t GetProcAddress;
137
138 #ifdef EGL_MESA_screen_surface
139 ChooseModeMESA_t ChooseModeMESA;
140 GetModesMESA_t GetModesMESA;
141 GetModeAttribMESA_t GetModeAttribMESA;
142 CopyContextMESA_t CopyContextMESA;
143 GetScreensMESA_t GetScreensMESA;
144 CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
145 ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA;
146 ScreenPositionMESA_t ScreenPositionMESA;
147 QueryScreenMESA_t QueryScreenMESA;
148 QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
149 QueryScreenModeMESA_t QueryScreenModeMESA;
150 QueryModeStringMESA_t QueryModeStringMESA;
151 #endif /* EGL_MESA_screen_surface */
152
153 #ifdef EGL_VERSION_1_2
154 CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
155 #endif
156
157 #ifdef EGL_KHR_image_base
158 CreateImageKHR_t CreateImageKHR;
159 DestroyImageKHR_t DestroyImageKHR;
160 #endif /* EGL_KHR_image_base */
161
162 #ifdef EGL_KHR_reusable_sync
163 CreateSyncKHR_t CreateSyncKHR;
164 DestroySyncKHR_t DestroySyncKHR;
165 ClientWaitSyncKHR_t ClientWaitSyncKHR;
166 SignalSyncKHR_t SignalSyncKHR;
167 GetSyncAttribKHR_t GetSyncAttribKHR;
168 #endif /* EGL_KHR_reusable_sync */
169
170 #ifdef EGL_NOK_swap_region
171 SwapBuffersRegionNOK_t SwapBuffersRegionNOK;
172 #endif
173
174 #ifdef EGL_MESA_drm_image
175 CreateDRMImageMESA_t CreateDRMImageMESA;
176 ExportDRMImageMESA_t ExportDRMImageMESA;
177 #endif
178
179 #ifdef EGL_WL_bind_wayland_display
180 BindWaylandDisplayWL_t BindWaylandDisplayWL;
181 UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL;
182 #endif
183 };
184
185 #endif /* EGLAPI_INCLUDED */