Fix T84878: Eevee cryptomatte broken with stereoscopy

During multiview rendering the `cryptomatte_accum_buffer` is not cleared
between the views and leaves artifacts on the next view to be rendered.
This change clears the accum buffer when it already exists and will be
reused for the next view.
This commit is contained in:
Jeroen Bakker 2021-01-25 09:40:03 +01:00
parent 7f9ed0178a
commit 292685ea39
Notes: blender-bot 2023-02-13 22:37:44 +01:00
Referenced by issue #84878, EEVEE cryptomatte broken with stereoscopy
1 changed files with 8 additions and 0 deletions

View File

@ -161,6 +161,14 @@ void EEVEE_cryptomatte_output_init(EEVEE_ViewLayerData *UNUSED(sldata),
g_data->cryptomatte_download_buffer = MEM_malloc_arrayN(
sizeof(float), buffer_size * num_cryptomatte_layers, __func__);
}
else {
/* During multiview rendering the `cryptomatte_accum_buffer` is deallocated after all views
* have been rendered. Clear it here to be reused by the next view. */
memset(g_data->cryptomatte_accum_buffer,
0,
buffer_size * eevee_cryptomatte_pixel_stride(view_layer) *
sizeof(EEVEE_CryptomatteSample));
}
DRW_texture_ensure_fullscreen_2d(&txl->cryptomatte, format, 0);
GPU_framebuffer_ensure_config(&fbl->cryptomatte_fb,