Fix #140152: EEVEE: Crash while playing animation

This happened because the velocity module is referencing
batche to be able to copy them after drawing.

Make sure to call step swap even when shaders are not
ready to ensure we don't dereference these possibly
freed batches on the next draw.

This also fixes the crashing benchmarks.

Pull Request: https://projects.blender.org/blender/blender/pulls/141022
This commit is contained in:
Clément Foucault
2025-06-26 16:52:50 +02:00
committed by Clément Foucault
parent ea2284af11
commit 1073abe62f

View File

@@ -699,6 +699,13 @@ void Instance::draw_viewport()
info_append_i18n("Compiling EEVEE engine shaders");
DRW_viewport_request_redraw();
}
/* Do not swap if the velocity module didn't go through a full sync cycle. */
if (!is_loaded(needed_shaders)) {
/* The velocity module can reference some gpu::Batch. Calling this function
* make sure we release these references and don't de-reference them later as
* they might have been freed. */
velocity.step_swap();
}
return;
}