summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-10-14 14:09:48 -0500
committerThaddeus Crews <repiteo@outlook.com>2024-10-14 14:09:48 -0500
commit5c7059ec69d11323cb412f8ccc8c265cfa31bba0 (patch)
treef78929a14e4c9f58db10c623483e91acbc42592b
parentc220e5bffd8005a50671b2562df9af536ddffdb6 (diff)
parent77dab88ef0e9062b2b94ed28c339d1e96ac57021 (diff)
downloadredot-engine-5c7059ec69d11323cb412f8ccc8c265cfa31bba0.tar.gz
Merge pull request #97830 from BlueCube3310/teximport-hdr-lossless
Fix layered HDR texture import with lossless compression
-rw-r--r--editor/import/resource_importer_layered_texture.cpp4
-rw-r--r--editor/import/resource_importer_texture.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index 72d715ac2d..9de34cf1db 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -276,6 +276,10 @@ void ResourceImporterLayeredTexture::_save_tex(Vector<Ref<Image>> p_images, cons
f->store_32(0);
f->store_32(0);
+ if ((p_compress_mode == COMPRESS_LOSSLESS || p_compress_mode == COMPRESS_LOSSY) && p_images[0]->get_format() >= Image::FORMAT_RF) {
+ p_compress_mode = COMPRESS_VRAM_UNCOMPRESSED; // These can't go as lossy.
+ }
+
for (int i = 0; i < p_images.size(); i++) {
ResourceImporterTexture::save_to_ctex_format(f, p_images[i], ResourceImporterTexture::CompressMode(p_compress_mode), used_channels, p_vram_compression, p_lossy);
}
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index a205123df1..b1cf079c1f 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -380,7 +380,7 @@ void ResourceImporterTexture::_save_ctex(const Ref<Image> &p_image, const String
f->store_32(0);
f->store_32(0);
- if ((p_compress_mode == COMPRESS_LOSSLESS || p_compress_mode == COMPRESS_LOSSY) && p_image->get_format() > Image::FORMAT_RGBA8) {
+ if ((p_compress_mode == COMPRESS_LOSSLESS || p_compress_mode == COMPRESS_LOSSY) && p_image->get_format() >= Image::FORMAT_RF) {
p_compress_mode = COMPRESS_VRAM_UNCOMPRESSED; //these can't go as lossy
}