aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2019-04-25 19:35:40 +0300
committerDrew DeVault <sir@cmpwn.com>2019-04-26 10:08:08 -0600
commitd6e250b389b8ea07af1c801b10ecf0b55f758413 (patch)
treeb3b5833eb81ca5a996996c1816b2049e0a07fdeb /render
parent736632ad4ed349bd5aea0c2120977b745325672d (diff)
render/egl: fix swapping with no damage
According to the spec: > If <n_rects> is 0 then <rects> is ignored and the entire > surface is implicitly damaged and the behaviour is equivalent > to calling eglSwapBuffers. When we want to swap with an empty damage region, set the damage to a single empty rectangle.
Diffstat (limited to 'render')
-rw-r--r--render/egl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/render/egl.c b/render/egl.c
index 4785dc9c..22859b16 100644
--- a/render/egl.c
+++ b/render/egl.c
@@ -377,6 +377,14 @@ bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
pixman_region32_fini(&flipped_damage);
+ if (nrects == 0) {
+ // Swapping with no rects is the same as swapping with the entire
+ // surface damaged. To swap with no damage, we set the damage region
+ // to a single empty rectangle.
+ nrects = 1;
+ memset(egl_damage, 0, sizeof(egl_damage));
+ }
+
if (egl->exts.swap_buffers_with_damage_ext) {
ret = eglSwapBuffersWithDamageEXT(egl->display, surface, egl_damage,
nrects);