You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +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
@@ -1050,8 +1050,8 @@ void CopyEffects::cubemap_downsample(RID p_source_cubemap, RID p_dest_cubemap, c
|
||||
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_source_cubemap), 0);
|
||||
RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_dest_cubemap), 1);
|
||||
|
||||
int x_groups = (p_size.x - 1) / 8 + 1;
|
||||
int y_groups = (p_size.y - 1) / 8 + 1;
|
||||
int x_groups = Math::division_round_up(p_size.x, 8);
|
||||
int y_groups = Math::division_round_up(p_size.y, 8);
|
||||
|
||||
RD::get_singleton()->compute_list_set_push_constant(compute_list, &cubemap_downsampler.push_constant, sizeof(CubemapDownsamplerPushConstant));
|
||||
|
||||
@@ -1204,8 +1204,8 @@ void CopyEffects::cubemap_roughness(RID p_source_rd_texture, RID p_dest_texture,
|
||||
|
||||
RD::get_singleton()->compute_list_set_push_constant(compute_list, &roughness.push_constant, sizeof(CubemapRoughnessPushConstant));
|
||||
|
||||
int x_groups = (p_size - 1) / 8 + 1;
|
||||
int y_groups = (p_size - 1) / 8 + 1;
|
||||
int x_groups = Math::division_round_up(p_size, 8);
|
||||
int y_groups = x_groups;
|
||||
|
||||
RD::get_singleton()->compute_list_dispatch(compute_list, x_groups, y_groups, p_face_id > 9 ? 6 : 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user