diff options
-rw-r--r-- | core/image.cpp | 2 | ||||
-rw-r--r-- | modules/etc/image_etc.cpp | 6 | ||||
-rw-r--r-- | servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp | 3 |
3 files changed, 11 insertions, 0 deletions
diff --git a/core/image.cpp b/core/image.cpp index a188447f90..2c39c9b882 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1458,6 +1458,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(format == FORMAT_RGBA4444, ERR_UNAVAILABLE, "Cannot generate mipmaps from RGBA4444 format."); + ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0."); int mmcount; diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index 0dbd5ca905..b3f7b1d94f 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -106,9 +106,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 // This saves space while maintaining the alpha channel if (detected_channels == Image::USED_CHANNELS_RGBA) { + + if (p_img->has_mipmaps()) { + // Image doesn't support mipmaps with RGBA4444 textures + p_img->clear_mipmaps(); + } p_img->convert(Image::FORMAT_RGBA4444); return; } else if (detected_channels == Image::USE_CHANNELS_LA) { + p_img->convert(Image::FORMAT_LA8); return; } diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp index bfe98857d9..4a78fa89ba 100644 --- a/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_scene_rd.cpp @@ -653,8 +653,11 @@ void RasterizerSceneRD::reflection_atlas_set_size(RID p_ref_atlas, int p_reflect //clear and invalidate everything RD::get_singleton()->free(ra->reflection); ra->reflection = RID(); + RD::get_singleton()->free(ra->depth_buffer); + ra->depth_buffer = RID(); for (int i = 0; i < ra->reflections.size(); i++) { + _clear_reflection_data(ra->reflections.write[i].data); if (ra->reflections[i].owner.is_null()) { continue; } |