Merge branch 'gallium-msaa'
[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 #ifdef EGL_NOK_swap_region
80 typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects);
81 #endif
82
83 /**
84 * The API dispatcher jumps through these functions
85 */
86 struct _egl_api
87 {
88 Initialize_t Initialize;
89 Terminate_t Terminate;
90
91 GetConfigs_t GetConfigs;
92 ChooseConfig_t ChooseConfig;
93 GetConfigAttrib_t GetConfigAttrib;
94
95 CreateContext_t CreateContext;
96 DestroyContext_t DestroyContext;
97 MakeCurrent_t MakeCurrent;
98 QueryContext_t QueryContext;
99
100 CreateWindowSurface_t CreateWindowSurface;
101 CreatePixmapSurface_t CreatePixmapSurface;
102 CreatePbufferSurface_t CreatePbufferSurface;
103 DestroySurface_t DestroySurface;
104 QuerySurface_t QuerySurface;
105 SurfaceAttrib_t SurfaceAttrib;
106 BindTexImage_t BindTexImage;
107 ReleaseTexImage_t ReleaseTexImage;
108 SwapInterval_t SwapInterval;
109 SwapBuffers_t SwapBuffers;
110 CopyBuffers_t CopyBuffers;
111
112 QueryString_t QueryString;
113 WaitClient_t WaitClient;
114 WaitNative_t WaitNative;
115 GetProcAddress_t GetProcAddress;
116
117 #ifdef EGL_MESA_screen_surface
118 ChooseModeMESA_t ChooseModeMESA;
119 GetModesMESA_t GetModesMESA;
120 GetModeAttribMESA_t GetModeAttribMESA;
121 CopyContextMESA_t CopyContextMESA;
122 GetScreensMESA_t GetScreensMESA;
123 CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
124 ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA;
125 ScreenPositionMESA_t ScreenPositionMESA;
126 QueryScreenMESA_t QueryScreenMESA;
127 QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
128 QueryScreenModeMESA_t QueryScreenModeMESA;
129 QueryModeStringMESA_t QueryModeStringMESA;
130 #endif /* EGL_MESA_screen_surface */
131
132 #ifdef EGL_VERSION_1_2
133 CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
134 #endif
135
136 #ifdef EGL_KHR_image_base
137 CreateImageKHR_t CreateImageKHR;
138 DestroyImageKHR_t DestroyImageKHR;
139 #endif /* EGL_KHR_image_base */
140
141 #ifdef EGL_NOK_swap_region
142 SwapBuffersRegionNOK_t SwapBuffersRegionNOK;
143 #endif
144 };
145
146 #endif /* EGLAPI_INCLUDED */