f81e0fcbf4
When importing images, we store a compressed version of the image to a .ctex file with ResourceImporterTexture::save_to_ctex_format. When importing many large images at once, this can use a large amount of memory, especially when the .ctex file uses WebP format. This change is for ResourceImporterTexture::save_to_ctex_format to use the original Image object instead of p_image->get_image_from_mipmap(0), to avoid creating a copy of the full uncompressed image when looping through the base Image and mipmaps. This reduces the import memory usage for large images by around 10% when using WebP, and 35-40% when Project Settings/Rendering/Textures/Lossless Compression/Force PNG is enabled, may vary depending on the image and number of import threads running. Same change applied to PortableCompressedTexture2D::create_from_image, which has similar logic. This helps with #92084, but does not fully resolve the issue on its own, as compressing with WebP on many threads can still use a large amount of memory - this just lowers that amount, and makes it more likely that enabling "Force PNG" will reduce memory usage enough to import the files. |
||
---|---|---|
.. | ||
3d | ||
atlas_import_failed.xpm | ||
audio_stream_import_settings.cpp | ||
audio_stream_import_settings.h | ||
dynamic_font_import_settings.cpp | ||
dynamic_font_import_settings.h | ||
editor_import_plugin.cpp | ||
editor_import_plugin.h | ||
resource_importer_bitmask.cpp | ||
resource_importer_bitmask.h | ||
resource_importer_bmfont.cpp | ||
resource_importer_bmfont.h | ||
resource_importer_csv_translation.cpp | ||
resource_importer_csv_translation.h | ||
resource_importer_dynamic_font.cpp | ||
resource_importer_dynamic_font.h | ||
resource_importer_image.cpp | ||
resource_importer_image.h | ||
resource_importer_imagefont.cpp | ||
resource_importer_imagefont.h | ||
resource_importer_layered_texture.cpp | ||
resource_importer_layered_texture.h | ||
resource_importer_shader_file.cpp | ||
resource_importer_shader_file.h | ||
resource_importer_texture.cpp | ||
resource_importer_texture.h | ||
resource_importer_texture_atlas.cpp | ||
resource_importer_texture_atlas.h | ||
resource_importer_texture_settings.cpp | ||
resource_importer_texture_settings.h | ||
resource_importer_wav.cpp | ||
resource_importer_wav.h | ||
SCsub |