Skip to content

Commit 4636d0a

Browse files
committed
Merge pull request #105193 from Monstrofil/fix-dds-mipmap-size-uncompressed-dds
Fix incorrect mipmap size calculation for uncompressed DDS textures
2 parents f7b7270 + 65c9f44 commit 4636d0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/dds/texture_loader_dds.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ static Ref<Image> _dds_load_layer(Ref<FileAccess> p_file, DDSFormat p_dds_format
165165
uint32_t size = p_width * p_height * info.block_size;
166166

167167
for (uint32_t i = 1; i < p_mipmaps; i++) {
168-
w = (w + 1) >> 1;
169-
h = (h + 1) >> 1;
168+
w = MAX(1u, w >> 1);
169+
h = MAX(1u, h >> 1);
170170
size += w * h * info.block_size;
171171
}
172172

0 commit comments

Comments
 (0)