summaryrefslogtreecommitdiffstats
path: root/servers
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2024-09-09 17:10:47 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-17 08:57:44 +0200
commitf757cc9a70e2f8c1b385db76543ffb0eae87a4f7 (patch)
tree2a31786ccb290a12aa4154317437bbe2107dec6c /servers
parentcab91cf8fb3fa6cb51c5331d5efd03d8d683a1ca (diff)
downloadredot-engine-f757cc9a70e2f8c1b385db76543ffb0eae87a4f7.tar.gz
RenderingDevice: Fix uncapped mipmap sizes causing div-by-zero
(cherry picked from commit 7f1989bac11b74dd899b063194578d3a6ee917c6)
Diffstat (limited to 'servers')
-rw-r--r--servers/rendering/rendering_device.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index da48b24a1a..2176659bec 100644
--- a/servers/rendering/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
@@ -1624,8 +1624,8 @@ Vector<uint8_t> RenderingDevice::texture_get_data(RID p_texture, uint32_t p_laye
copy_region.texture_region_size.z = d;
command_buffer_texture_copy_regions_vector.push_back(copy_region);
- w = (w >> 1);
- h = (h >> 1);
+ w = MAX(1u, w >> 1);
+ h = MAX(1u, h >> 1);
d = MAX(1u, d >> 1);
}