Fix #147168: BLF: Glitchy status bar display
This seems to be a Mesa driver error. Discarding the buffer before the area drawing fixes the issue. Given this is an expensive operation, we try to only do it where it is needed. Pull Request: https://projects.blender.org/blender/blender/pulls/147733
This commit is contained in:
committed by
Clément Foucault
parent
f79165eb7c
commit
4c97ac9a27
@@ -175,6 +175,10 @@ void BLF_batch_draw_begin();
|
||||
void BLF_batch_draw_flush();
|
||||
void BLF_batch_draw_end();
|
||||
|
||||
/* Discard any batching in process and restart.
|
||||
* Only used as a workaround for glitchy driver sync. */
|
||||
void BLF_batch_discard();
|
||||
|
||||
/**
|
||||
* Draw the string using the current font.
|
||||
*/
|
||||
|
||||
@@ -343,6 +343,15 @@ static void blf_batch_draw_end()
|
||||
}
|
||||
}
|
||||
|
||||
void BLF_batch_discard()
|
||||
{
|
||||
if (g_batch.glyph_buf) {
|
||||
GPU_storagebuf_free(g_batch.glyph_buf);
|
||||
}
|
||||
g_batch.glyph_buf = GPU_storagebuf_create_ex(
|
||||
sizeof(g_batch.glyph_data), nullptr, GPU_USAGE_STREAM, __func__);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "GPU_immediate.hh"
|
||||
#include "GPU_immediate_util.hh"
|
||||
#include "GPU_matrix.hh"
|
||||
#include "GPU_platform.hh"
|
||||
#include "GPU_state.hh"
|
||||
|
||||
#include "BLF_api.hh"
|
||||
@@ -3902,6 +3903,13 @@ void ED_region_header_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
/* clear */
|
||||
ED_region_clear(C, region, region_background_color_id(C, region));
|
||||
|
||||
if (GPU_type_matches_ex(GPU_DEVICE_ANY, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE, GPU_BACKEND_OPENGL))
|
||||
{
|
||||
/* WORKAROUND: Driver bug. Fixes invalid glyph being rendered (see #147168). */
|
||||
BLF_batch_discard();
|
||||
}
|
||||
|
||||
region_draw_blocks_in_view2d(C, region);
|
||||
ED_region_draw_overflow_indication(CTX_wm_area(C), region);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user