Skip to content

Commit

Permalink
Merge pull request #34790 from clayjohn/ETC-support-alpha
Browse files Browse the repository at this point in the history
Add support for Lum-alpha textures to ETC fallback
  • Loading branch information
akien-mga authored Jan 3, 2020
2 parents d1133df + cd21200 commit db1a015
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/etc/image_etc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit db1a015

Please sign in to comment.