Fix Image CowData crash when baking large lightmaps

This switches to 64-bit integers in select locations of the Image
class, so that image resolutions of 16384×16384 (used by
lightmap texture arrays) can be used properly. Values that are larger
should also work.

VRAM compression is also supported, although most VRAM-compressed
formats are limited to individual slices of 16384×16384. WebP
is limited to 16383×16383 due to format limitations.
This commit is contained in:
Hugo Locurcio 2024-07-12 01:52:55 +02:00 committed by Rémi Verschelde
parent 293c0f7646
commit 0445ccf428
No known key found for this signature in database
GPG key ID: C3336907360768E1
7 changed files with 70 additions and 76 deletions

View file

@ -120,7 +120,8 @@ Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image::UsedCha
Vector<uint32_t> mip_data_padded;
for (int32_t i = 0; i <= image->get_mipmap_count(); i++) {
int ofs, size, width, height;
int64_t ofs, size;
int width, height;
image->get_mipmap_offset_size_and_dimensions(i, ofs, size, width, height);
const uint8_t *image_mip_data = image_data.ptr() + ofs;