You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Fix potential integer underflow in rounded up divisions
A new `Math::division_round_up()` function was added, allowing for easy and correct computation of integer divisions when the result needs to be rounded up. Fixes #80358. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
This commit is contained in:
committed by
Rémi Verschelde
parent
13a0d6e9b2
commit
8747c67d9e
@@ -1069,8 +1069,8 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P
|
||||
uint32_t cluster_size = p_settings.cluster_builder->get_cluster_size();
|
||||
params.cluster_shift = get_shift_from_power_of_2(cluster_size);
|
||||
|
||||
uint32_t cluster_screen_width = (p_settings.rb_size.x - 1) / cluster_size + 1;
|
||||
uint32_t cluster_screen_height = (p_settings.rb_size.y - 1) / cluster_size + 1;
|
||||
uint32_t cluster_screen_width = Math::division_round_up((uint32_t)p_settings.rb_size.x, cluster_size);
|
||||
uint32_t cluster_screen_height = Math::division_round_up((uint32_t)p_settings.rb_size.y, cluster_size);
|
||||
params.max_cluster_element_count_div_32 = p_settings.max_cluster_elements / 32;
|
||||
params.cluster_type_size = cluster_screen_width * cluster_screen_height * (params.max_cluster_element_count_div_32 + 32);
|
||||
params.cluster_width = cluster_screen_width;
|
||||
|
||||
Reference in New Issue
Block a user