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
7 changed files with 70 additions and 76 deletions

View File

@ -1491,7 +1491,7 @@ void TextureStorage::_texture_set_data(RID p_texture, const Ref<Image> &p_image,
int tsize = 0;
for (int i = 0; i < mipmaps; i++) {
int size, ofs;
int64_t size, ofs;
img->get_mipmap_offset_and_size(i, ofs, size);
if (compressed) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);