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:
authorJeroen Bakker <j.bakker@atmind.nl>2020-03-24 17:26:32 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2020-03-24 18:04:09 +0300
commit28c3d952dbde6f1e911360f716cb1cdb65863b5e (patch)
tree44ef77c7c7c503d0810fc43659a0eaa5976e9b1a /source/blender/draw
parentb67b414a85e92171309aba4ac1c73441dfe6be92 (diff)
Fix T74782: WorkBench TAA Artifacts During Painting/Drawing
When the TAA is finished the screen can still be redrawn by other operations without the TAA resets. If that happened the TAA did add a blank sample to the result as the scene wasn't drawn, but the was processed. Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D7226
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_antialiasing.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
index 3050093062f..cbc146bb7fe 100644
--- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
+++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c
@@ -422,6 +422,9 @@ void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
* If TAA accumulation is finished, we only blit the result.
*/
+ 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) {
/* 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. */
@@ -432,9 +435,11 @@ void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
}
}
else {
- /* Accumulate result to the TAA buffer. */
- GPU_framebuffer_bind(fbl->antialiasing_fb);
- DRW_draw_pass(psl->aa_accum_ps);
+ if (!taa_finished) {
+ /* Accumulate result to the TAA buffer. */
+ GPU_framebuffer_bind(fbl->antialiasing_fb);
+ DRW_draw_pass(psl->aa_accum_ps);
+ }
/* Copy back the saved depth buffer for correct overlays. */
GPU_framebuffer_blit(fbl->antialiasing_fb, 0, dfbl->default_fb, 0, GPU_DEPTH_BIT);
if (workbench_in_front_history_needed(vedata)) {
@@ -442,10 +447,10 @@ void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
}
}
- if (!DRW_state_is_image_render() || wpd->taa_sample + 1 == wpd->taa_sample_len) {
+ if (!DRW_state_is_image_render() || last_sample) {
/* After a certain point SMAA is no longer necessary. */
wpd->smaa_mix_factor = 1.0f - clamp_f(wpd->taa_sample / 4.0f, 0.0f, 1.0f);
- wpd->taa_sample_inv = 1.0f / (wpd->taa_sample + 1);
+ wpd->taa_sample_inv = 1.0f / min_ii(wpd->taa_sample + 1, wpd->taa_sample_len);
if (wpd->smaa_mix_factor > 0.0f) {
GPU_framebuffer_bind(fbl->smaa_edge_fb);
@@ -459,7 +464,9 @@ void workbench_antialiasing_draw_pass(WORKBENCH_Data *vedata)
DRW_draw_pass(psl->aa_resolve_ps);
}
- wpd->taa_sample++;
+ if (!taa_finished) {
+ wpd->taa_sample++;
+ }
if (!DRW_state_is_image_render() && wpd->taa_sample < wpd->taa_sample_len) {
DRW_viewport_request_redraw();