1 /*
2  * Copyright (c) 2013, NVIDIA CORPORATION.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and/or associated documentation files (the
6  * "Materials"), to deal in the Materials without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Materials, and to
9  * permit persons to whom the Materials are furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * unaltered in all copies or substantial portions of the Materials.
14  * Any additions, deletions, or changes to the original source files
15  * must be clearly indicated in accompanying documentation.
16  *
17  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
24  */
25 
26 #ifndef __LIB_EGL_ABI_PRIV__
27 #define __LIB_EGL_ABI_PRIV__
28 
29 /*
30  * This is a wrapper around libeglabi which defines each vendor's static
31  * dispatch table.  Logically this could differ from the API imports provided
32  * by the vendor, though in practice they are one and the same.
33  */
34 
35 #include "glvnd/libeglabi.h"
36 
37 /*!
38  * This structure stores function pointers for all functions defined in EGL 1.5.
39  */
40 typedef struct __EGLdispatchTableStaticRec {
41     EGLBoolean (* initialize) (EGLDisplay dpy, EGLint *major, EGLint *minor);
42 
43     EGLBoolean (* chooseConfig) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
44     EGLBoolean (* copyBuffers) (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
45     EGLContext (* createContext) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
46     EGLSurface (* createPbufferSurface) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
47     EGLSurface (* createPixmapSurface) (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
48     EGLSurface (* createWindowSurface) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
49     EGLBoolean (* destroyContext) (EGLDisplay dpy, EGLContext ctx);
50     EGLBoolean (* destroySurface) (EGLDisplay dpy, EGLSurface surface);
51     EGLBoolean (* getConfigAttrib) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
52     EGLBoolean (* getConfigs) (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
53     EGLBoolean (* makeCurrent) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
54     EGLBoolean (* queryContext) (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
55     const char *(* queryString) (EGLDisplay dpy, EGLint name);
56     EGLBoolean (* querySurface) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
57     EGLBoolean (* swapBuffers) (EGLDisplay dpy, EGLSurface surface);
58     EGLBoolean (* terminate) (EGLDisplay dpy);
59     EGLBoolean (* waitGL) (void);
60     EGLBoolean (* waitNative) (EGLint engine);
61     EGLBoolean (* bindTexImage) (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
62     EGLBoolean (* releaseTexImage) (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
63     EGLBoolean (* surfaceAttrib) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
64     EGLBoolean (* swapInterval) (EGLDisplay dpy, EGLint interval);
65 
66     EGLBoolean (* bindAPI) (EGLenum api);
67     EGLSurface (* createPbufferFromClientBuffer) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
68     EGLBoolean (* releaseThread) (void);
69     EGLBoolean (* waitClient) (void);
70 
71     EGLint (* getError) (void);
72 
73 #if 0
74     EGLDisplay (* getCurrentDisplay) (void);
75     EGLSurface (* getCurrentSurface) (EGLint readdraw);
76     EGLDisplay (* getDisplay) (EGLNativeDisplayType display_id);
77     EGLContext (* getCurrentContext) (void);
78 #endif
79 
80     // EGL 1.5 functions. A vendor library is not requires to implement these.
81     EGLSync (* createSync) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
82     EGLBoolean (* destroySync) (EGLDisplay dpy, EGLSync sync);
83     EGLint (* clientWaitSync) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
84     EGLBoolean (* getSyncAttrib) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
85     EGLImage (* createImage) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
86     EGLBoolean (* destroyImage) (EGLDisplay dpy, EGLImage image);
87     EGLSurface (* createPlatformWindowSurface) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
88     EGLSurface (* createPlatformPixmapSurface) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
89     EGLBoolean (* waitSync) (EGLDisplay dpy, EGLSync sync, EGLint flags);
90     //EGLDisplay (* getPlatformDisplay) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
91 
92     // Extension functions that libEGL cares about.
93     EGLBoolean (* queryDevicesEXT) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
94     EGLBoolean (* queryDisplayAttrib) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
95 
96 
97     EGLint (* debugMessageControlKHR) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
98     EGLBoolean (* queryDebugKHR) (EGLint attribute, EGLAttrib* value);
99     EGLint (* labelObjectKHR) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
100 } __EGLdispatchTableStatic;
101 
102 #endif
103