[Bf-blender-cvs] [aec90945304] temp-lineart-contained: Fix T87764: Mem-leak during viewport rendering.
Jeroen Bakker
noreply at git.blender.org
Wed May 12 04:15:50 CEST 2021
Commit: aec90945304ba9e4b1bea0057c78a74788e2e3c4
Author: Jeroen Bakker
Date: Mon May 10 12:51:44 2021 +0200
Branches: temp-lineart-contained
https://developer.blender.org/rBaec90945304ba9e4b1bea0057c78a74788e2e3c4
Fix T87764: Mem-leak during viewport rendering.
When a scene uses cryptomatte the viewport rendering would lead to a
memory leak. The reason was that all image renders (viewport+final)
activated cryptomatte. But is only used for final rendering.
This patch only activates cryptomatte when doing final rendering.
===================================================================
M source/blender/draw/engines/eevee/eevee_cryptomatte.c
===================================================================
diff --git a/source/blender/draw/engines/eevee/eevee_cryptomatte.c b/source/blender/draw/engines/eevee/eevee_cryptomatte.c
index 0cb2d55d1eb..eace4eb18f6 100644
--- a/source/blender/draw/engines/eevee/eevee_cryptomatte.c
+++ b/source/blender/draw/engines/eevee/eevee_cryptomatte.c
@@ -121,7 +121,7 @@ void EEVEE_cryptomatte_renderpasses_init(EEVEE_Data *vedata)
ViewLayer *view_layer = draw_ctx->view_layer;
/* Cryptomatte is only rendered for final image renders */
- if (!DRW_state_is_image_render()) {
+ if (!DRW_state_is_scene_render()) {
return;
}
const eViewLayerCryptomatteFlags active_layers = eevee_cryptomatte_active_layers(view_layer);
@@ -158,9 +158,9 @@ void EEVEE_cryptomatte_output_init(EEVEE_ViewLayerData *UNUSED(sldata),
const ViewLayer *view_layer = draw_ctx->view_layer;
const int num_cryptomatte_layers = eevee_cryptomatte_layers_count(view_layer);
- eGPUTextureFormat format = (num_cryptomatte_layers == 1) ?
- GPU_R32F :
- (num_cryptomatte_layers == 2) ? GPU_RG32F : GPU_RGBA32F;
+ eGPUTextureFormat format = (num_cryptomatte_layers == 1) ? GPU_R32F :
+ (num_cryptomatte_layers == 2) ? GPU_RG32F :
+ GPU_RGBA32F;
const float *viewport_size = DRW_viewport_size_get();
const int buffer_size = viewport_size[0] * viewport_size[1];
More information about the Bf-blender-cvs
mailing list