summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-03 22:48:22 +0100
committerGitHub <noreply@github.com>2020-01-03 22:48:22 +0100
commitdb1a01501bb46ff1391580f68f25e9dd511d6e40 (patch)
tree511d178d3750108ad464b1a8455e35d1d145a521 /modules
parentd1133df7dfafca3aa130025713c244525588988d (diff)
parentcd212009446ac7f538b7402071940394d2685901 (diff)
Merge pull request #34790 from clayjohn/ETC-support-alpha
Add support for Lum-alpha textures to ETC fallback
Diffstat (limited to 'modules')
-rw-r--r--modules/etc/image_etc.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp
index f0b95c893d..b80138c99d 100644
--- a/modules/etc/image_etc.cpp
+++ b/modules/etc/image_etc.cpp
@@ -139,11 +139,16 @@ 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
+ if (force_etc1_format) {
+ // If VRAM compression is using ETC, but image has alpha, convert to RGBA4444 or LA8
// This saves space while maintaining the alpha channel
- p_img->convert(Image::FORMAT_RGBA4444);
- return;
+ if (detected_channels == Image::DETECTED_RGBA) {
+ p_img->convert(Image::FORMAT_RGBA4444);
+ return;
+ } else if (detected_channels == Image::DETECTED_LA) {
+ p_img->convert(Image::FORMAT_LA8);
+ return;
+ }
}
uint32_t imgw = p_img->get_width(), imgh = p_img->get_height();