summaryrefslogtreecommitdiffstats
path: root/modules/etcpak
diff options
context:
space:
mode:
authorBlueCube3310 <53150244+BlueCube3310@users.noreply.github.com>2024-07-21 21:06:14 +0200
committerBlueCube3310 <53150244+BlueCube3310@users.noreply.github.com>2024-07-21 21:06:14 +0200
commit0ed45629fd825389504a512ca783c320a6ce3a5a (patch)
tree11277bbd42a3111b3a63024bd3c0a82cd80833d5 /modules/etcpak
parente25f3c0d38d457b15a63720240736f564ce0501b (diff)
downloadredot-engine-0ed45629fd825389504a512ca783c320a6ce3a5a.tar.gz
Support 64-bit image sizes for VRAM compression
Diffstat (limited to 'modules/etcpak')
-rw-r--r--modules/etcpak/image_compress_etcpak.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/etcpak/image_compress_etcpak.cpp b/modules/etcpak/image_compress_etcpak.cpp
index 4ce0cf50d9..95ed462070 100644
--- a/modules/etcpak/image_compress_etcpak.cpp
+++ b/modules/etcpak/image_compress_etcpak.cpp
@@ -181,7 +181,7 @@ void _compress_etcpak(EtcpakType p_compresstype, Image *r_img) {
print_verbose(vformat("etcpak: Encoding image size %dx%d to format %s%s.", width, height, Image::get_format_name(target_format), mipmaps ? ", with mipmaps" : ""));
- int dest_size = Image::get_image_data_size(width, height, target_format, mipmaps);
+ int64_t dest_size = Image::get_image_data_size(width, height, target_format, mipmaps);
Vector<uint8_t> dest_data;
dest_data.resize(dest_size);
uint8_t *dest_write = dest_data.ptrw();
@@ -192,7 +192,7 @@ void _compress_etcpak(EtcpakType p_compresstype, Image *r_img) {
for (int i = 0; i < mip_count + 1; i++) {
// Get write mip metrics for target image.
int orig_mip_w, orig_mip_h;
- int mip_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, target_format, i, orig_mip_w, orig_mip_h);
+ int64_t mip_ofs = Image::get_image_mipmap_offset_and_dimensions(width, height, target_format, i, orig_mip_w, orig_mip_h);
// Ensure that mip offset is a multiple of 8 (etcpak expects uint64_t pointer).
ERR_FAIL_COND(mip_ofs % 8 != 0);
uint64_t *dest_mip_write = (uint64_t *)&dest_write[mip_ofs];
@@ -203,7 +203,7 @@ void _compress_etcpak(EtcpakType p_compresstype, Image *r_img) {
const uint32_t blocks = mip_w * mip_h / 16;
// Get mip data from source image for reading.
- int src_mip_ofs = r_img->get_mipmap_offset(i);
+ int64_t src_mip_ofs = r_img->get_mipmap_offset(i);
const uint32_t *src_mip_read = (const uint32_t *)&src_read[src_mip_ofs];
// Pad textures to nearest block by smearing.