From efbe9237ccfec335efef8233656d4501184c89cc 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 (cherry picked from commit e783e32108520a4d5b866fc0b28f23cedc3c74f6) --- 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 db63e2f1a99..eeab7b1848c 100644 --- a/servers/rendering/renderer_rd/environment/gi.cpp +++ b/servers/rendering/renderer_rd/environment/gi.cpp @@ -2966,7 +2966,7 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vectorcompute_list_set_push_constant(compute_list, &push_constant, sizeof(VoxelGIPushConstant)); @@ -2987,7 +2987,7 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vectorcompute_list_set_push_constant(compute_list, &push_constant, sizeof(VoxelGIPushConstant));