1 /*
2  * Cogl
3  *
4  * A Low Level GPU Graphics and Utilities API
5  *
6  * Copyright (C) 2010 Intel Corporation.
7  *
8  * Permission is hereby granted, free of charge, to any person
9  * obtaining a copy of this software and associated documentation
10  * files (the "Software"), to deal in the Software without
11  * restriction, including without limitation the rights to use, copy,
12  * modify, merge, publish, distribute, sublicense, and/or sell copies
13  * of the Software, and to permit persons to whom the Software is
14  * furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
23  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26  * SOFTWARE.
27  *
28  *
29  */
30 
31 /* This can be included multiple times with different definitions for
32  * the COGL_WINSYS_FEATURE_* functions.
33  */
34 
35 /* Macro prototypes:
36  * COGL_WINSYS_FEATURE_BEGIN (name, namespaces, extension_names,
37  *                            implied_private_egl_feature_flags)
38  * COGL_WINSYS_FEATURE_FUNCTION (return_type, function_name,
39  *                               (arguments))
40  * ...
41  * COGL_WINSYS_FEATURE_END ()
42  *
43  * Note: You can list multiple namespace and extension names if the
44  * corresponding _FEATURE_FUNCTIONS have the same semantics accross
45  * the different extension variants.
46  *
47  * XXX: NB: Don't add a trailing semicolon when using these macros
48  */
49 
50 COGL_WINSYS_FEATURE_BEGIN (swap_region,
51                            "NOK\0",
52                            "swap_region\0",
53                            COGL_EGL_WINSYS_FEATURE_SWAP_REGION)
54 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglSwapBuffersRegion,
55                               (EGLDisplay dpy,
56                                EGLSurface surface,
57                                EGLint numRects,
58                                const EGLint *rects))
59 COGL_WINSYS_FEATURE_END ()
60 /* XXX: These macros can't handle falling back to looking for
61  * EGL_KHR_image if EGL_KHR_image_base and EGL_KHR_image_pixmap aren't
62  * found... */
63 #ifdef EGL_KHR_image_base
64 COGL_WINSYS_FEATURE_BEGIN (image_base,
65                            "KHR\0",
66                            "image_base\0",
67                            0)
68 COGL_WINSYS_FEATURE_FUNCTION (EGLImageKHR, eglCreateImage,
69                               (EGLDisplay dpy,
70                                EGLContext ctx,
71                                EGLenum target,
72                                EGLClientBuffer buffer,
73                                const EGLint *attrib_list))
74 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglDestroyImage,
75                               (EGLDisplay dpy,
76                                EGLImageKHR image))
77 COGL_WINSYS_FEATURE_END ()
78 #endif
79 COGL_WINSYS_FEATURE_BEGIN (image_pixmap,
80                            "KHR\0",
81                            "image_pixmap\0",
82                            COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_X11_PIXMAP)
83 COGL_WINSYS_FEATURE_END ()
84 #ifdef EGL_WL_bind_wayland_display
85 COGL_WINSYS_FEATURE_BEGIN (bind_wayland_display,
86                            "WL\0",
87                            "bind_wayland_display\0",
88                            COGL_EGL_WINSYS_FEATURE_EGL_IMAGE_FROM_WAYLAND_BUFFER)
89 COGL_WINSYS_FEATURE_FUNCTION (EGLImageKHR, eglBindWaylandDisplay,
90                               (EGLDisplay dpy,
91                                struct wl_display *wayland_display))
92 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglUnbindWaylandDisplay,
93                               (EGLDisplay dpy,
94                                struct wl_display *wayland_display))
95 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglQueryWaylandBuffer,
96                               (EGLDisplay dpy,
97                                struct wl_resource *buffer,
98                                EGLint attribute, EGLint *value))
99 COGL_WINSYS_FEATURE_END ()
100 #endif /* EGL_WL_bind_wayland_display */
101 
102 COGL_WINSYS_FEATURE_BEGIN (create_context,
103                            "KHR\0",
104                            "create_context\0",
105                            COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT)
106 COGL_WINSYS_FEATURE_END ()
107 
108 COGL_WINSYS_FEATURE_BEGIN (buffer_age,
109                            "EXT\0",
110                            "buffer_age\0",
111                            COGL_EGL_WINSYS_FEATURE_BUFFER_AGE)
112 COGL_WINSYS_FEATURE_END ()
113 
114 COGL_WINSYS_FEATURE_BEGIN (swap_buffers_with_damage,
115                            "EXT\0",
116                            "swap_buffers_with_damage\0",
117                            0)
118 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglSwapBuffersWithDamage,
119                               (EGLDisplay dpy,
120                                EGLSurface surface,
121                                const EGLint *rects,
122                                EGLint n_rects))
123 COGL_WINSYS_FEATURE_END ()
124 
125 #if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync)
126 COGL_WINSYS_FEATURE_BEGIN (fence_sync,
127                            "KHR\0",
128                            "fence_sync\0",
129                            COGL_EGL_WINSYS_FEATURE_FENCE_SYNC)
130 COGL_WINSYS_FEATURE_FUNCTION (EGLSyncKHR, eglCreateSync,
131                               (EGLDisplay dpy,
132                                EGLenum type,
133                                const EGLint *attrib_list))
134 COGL_WINSYS_FEATURE_FUNCTION (EGLint, eglClientWaitSync,
135                               (EGLDisplay dpy,
136                                EGLSyncKHR sync,
137                                EGLint flags,
138                                EGLTimeKHR timeout))
139 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglDestroySync,
140                               (EGLDisplay dpy,
141                                EGLSyncKHR sync))
142 COGL_WINSYS_FEATURE_END ()
143 #endif
144 
145 COGL_WINSYS_FEATURE_BEGIN (surfaceless_context,
146                            "KHR\0",
147                            "surfaceless_context\0",
148                            COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT)
149 COGL_WINSYS_FEATURE_END ()
150