Apparently NVIDIA drivers dont handle this well. Sigh.

Go back to calling wl_egl_window_resize() before resizing the
framebuffer instead of before swapping in the resized framebuffer.
Logically, these should be equivalent, but...

Wayland is such an ongoing disaster.

Fixes #7493 (I hope).
This commit is contained in:
Kovid Goyal 2024-06-02 19:24:00 +05:30
parent 06a45dcf36
commit 88aa4d1de3
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 5 additions and 17 deletions

3
glfw/context.c vendored
View file

@ -476,9 +476,6 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
return;
}
#ifdef _GLFW_WAYLAND
_glfwWaylandBeforeBufferSwap(window);
#endif
window->context.swapBuffers(window);
#ifdef _GLFW_WAYLAND
_glfwWaylandAfterBufferSwap(window);

3
glfw/wl_platform.h vendored
View file

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

16
glfw/wl_window.c vendored
View file

@ -370,27 +370,21 @@ wait_for_swap_to_commit(_GLFWwindow *window) {
static void
resizeFramebuffer(_GLFWwindow* window) {
GLFWwindow *ctx = glfwGetCurrentContext();
const bool ctx_changed = ctx != (GLFWwindow*)window;
if (ctx_changed) glfwMakeContextCurrent((GLFWwindow*)window);
double scale = _glfwWaylandWindowScale(window);
int scaled_width = (int)round(window->wl.width * scale);
int scaled_height = (int)round(window->wl.height * scale);
debug("Resizing framebuffer of window: %llu to: %dx%d window size: %dx%d at scale: %.3f\n",
window->id, scaled_width, scaled_height, window->wl.width, window->wl.height, scale);
wl_egl_window_resize(window->wl.native, scaled_width, scaled_height, 0, 0);
update_regions(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;
if (ctx_changed) glfwMakeContextCurrent(ctx);
_glfwInputFramebufferSize(window, scaled_width, scaled_height);
}
void
_glfwWaylandBeforeBufferSwap(_GLFWwindow* window) {
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
_glfwWaylandAfterBufferSwap(_GLFWwindow* window) {
if (window->wl.temp_buffer_used_during_window_creation) {