Dont call wl_egl_window_resize on every swap

This commit is contained in:
Kovid Goyal 2024-04-24 10:03:35 +05:30
parent 8e59b598e0
commit 8c7994c0ac
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 2 deletions

2
glfw/wl_platform.h vendored
View file

@ -186,7 +186,7 @@ typedef struct _GLFWwindowWayland
} layer_shell;
struct {
int width, height;
int width, height, dirty;
} framebuffer_size_at_last_resize;
/* information about axis events on current frame */
struct

6
glfw/wl_window.c vendored
View file

@ -379,12 +379,16 @@ resizeFramebuffer(_GLFWwindow* window) {
wait_for_swap_to_commit(window);
window->wl.framebuffer_size_at_last_resize.width = scaled_width;
window->wl.framebuffer_size_at_last_resize.height = scaled_height;
window->wl.framebuffer_size_at_last_resize.dirty = true;
_glfwInputFramebufferSize(window, scaled_width, scaled_height);
}
void
_glfwWaylandBeforeBufferSwap(_GLFWwindow* window) {
wl_egl_window_resize(window->wl.native, window->wl.framebuffer_size_at_last_resize.width, window->wl.framebuffer_size_at_last_resize.height, 0, 0);
if (window->wl.framebuffer_size_at_last_resize.dirty) {
wl_egl_window_resize(window->wl.native, window->wl.framebuffer_size_at_last_resize.width, window->wl.framebuffer_size_at_last_resize.height, 0, 0);
window->wl.framebuffer_size_at_last_resize.dirty = false;
}
}
void