mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add GLOBAL_GET cached macros.
GLOBAL_GET is an expensive operation which should not be used each frame / tick. This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed. Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
This commit is contained in:
@@ -165,7 +165,7 @@ void PortableCompressedTexture2D::create_from_image(const Ref<Image> &p_image, C
|
||||
switch (p_compression_mode) {
|
||||
case COMPRESSION_MODE_LOSSLESS:
|
||||
case COMPRESSION_MODE_LOSSY: {
|
||||
bool lossless_force_png = GLOBAL_GET("rendering/textures/lossless_compression/force_png") ||
|
||||
bool lossless_force_png = GLOBAL_GET_CACHED(bool, "rendering/textures/lossless_compression/force_png") ||
|
||||
!Image::_webp_mem_loader_func; // WebP module disabled.
|
||||
bool use_webp = !lossless_force_png && p_image->get_width() <= 16383 && p_image->get_height() <= 16383; // WebP has a size limit.
|
||||
for (int i = 0; i < p_image->get_mipmap_count() + 1; i++) {
|
||||
|
||||
Reference in New Issue
Block a user