Skip to content

Commit

Permalink
Fix background image flashing when closing a tab
Browse files Browse the repository at this point in the history
Ensure the correct vertex array object is bound when calling
draw_bgimage. Before this fix it was order dependent on draw calls.

Fixes #7999
  • Loading branch information
kovidgoyal committed Oct 28, 2024
1 parent 865aa4b commit 8bca84e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Detailed list of changes

- Wayland: Fix :opt:`background_opacity` less than one causing flicker on startup when the Wayland compositor supports single pixel buffers (:iss:`7987`)

- Fix background image flashing when closing a tab (:iss:`7999`)

0.36.4 [2024-09-27]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions kitty/shaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,7 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
float background_opacity = w->is_semi_transparent ? w->background_opacity: 1.0f;
float tint_opacity = background_opacity;
float tint_premult = background_opacity;
bind_vertex_array(vao_idx);
if (has_bgimage(w)) {
glEnable(GL_BLEND);
BLEND_ONTO_OPAQUE;
Expand All @@ -1103,7 +1104,6 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
}

if (num_border_rects) {
bind_vertex_array(vao_idx);
bind_program(BORDERS_PROGRAM);
if (rect_data_is_dirty) {
const size_t sz = sizeof(BorderRect) * num_border_rects;
Expand All @@ -1127,9 +1127,9 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
else { BLEND_ONTO_OPAQUE_WITH_OPAQUE_OUTPUT; }
}
glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, num_border_rects);
unbind_vertex_array();
unbind_program();
}
unbind_vertex_array();
if (has_bgimage(w)) glDisable(GL_BLEND);
}

Expand Down

0 comments on commit 8bca84e

Please sign in to comment.