diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-04-21 01:43:35 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-05-05 19:40:50 +0300 |
commit | c8293d6258e2b74ca29356dd9deca59c127eed3c (patch) | |
tree | faba44cc3adb6c0f066c08c0a4e093687034048d /source/blender/draw/engines/eevee/eevee_shadows.c | |
parent | 5f7f90d5a222023837efc1aab62bf2cffa997217 (diff) |
Fix T86037 EEVEE: SSR option changes render passes result
This was caused by the SSR option resetting the accumulation. But the
render passes were only cleared in the init phase. This means that
when SSR was resetting the `taa_render_sample` the actual renderpasses
would still contains 1 sample. This means the renderpasses were always
divided by the wrong number of samples.
The fix is to clear just before accumulation if the sample is 1.
The fact that it works for motion blur is kind of a blessing. This is because
we check `stl->effects->ssr_was_valid_double_buffer` before resetting the
sampling. So this only happens on the first motion step and does not affect
the rest of the rendering.
Differential Revision: https://developer.blender.org/D11033
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_shadows.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_shadows.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c index 51fd1cad41e..6a98c3316f3 100644 --- a/source/blender/draw/engines/eevee/eevee_shadows.c +++ b/source/blender/draw/engines/eevee/eevee_shadows.c @@ -361,12 +361,8 @@ void EEVEE_shadow_output_init(EEVEE_ViewLayerData *sldata, EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_TextureList *txl = vedata->txl; EEVEE_PassList *psl = vedata->psl; - EEVEE_StorageList *stl = vedata->stl; - EEVEE_EffectsInfo *effects = stl->effects; DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); - const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - /* Create FrameBuffer. */ const eGPUTextureFormat texture_format = GPU_R32F; DRW_texture_ensure_fullscreen_2d(&txl->shadow_accum, texture_format, 0); @@ -374,12 +370,6 @@ void EEVEE_shadow_output_init(EEVEE_ViewLayerData *sldata, GPU_framebuffer_ensure_config(&fbl->shadow_accum_fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->shadow_accum)}); - /* Clear texture. */ - if (effects->taa_current_sample == 1) { - GPU_framebuffer_bind(fbl->shadow_accum_fb); - GPU_framebuffer_clear_color(fbl->shadow_accum_fb, clear); - } - /* Create Pass and shgroup. */ DRW_PASS_CREATE(psl->shadow_accum_pass, DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_ALWAYS | DRW_STATE_BLEND_ADD_FULL); @@ -404,9 +394,17 @@ void EEVEE_shadow_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_D { EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_PassList *psl = vedata->psl; + EEVEE_EffectsInfo *effects = vedata->stl->effects; if (fbl->shadow_accum_fb != NULL) { GPU_framebuffer_bind(fbl->shadow_accum_fb); + + /* Clear texture. */ + if (effects->taa_current_sample == 1) { + const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + GPU_framebuffer_clear_color(fbl->shadow_accum_fb, clear); + } + DRW_draw_pass(psl->shadow_accum_pass); /* Restore */ |