Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-04-16 19:12:48 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-04-17 15:57:35 +0300
commit95a018aa3226f33278090b65dc3a33708323bb6c (patch)
tree2859199982280bc5ac4bec1e361c0aeb2385dfb1 /source/blender/draw/engines/workbench
parentadc6659de5d90bbed360e243e4c0a8b65a6754eb (diff)
Workbench: Fix unreported bug: garbage viewport when changing AA settings
Was caused by uninitialized buffer.
Diffstat (limited to 'source/blender/draw/engines/workbench')
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_antialiasing.c6
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h2
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. */