From f757cc9a70e2f8c1b385db76543ffb0eae87a4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Mon, 9 Sep 2024 17:10:47 +0200 Subject: [PATCH] RenderingDevice: Fix uncapped mipmap sizes causing div-by-zero (cherry picked from commit 7f1989bac11b74dd899b063194578d3a6ee917c6) --- servers/rendering/rendering_device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp index da48b24a1a2..2176659bec1 100644 --- a/servers/rendering/rendering_device.cpp +++ b/servers/rendering/rendering_device.cpp @@ -1624,8 +1624,8 @@ Vector 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); }