From e783e32108520a4d5b866fc0b28f23cedc3c74f6 Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sun, 6 Aug 2023 23:21:58 -0300 Subject: [PATCH] Fix integer underflow when rounding up in VoxelGI The code wanted to divide and round up: - 0 / 64 = 0 - 63 / 64 = 1 - 64 / 64 = 1 - 65 / 64 = 2 However when the dividend was exactly 0 it would underflow and produce 67108864 instead. This caused TDRs on empty scenes or extremely slow performance Fix #80286 --- servers/rendering/renderer_rd/environment/gi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers/rendering/renderer_rd/environment/gi.cpp b/servers/rendering/renderer_rd/environment/gi.cpp index 964d4d9adf0..a10a133269a 100644 --- a/servers/rendering/renderer_rd/environment/gi.cpp +++ b/servers/rendering/renderer_rd/environment/gi.cpp @@ -2977,7 +2977,7 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vectorcompute_list_set_push_constant(compute_list, &push_constant, sizeof(VoxelGIPushConstant)); @@ -2998,7 +2998,7 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vectorcompute_list_set_push_constant(compute_list, &push_constant, sizeof(VoxelGIPushConstant));