You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.0 KiB
76 lines
2.0 KiB
7 years ago
|
#ifndef WLR_EGL_H
|
||
|
#define WLR_EGL_H
|
||
8 years ago
|
|
||
|
#include <EGL/egl.h>
|
||
7 years ago
|
#include <EGL/eglext.h>
|
||
8 years ago
|
#include <stdbool.h>
|
||
|
|
||
|
struct wlr_egl {
|
||
|
EGLDisplay display;
|
||
|
EGLConfig config;
|
||
|
EGLContext context;
|
||
7 years ago
|
|
||
7 years ago
|
PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display;
|
||
|
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window_surface;
|
||
|
|
||
|
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
|
||
|
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
|
||
|
PFNEGLQUERYWAYLANDBUFFERWL eglQueryWaylandBufferWL;
|
||
|
PFNEGLBINDWAYLANDDISPLAYWL eglBindWaylandDisplayWL;
|
||
|
PFNEGLUNBINDWAYLANDDISPLAYWL eglUnbindWaylandDisplayWL;
|
||
|
|
||
7 years ago
|
const char *egl_exts;
|
||
|
const char *gl_exts;
|
||
|
|
||
|
struct wl_display *wl_display;
|
||
8 years ago
|
};
|
||
|
|
||
7 years ago
|
// TODO: Allocate and return a wlr_egl
|
||
7 years ago
|
/**
|
||
|
* Initializes an egl context for the given platform and remote display.
|
||
|
* Will attempt to load all possibly required api functions.
|
||
|
*/
|
||
8 years ago
|
bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *display);
|
||
7 years ago
|
|
||
|
/**
|
||
|
* Frees all related egl resources, makes the context not-current and
|
||
|
* unbinds a bound wayland display.
|
||
|
*/
|
||
8 years ago
|
void wlr_egl_free(struct wlr_egl *egl);
|
||
7 years ago
|
|
||
|
/**
|
||
|
* Binds the given display to the egl instance.
|
||
|
* This will allow clients to create egl surfaces from wayland ones and render to it.
|
||
|
*/
|
||
|
bool wlr_egl_bind_display(struct wlr_egl *egl, struct wl_display *local_display);
|
||
|
|
||
|
/**
|
||
7 years ago
|
* Refer to the eglQueryWaylandBufferWL extension function.
|
||
7 years ago
|
*/
|
||
7 years ago
|
bool wlr_egl_query_buffer(struct wlr_egl *egl, struct wl_resource *buf,
|
||
7 years ago
|
EGLint attrib, EGLint *value);
|
||
|
|
||
|
/**
|
||
|
* Returns a surface for the given native window
|
||
|
* The window must match the remote display the wlr_egl was created with.
|
||
|
*/
|
||
8 years ago
|
EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window);
|
||
|
|
||
7 years ago
|
/**
|
||
|
* Creates an egl image from the given client buffer and attributes.
|
||
|
*/
|
||
7 years ago
|
EGLImageKHR wlr_egl_create_image(struct wlr_egl *egl,
|
||
|
EGLenum target, EGLClientBuffer buffer, const EGLint *attribs);
|
||
7 years ago
|
|
||
|
/**
|
||
|
* Destroys an egl image created with the given wlr_egl.
|
||
|
*/
|
||
7 years ago
|
bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image);
|
||
7 years ago
|
|
||
|
/**
|
||
|
* Returns a string for the last error ocurred with egl.
|
||
|
*/
|
||
|
const char *egl_error(void);
|
||
|
|
||
8 years ago
|
#endif
|