Ensure ETC2 textures are ALSO compressed to Po2 when have mipmaps. Fixes #26733
This commit is contained in:
parent
e28e849012
commit
6cb841edcb
|
@ -735,6 +735,10 @@ static void _overlay(const uint8_t *__restrict p_src, uint8_t *__restrict p_dst,
|
|||
}
|
||||
}
|
||||
|
||||
bool Image::is_size_po2() const {
|
||||
return uint32_t(width) == next_power_of_2(width) && uint32_t(height) == next_power_of_2(height);
|
||||
}
|
||||
|
||||
void Image::resize_to_po2(bool p_square) {
|
||||
|
||||
if (!_can_modify(format)) {
|
||||
|
|
|
@ -223,6 +223,7 @@ public:
|
|||
void resize(int p_width, int p_height, Interpolation p_interpolation = INTERPOLATE_BILINEAR);
|
||||
void shrink_x2();
|
||||
void expand_x2_hq2x();
|
||||
bool is_size_po2() const;
|
||||
/**
|
||||
* Crop the image to a specific size, if larger, then the image is filled by black
|
||||
*/
|
||||
|
|
|
@ -752,7 +752,11 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref<Image> &p
|
|||
if (config.keep_original_textures && !(texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING)) {
|
||||
texture->images.write[p_layer] = p_image;
|
||||
}
|
||||
|
||||
#ifndef GLES_OVER_GL
|
||||
if (p_image->is_compressed() && p_image->has_mipmaps() && !p_image->is_size_po2()) {
|
||||
ERR_PRINTS("Texuture '" + texture->path + "' is compressed, has mipmaps but is not of powerf-of-2 size. This does not work on OpenGL ES 3.0.");
|
||||
}
|
||||
#endif
|
||||
Image::Format real_format;
|
||||
Ref<Image> img = _get_gl_image_and_format(p_image, p_image->get_format(), texture->flags, real_format, format, internal_format, type, compressed, srgb);
|
||||
|
||||
|
|
|
@ -505,7 +505,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
|
|||
|
||||
if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc2")) {
|
||||
|
||||
_save_stex(image, p_save_path + ".etc2.stex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal, false);
|
||||
_save_stex(image, p_save_path + ".etc2.stex", compress_mode, lossy, Image::COMPRESS_ETC2, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal, true);
|
||||
r_platform_variants->push_back("etc2");
|
||||
formats_imported.push_back("etc2");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue