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:
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_temporal_sampling.c')
-rw-r--r--source/blender/draw/engines/eevee/eevee_temporal_sampling.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
index 6cb2d1d3b53..384fb28a776 100644
--- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
+++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c
@@ -297,8 +297,8 @@ void EEVEE_temporal_sampling_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data
psl->taa_resolve = DRW_pass_create("Temporal AA Resolve", DRW_STATE_WRITE_COLOR);
DRWShadingGroup *grp = DRW_shgroup_create(sh, psl->taa_resolve);
- DRW_shgroup_uniform_texture_ref(grp, "colorHistoryBuffer", &txl->color_double_buffer);
- DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", &txl->color);
+ DRW_shgroup_uniform_texture_ref(grp, "colorHistoryBuffer", &txl->taa_history);
+ DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", &effects->source_buffer);
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
if (effects->enabled_effects & EFFECT_TAA_REPROJECT) {
@@ -312,16 +312,6 @@ void EEVEE_temporal_sampling_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data
}
}
-/* Special Swap */
-#define SWAP_BUFFER_TAA() do { \
- SWAP(struct GPUFrameBuffer *, fbl->effect_fb, fbl->double_buffer_fb); \
- SWAP(struct GPUFrameBuffer *, fbl->effect_color_fb, fbl->double_buffer_color_fb); \
- SWAP(GPUTexture *, txl->color_post, txl->color_double_buffer); \
- effects->swap_double_buffer = false; \
- effects->source_buffer = txl->color_double_buffer; \
- effects->target_buffer = fbl->main_color_fb; \
-} while (0);
-
void EEVEE_temporal_sampling_draw(EEVEE_Data *vedata)
{
EEVEE_PassList *psl = vedata->psl;
@@ -340,7 +330,7 @@ void EEVEE_temporal_sampling_draw(EEVEE_Data *vedata)
effects->taa_alpha = 1.0f / (float)(effects->taa_current_sample);
}
- GPU_framebuffer_bind(fbl->effect_color_fb);
+ GPU_framebuffer_bind(effects->target_buffer);
DRW_draw_pass(psl->taa_resolve);
/* Restore the depth from sample 1. */
@@ -348,26 +338,30 @@ void EEVEE_temporal_sampling_draw(EEVEE_Data *vedata)
GPU_framebuffer_blit(fbl->double_buffer_depth_fb, 0, fbl->main_fb, 0, GPU_DEPTH_BIT);
}
- SWAP_BUFFER_TAA();
+ SWAP_BUFFERS_TAA();
}
else {
if (!DRW_state_is_image_render()) {
- /* Do reprojection for noise reduction */
- /* TODO : do AA jitter if in only render view. */
- if ((effects->enabled_effects & EFFECT_TAA_REPROJECT) != 0 &&
- stl->g_data->valid_double_buffer)
- {
- GPU_framebuffer_bind(fbl->effect_color_fb);
- DRW_draw_pass(psl->taa_resolve);
-
- SWAP_BUFFER_TAA();
- }
-
/* Save the depth buffer for the next frame.
* This saves us from doing anything special
* in the other mode engines. */
GPU_framebuffer_blit(fbl->main_fb, 0, fbl->double_buffer_depth_fb, 0, GPU_DEPTH_BIT);
}
+
+ /* Do reprojection for noise reduction */
+ /* TODO : do AA jitter if in only render view. */
+ if (!DRW_state_is_image_render() &&
+ (effects->enabled_effects & EFFECT_TAA_REPROJECT) != 0 &&
+ stl->g_data->valid_taa_history)
+ {
+ GPU_framebuffer_bind(effects->target_buffer);
+ DRW_draw_pass(psl->taa_resolve);
+ SWAP_BUFFERS_TAA();
+ }
+ else {
+ struct GPUFrameBuffer *source_fb = (effects->target_buffer == fbl->main_color_fb) ? fbl->effect_color_fb : fbl->main_color_fb;
+ GPU_framebuffer_blit(source_fb, 0, fbl->taa_history_color_fb, 0, GPU_COLOR_BIT);
+ }
}
/* Make each loop count when doing a render. */