diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 9afd398c8b4..9a3215eeb97 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -19,6 +19,8 @@ #include "DNA_world_types.h" +#include "GPU_context.h" + #include "IMB_imbuf.h" #include "eevee_private.h" @@ -348,6 +350,16 @@ static void eevee_draw_scene(void *vedata) EEVEE_temporal_sampling_reset(vedata); stl->effects->ssr_was_valid_double_buffer = stl->g_data->valid_double_buffer; } + + /* Perform render step between samples to allow flushing of freed temporary GPUBackend + * resources. This prevents the GPU backend accumulating a high amount of in-flight memory when + * performing renders using eevee_draw_scene. e.g. During file thumbnail generation. */ + if (loop_len > 2) { + if (GPU_backend_get_type() == GPU_BACKEND_METAL) { + GPU_flush(); + GPU_render_step(); + } + } } if ((stl->g_data->render_passes & EEVEE_RENDER_PASS_COMBINED) != 0) {