[Bf-blender-cvs] [95a018aa322] blender-v2.83-release: Workbench: Fix unreported bug: garbage viewport when changing AA settings

Clément Foucault noreply at git.blender.org
Fri Apr 17 14:57:51 CEST 2020


Commit: 95a018aa3226f33278090b65dc3a33708323bb6c
Author: Clément Foucault
Date:   Thu Apr 16 18:12:48 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB95a018aa3226f33278090b65dc3a33708323bb6c

Workbench: Fix unreported bug: garbage viewport when changing AA settings

Was caused by uninitialized buffer.

===================================================================

M	source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
M	source/blender/draw/engines/workbench/workbench_private.h

===================================================================

diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
index 094d13fb84c..5c960acbd78 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
@@ -187,6 +187,10 @@ void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata)
     wpd->view_updated = false;
   }
 
+  if (wpd->taa_sample_len > 0 && wpd->valid_history == false) {
+    wpd->taa_sample = 0;
+  }
+
   {
     float persmat[4][4];
     DRW_view_persmat_get(NULL, persmat, false);
@@ -420,6 +424,7 @@ void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
     /* AA disabled. */
     /* Just set sample to 1 to avoid rendering indefinitely. */
     wpd->taa_sample = 1;
+    wpd->valid_history = false;
     return;
   }
 
@@ -432,6 +437,7 @@ void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
   const bool last_sample = wpd->taa_sample + 1 == wpd->taa_sample_len;
   const bool taa_finished = wpd->taa_sample >= wpd->taa_sample_len;
   if (wpd->taa_sample == 0) {
+    wpd->valid_history = true;
     /* In playback mode, we are sure the next redraw will not use the same viewmatrix.
      * In this case no need to save the depth buffer. */
     eGPUFrameBufferBits bits = GPU_COLOR_BIT | (!wpd->is_playback ? GPU_DEPTH_BIT : 0);
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index a5e80f417d3..2191e09bc24 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -267,6 +267,8 @@ typedef struct WORKBENCH_PrivateData {
   float taa_sample_inv;
   /** If the view has been updated and TAA needs to be reset. */
   bool view_updated;
+  /** True if the history buffer contains relevant data and false if it could contain garbage. */
+  bool valid_history;
   /** View */
   struct DRWView *view;
   /** Last projection matrix to see if view is still valid. */



More information about the Bf-blender-cvs mailing list