Fix background image flashing when closing a tab

Ensure the correct vertex array object is bound when calling
draw_bgimage. Before this fix it was order dependent on draw calls.

Fixes #7999
This commit is contained in:
Kovid Goyal
2024-10-28 12:30:03 +05:30
parent 865aa4bc24
commit 8bca84ed66
2 changed files with 4 additions and 2 deletions

View File

@@ -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`) - 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] 0.36.4 [2024-09-27]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -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 background_opacity = w->is_semi_transparent ? w->background_opacity: 1.0f;
float tint_opacity = background_opacity; float tint_opacity = background_opacity;
float tint_premult = background_opacity; float tint_premult = background_opacity;
bind_vertex_array(vao_idx);
if (has_bgimage(w)) { if (has_bgimage(w)) {
glEnable(GL_BLEND); glEnable(GL_BLEND);
BLEND_ONTO_OPAQUE; BLEND_ONTO_OPAQUE;
@@ -1103,7 +1104,6 @@ draw_borders(ssize_t vao_idx, unsigned int num_border_rects, BorderRect *rect_bu
} }
if (num_border_rects) { if (num_border_rects) {
bind_vertex_array(vao_idx);
bind_program(BORDERS_PROGRAM); bind_program(BORDERS_PROGRAM);
if (rect_data_is_dirty) { if (rect_data_is_dirty) {
const size_t sz = sizeof(BorderRect) * num_border_rects; const size_t sz = sizeof(BorderRect) * num_border_rects;
@@ -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; } else { BLEND_ONTO_OPAQUE_WITH_OPAQUE_OUTPUT; }
} }
glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, num_border_rects); glDrawArraysInstanced(GL_TRIANGLE_FAN, 0, 4, num_border_rects);
unbind_vertex_array();
unbind_program(); unbind_program();
} }
unbind_vertex_array();
if (has_bgimage(w)) glDisable(GL_BLEND); if (has_bgimage(w)) glDisable(GL_BLEND);
} }