From f3c2724b9e546926208df85e46cb55473c48fedb Mon Sep 17 00:00:00 2001 From: Jeroen Bakker <88891617+jeroen-blender@users.noreply.github.com> Date: Thu, 21 Sep 2023 12:39:17 +0200 Subject: [PATCH 1/2] Fix 110976: Sequencer Scope Artifacts on NVIDIA 30/40 Series This PR fixes an issue with the NVIDIA 3000/4000 series cards. The cause is that when blending is turned off and the fragment output has an alpha of 0.0 it seems to internally optimize the fragment away, leading. This is a guess of course. By setting the Alpha to 1.0 for scopes and enabling alpha blending when drawing the meta data text seems to fix the issue. As I am not aware of all the different user setting please review this carefully. --- .../blender/editors/space_sequencer/sequencer_preview_draw.cc | 1 + source/blender/editors/util/ed_draw.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc index 3e859fa020b..0cbd26628cf 100644 --- a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc @@ -197,6 +197,7 @@ static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scop display_ibuf, &scene->view_settings, &scene->display_settings); scope = make_scope_fn(display_ibuf); + IMB_rectfill_alpha(scope, 1.0f); IMB_freeImBuf(display_ibuf); diff --git a/source/blender/editors/util/ed_draw.cc b/source/blender/editors/util/ed_draw.cc index 3e22f812285..11c507e2f99 100644 --- a/source/blender/editors/util/ed_draw.cc +++ b/source/blender/editors/util/ed_draw.cc @@ -869,6 +869,7 @@ void ED_region_image_metadata_draw( GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); + GPU_blend(GPU_BLEND_ALPHA); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); immUnbindProgram(); @@ -880,6 +881,7 @@ void ED_region_image_metadata_draw( metadata_draw_imbuf(ibuf, &rect, blf_mono_font, true); BLF_disable(blf_mono_font, BLF_CLIPPING); + GPU_blend(GPU_BLEND_NONE); } /* *** lower box*** */ @@ -894,6 +896,7 @@ void ED_region_image_metadata_draw( GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); + GPU_blend(GPU_BLEND_ALPHA); immUniformThemeColor(TH_METADATA_BG); immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); immUnbindProgram(); @@ -903,6 +906,7 @@ void ED_region_image_metadata_draw( UI_FontThemeColor(blf_mono_font, TH_METADATA_TEXT); metadata_draw_imbuf(ibuf, &rect, blf_mono_font, false); + GPU_blend(GPU_BLEND_NONE); BLF_disable(blf_mono_font, BLF_CLIPPING); } -- 2.30.2 From ca1c8fb02ff4964aeef3f74aa964ff3206d0a1b5 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Thu, 21 Sep 2023 12:51:52 +0200 Subject: [PATCH 2/2] Equalize top/bottom metadata --- source/blender/editors/util/ed_draw.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/util/ed_draw.cc b/source/blender/editors/util/ed_draw.cc index 11c507e2f99..b4325ffb905 100644 --- a/source/blender/editors/util/ed_draw.cc +++ b/source/blender/editors/util/ed_draw.cc @@ -906,9 +906,9 @@ void ED_region_image_metadata_draw( UI_FontThemeColor(blf_mono_font, TH_METADATA_TEXT); metadata_draw_imbuf(ibuf, &rect, blf_mono_font, false); - GPU_blend(GPU_BLEND_NONE); BLF_disable(blf_mono_font, BLF_CLIPPING); + GPU_blend(GPU_BLEND_NONE); } GPU_matrix_pop(); -- 2.30.2