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 across
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 (EGLBoolean, eglQueryWaylandBuffer,
90                               (EGLDisplay dpy,
91                                struct wl_resource *buffer,
92                                EGLint attribute, EGLint *value))
93 COGL_WINSYS_FEATURE_END ()
94 #endif /* EGL_WL_bind_wayland_display */
95 
96 COGL_WINSYS_FEATURE_BEGIN (create_context,
97                            "KHR\0",
98                            "create_context\0",
99                            COGL_EGL_WINSYS_FEATURE_CREATE_CONTEXT)
100 COGL_WINSYS_FEATURE_END ()
101 
102 COGL_WINSYS_FEATURE_BEGIN (buffer_age,
103                            "EXT\0",
104                            "buffer_age\0",
105                            COGL_EGL_WINSYS_FEATURE_BUFFER_AGE)
106 COGL_WINSYS_FEATURE_END ()
107 
108 COGL_WINSYS_FEATURE_BEGIN (swap_buffers_with_damage,
109                            "EXT\0",
110                            "swap_buffers_with_damage\0",
111                            0)
112 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglSwapBuffersWithDamage,
113                               (EGLDisplay dpy,
114                                EGLSurface surface,
115                                const EGLint *rects,
116                                EGLint n_rects))
117 COGL_WINSYS_FEATURE_END ()
118 
119 #if defined(EGL_KHR_fence_sync) || defined(EGL_KHR_reusable_sync)
120 COGL_WINSYS_FEATURE_BEGIN (fence_sync,
121                            "KHR\0",
122                            "fence_sync\0",
123                            COGL_EGL_WINSYS_FEATURE_FENCE_SYNC)
124 COGL_WINSYS_FEATURE_FUNCTION (EGLSyncKHR, eglCreateSync,
125                               (EGLDisplay dpy,
126                                EGLenum type,
127                                const EGLint *attrib_list))
128 COGL_WINSYS_FEATURE_FUNCTION (EGLint, eglClientWaitSync,
129                               (EGLDisplay dpy,
130                                EGLSyncKHR sync,
131                                EGLint flags,
132                                EGLTimeKHR timeout))
133 COGL_WINSYS_FEATURE_FUNCTION (EGLBoolean, eglDestroySync,
134                               (EGLDisplay dpy,
135                                EGLSyncKHR sync))
136 COGL_WINSYS_FEATURE_END ()
137 #endif
138 
139 COGL_WINSYS_FEATURE_BEGIN (surfaceless_context,
140                            "KHR\0",
141                            "surfaceless_context\0",
142                            COGL_EGL_WINSYS_FEATURE_SURFACELESS_CONTEXT)
143 COGL_WINSYS_FEATURE_END ()
144 
145 COGL_WINSYS_FEATURE_BEGIN (context_priority,
146                            "IMG\0",
147                            "context_priority\0",
148                            COGL_EGL_WINSYS_FEATURE_CONTEXT_PRIORITY)
149 COGL_WINSYS_FEATURE_END ()
150