Split eglSwapBuffersWithDamage feature detection
Detecting whether eglSwapBuffersWithDamageEXT or eglSwapBuffersWithDamageKHR is used should be based on the extension string, not only on the availability of the function.
This commit is contained in:
parent
9179b438a5
commit
5ec6d8230d
|
@ -22,6 +22,7 @@ struct wlr_egl {
|
||||||
bool dmabuf_import;
|
bool dmabuf_import;
|
||||||
bool image_base;
|
bool image_base;
|
||||||
bool swap_buffers_with_damage;
|
bool swap_buffers_with_damage;
|
||||||
|
bool swap_buffers_with_damage_khr;
|
||||||
} exts;
|
} exts;
|
||||||
|
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
|
|
|
@ -154,7 +154,8 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||||
check_egl_ext(egl->exts_str, "EGL_EXT_buffer_age");
|
check_egl_ext(egl->exts_str, "EGL_EXT_buffer_age");
|
||||||
egl->exts.swap_buffers_with_damage =
|
egl->exts.swap_buffers_with_damage =
|
||||||
(check_egl_ext(egl->exts_str, "EGL_EXT_swap_buffers_with_damage") &&
|
(check_egl_ext(egl->exts_str, "EGL_EXT_swap_buffers_with_damage") &&
|
||||||
eglSwapBuffersWithDamageEXT) ||
|
eglSwapBuffersWithDamageEXT);
|
||||||
|
egl->exts.swap_buffers_with_damage_khr =
|
||||||
(check_egl_ext(egl->exts_str, "EGL_KHR_swap_buffers_with_damage") &&
|
(check_egl_ext(egl->exts_str, "EGL_KHR_swap_buffers_with_damage") &&
|
||||||
eglSwapBuffersWithDamageKHR);
|
eglSwapBuffersWithDamageKHR);
|
||||||
|
|
||||||
|
@ -313,7 +314,8 @@ bool wlr_egl_is_current(struct wlr_egl *egl) {
|
||||||
bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
|
bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
|
||||||
pixman_region32_t *damage) {
|
pixman_region32_t *damage) {
|
||||||
EGLBoolean ret;
|
EGLBoolean ret;
|
||||||
if (damage != NULL && egl->exts.swap_buffers_with_damage) {
|
if (damage != NULL && (egl->exts.swap_buffers_with_damage ||
|
||||||
|
egl->exts.swap_buffers_with_damage_khr)) {
|
||||||
int nrects;
|
int nrects;
|
||||||
pixman_box32_t *rects =
|
pixman_box32_t *rects =
|
||||||
pixman_region32_rectangles(damage, &nrects);
|
pixman_region32_rectangles(damage, &nrects);
|
||||||
|
@ -325,8 +327,7 @@ bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
|
||||||
egl_damage[4*i + 3] = rects[i].y2 - rects[i].y1;
|
egl_damage[4*i + 3] = rects[i].y2 - rects[i].y1;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(eglSwapBuffersWithDamageEXT || eglSwapBuffersWithDamageKHR);
|
if (egl->exts.swap_buffers_with_damage) {
|
||||||
if (eglSwapBuffersWithDamageEXT) {
|
|
||||||
ret = eglSwapBuffersWithDamageEXT(egl->display, surface, egl_damage,
|
ret = eglSwapBuffersWithDamageEXT(egl->display, surface, egl_damage,
|
||||||
nrects);
|
nrects);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue