Fix margins drawn with the wrong viewport with the Vulkan driver

The viewport is driver state shared by all surfaces with Vulkan (and
Metal), unlike OpenGL where it is per context. It was set only when an
OS Window's size changed, so a resize of another OS Window could leave
a stale viewport in place, causing the border/margin rects to be drawn
at the wrong size. Set it every time an OS Window is rendered.

Fixes #10813
This commit is contained in:
Kovid Goyal 2026-11-06 05:12:45 +05:30
parent 0ed517c6b6
commit ea7568d513
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -1207,8 +1207,12 @@ render_os_window(OSWindow *w, monotonic_t now, bool scan_for_animated_images) {
w->render_calls++;
make_os_window_context_current(w);
bool needs_render = w->redraw_count > 0 || w->live_resize.in_progress || global_state.thumbnail_callback.os_window == w->id;
// The viewport is driver state shared by all surfaces with some GPU
// drivers, such as Vulkan, so it must be set for this window every time,
// as it may have been changed while another OS Window was current, for
// example, by a resize of another OS Window.
set_gpu_viewport(w->viewport_width, w->viewport_height);
if (w->viewport_size_dirty) {
set_gpu_viewport(w->viewport_width, w->viewport_height);
w->viewport_size_dirty = false;
needs_render = true;
}