diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-07-23 16:14:56 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-08-12 09:45:57 +0300 |
commit | b7a72778ecf3ea1de54e3a864ae0e37ab65d0b0c (patch) | |
tree | b7b622957a174675705c80c3a38ce83886a000bb | |
parent | 287d5e8305c2899578ba21a541cc2745bc7a5dcf (diff) |
Fix interface artifacts on Intel GPUs
This is a continuation of fix for T78307. Turns out instancing do not
work at all, so enforce single widget drawing on macOS and Intel GPU.
It was also reported that certain AMD and Mesa driver suffer from
similar issue, so disabled instancing for this configuration as well.
Differential Revision: https://developer.blender.org/D8374
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index ed0f50f4113..c3347eb414f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -51,6 +51,7 @@ #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" +#include "GPU_platform.h" #include "GPU_state.h" #ifdef WITH_INPUT_IME @@ -1374,6 +1375,26 @@ void UI_widgetbase_draw_cache_end(void) GPU_blend(false); } +/* Disable cached/instanced drawing and enforce single widget drawing pipeline. + * Works around interface artifacts happening on certain driver and hardware + * configurations. */ +static bool draw_widgetbase_batch_skip_draw_cache(void) +{ + /* MacOS is known to have issues on Mac Mini and MacBook Pro with Intel Iris GPU. + * For example, T78307. */ + if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY)) { + return true; + } + + /* There are also reports that some AMD and Mesa driver configuration suffer from the + * same issue, T78803. */ + if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { + return true; + } + + return false; +} + static void draw_widgetbase_batch(GPUBatch *batch, uiWidgetBase *wtb) { wtb->uniform_params.tria1_size = wtb->tria1.size; @@ -1381,7 +1402,7 @@ static void draw_widgetbase_batch(GPUBatch *batch, uiWidgetBase *wtb) copy_v2_v2(wtb->uniform_params.tria1_center, wtb->tria1.center); copy_v2_v2(wtb->uniform_params.tria2_center, wtb->tria2.center); - if (g_widget_base_batch.enabled) { + if (g_widget_base_batch.enabled && !draw_widgetbase_batch_skip_draw_cache()) { if (g_widget_base_batch.batch == NULL) { g_widget_base_batch.batch = ui_batch_roundbox_widget_get(ROUNDBOX_TRIA_ARROWS); } |