From aac8d5c4065a358347586d33df58ac6885de4e4f Mon Sep 17 00:00:00 2001 From: clayjohn Date: Thu, 22 Sep 2022 20:36:01 -0700 Subject: [PATCH] Properly initialize motion vectors offset when motion vectors are disabled. This fixes an uninitialized memory bug that caused particles to fail in non-LTO builds --- .../renderer_rd/forward_clustered/render_forward_clustered.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index 63fd10886d1..35953a71202 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -479,6 +479,9 @@ void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p if ((surf->owner->base_flags & (INSTANCE_DATA_FLAG_MULTIMESH | INSTANCE_DATA_FLAG_PARTICLES)) == INSTANCE_DATA_FLAG_MULTIMESH) { mesh_storage->_multimesh_get_motion_vectors_offsets(surf->owner->data->base, push_constant.multimesh_motion_vectors_current_offset, push_constant.multimesh_motion_vectors_previous_offset); + } else { + push_constant.multimesh_motion_vectors_current_offset = 0; + push_constant.multimesh_motion_vectors_previous_offset = 0; } RD::get_singleton()->draw_list_set_push_constant(draw_list, &push_constant, sizeof(SceneState::PushConstant));