Merge branch 'glsl2'
[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, EGLint *major, EGLint *minor);
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 /**
94 * The API dispatcher jumps through these functions
95 */
96 struct _egl_api
97 {
98 Initialize_t Initialize;
99 Terminate_t Terminate;
100
101 GetConfigs_t GetConfigs;
102 ChooseConfig_t ChooseConfig;
103 GetConfigAttrib_t GetConfigAttrib;
104
105 CreateContext_t CreateContext;
106 DestroyContext_t DestroyContext;
107 MakeCurrent_t MakeCurrent;
108 QueryContext_t QueryContext;
109
110 CreateWindowSurface_t CreateWindowSurface;
111 CreatePixmapSurface_t CreatePixmapSurface;
112 CreatePbufferSurface_t CreatePbufferSurface;
113 DestroySurface_t DestroySurface;
114 QuerySurface_t QuerySurface;
115 SurfaceAttrib_t SurfaceAttrib;
116 BindTexImage_t BindTexImage;
117 ReleaseTexImage_t ReleaseTexImage;
118 SwapInterval_t SwapInterval;
119 SwapBuffers_t SwapBuffers;
120 CopyBuffers_t CopyBuffers;
121
122 QueryString_t QueryString;
123 WaitClient_t WaitClient;
124 WaitNative_t WaitNative;
125 GetProcAddress_t GetProcAddress;
126
127 #ifdef EGL_MESA_screen_surface
128 ChooseModeMESA_t ChooseModeMESA;
129 GetModesMESA_t GetModesMESA;
130 GetModeAttribMESA_t GetModeAttribMESA;
131 CopyContextMESA_t CopyContextMESA;
132 GetScreensMESA_t GetScreensMESA;
133 CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
134 ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA;
135 ScreenPositionMESA_t ScreenPositionMESA;
136 QueryScreenMESA_t QueryScreenMESA;
137 QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
138 QueryScreenModeMESA_t QueryScreenModeMESA;
139 QueryModeStringMESA_t QueryModeStringMESA;
140 #endif /* EGL_MESA_screen_surface */
141
142 #ifdef EGL_VERSION_1_2
143 CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
144 #endif
145
146 #ifdef EGL_KHR_image_base
147 CreateImageKHR_t CreateImageKHR;
148 DestroyImageKHR_t DestroyImageKHR;
149 #endif /* EGL_KHR_image_base */
150
151 #ifdef EGL_KHR_reusable_sync
152 CreateSyncKHR_t CreateSyncKHR;
153 DestroySyncKHR_t DestroySyncKHR;
154 ClientWaitSyncKHR_t ClientWaitSyncKHR;
155 SignalSyncKHR_t SignalSyncKHR;
156 GetSyncAttribKHR_t GetSyncAttribKHR;
157 #endif /* EGL_KHR_reusable_sync */
158
159 #ifdef EGL_NOK_swap_region
160 SwapBuffersRegionNOK_t SwapBuffersRegionNOK;
161 #endif
162 };
163
164 #endif /* EGLAPI_INCLUDED */