Workbench: Fix TAA logic

Having both TAA and FXAA enabled at the same time resulted in conflicts.
The jitter_index was incremented twice before being used instead of once.
This commit is contained in:
Clément Foucault 2019-05-21 10:07:41 +02:00
parent 774022260a
commit 657165db94
3 changed files with 7 additions and 4 deletions

View File

@ -49,6 +49,7 @@ void workbench_aa_create_pass(WORKBENCH_Data *vedata, GPUTexture **tx)
}
else {
psl->effect_aa_pass = NULL;
effect_info->jitter_index = 0;
}
}

View File

@ -243,7 +243,7 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata)
const int jitter_index = effect_info->jitter_index;
const float *transform_offset = samples[jitter_index];
effect_info->taa_mix_factor = 1.0f / (effect_info->jitter_index + 1);
effect_info->taa_mix_factor = 1.0f / (jitter_index + 1);
effect_info->jitter_index = (jitter_index + 1) % num_samples;
/* construct new matrices from transform delta */

View File

@ -326,7 +326,8 @@ BLI_INLINE bool workbench_is_taa_enabled(WORKBENCH_PrivateData *wpd)
}
}
else {
return wpd->preferences->viewport_aa > SCE_DISPLAY_AA_FXAA && !wpd->is_playback;
return !(IS_NAVIGATING(wpd) || wpd->is_playback) &&
wpd->preferences->viewport_aa > SCE_DISPLAY_AA_FXAA;
}
}
@ -346,8 +347,9 @@ BLI_INLINE bool workbench_is_fxaa_enabled(WORKBENCH_PrivateData *wpd)
return true;
}
/* when navigating or animation playback use FXAA. */
return (IS_NAVIGATING(wpd) || wpd->is_playback) && workbench_is_taa_enabled(wpd);
/* when navigating or animation playback use FXAA if scene uses TAA. */
return (IS_NAVIGATING(wpd) || wpd->is_playback) &&
wpd->preferences->viewport_aa > SCE_DISPLAY_AA_FXAA;
}
}