diff options
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_effect_antialiasing.c | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_private.h | 2 |
2 files changed, 8 insertions, 0 deletions
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. */ |