summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-01-03 14:29:19 +0100
committerGitHub <noreply@github.com>2020-01-03 14:29:19 +0100
commit136846a6ec4f01eea4ecfbd5b624b1145730288c (patch)
tree5683c66e2cedb8dd013f78f782dfac48e07fa701 /modules
parentfa82664419f644c410980a045839ccbc7f483c22 (diff)
parent7a9fc69a16d2cf29e0f5b4388869c29c4c5e8dd3 (diff)
Merge pull request #34772 from clayjohn/ETC-support-alpha
Fallback to RGBA4444 for textures with alpha set to ETC compression
Diffstat (limited to 'modules')
-rw-r--r--modules/etc/image_etc.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index 7cd5e2eb12..f0b95c893d 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -139,6 +139,13 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
return;
}
+ if (img_format >= Image::FORMAT_RGBA8 && force_etc1_format) {
+ // If VRAM compression is using ETC, but image has alpha, convert to RGBA4444
+ // This saves space while maintaining the alpha channel
+ p_img->convert(Image::FORMAT_RGBA4444);
+ return;
+ }
+
uint32_t imgw = p_img->get_width(), imgh = p_img->get_height();
Image::Format etc_format = force_etc1_format ? Image::FORMAT_ETC : _get_etc2_mode(detected_channels);