Merge pull request #36694 from clayjohn/ETC-mipmaps
Force mipmaps off when importing RGBA4444 textures
This commit is contained in:
commit
685f255f2f
|
@ -1448,6 +1448,8 @@ Error Image::generate_mipmaps(bool p_renormalize) {
|
||||||
|
|
||||||
ERR_FAIL_COND_V_MSG(!_can_modify(format), ERR_UNAVAILABLE, "Cannot generate mipmaps in compressed or custom image formats.");
|
ERR_FAIL_COND_V_MSG(!_can_modify(format), ERR_UNAVAILABLE, "Cannot generate mipmaps in compressed or custom image formats.");
|
||||||
|
|
||||||
|
ERR_FAIL_COND_V_MSG(format == FORMAT_RGBA4444 || format == FORMAT_RGBA5551, ERR_UNAVAILABLE, "Cannot generate mipmaps in custom image formats.");
|
||||||
|
|
||||||
ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0.");
|
ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0.");
|
||||||
|
|
||||||
int mmcount;
|
int mmcount;
|
||||||
|
|
|
@ -143,9 +143,15 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f
|
||||||
// If VRAM compression is using ETC, but image has alpha, convert to RGBA4444 or LA8
|
// If VRAM compression is using ETC, but image has alpha, convert to RGBA4444 or LA8
|
||||||
// This saves space while maintaining the alpha channel
|
// This saves space while maintaining the alpha channel
|
||||||
if (detected_channels == Image::DETECTED_RGBA) {
|
if (detected_channels == Image::DETECTED_RGBA) {
|
||||||
|
|
||||||
|
if (p_img->has_mipmaps()) {
|
||||||
|
// Image doesn't support mipmaps with RGBA4444 textures
|
||||||
|
p_img->clear_mipmaps();
|
||||||
|
}
|
||||||
p_img->convert(Image::FORMAT_RGBA4444);
|
p_img->convert(Image::FORMAT_RGBA4444);
|
||||||
return;
|
return;
|
||||||
} else if (detected_channels == Image::DETECTED_LA) {
|
} else if (detected_channels == Image::DETECTED_LA) {
|
||||||
|
|
||||||
p_img->convert(Image::FORMAT_LA8);
|
p_img->convert(Image::FORMAT_LA8);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue