From 25354237190897c64ab8b13f0dba97a375136afc Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 3 Dec 2024 17:22:48 -0800 Subject: [PATCH] Increase the size of the uniform set cache to 4096 to avoid cache thrashing from projects with high numbers of unique textures. --- doc/classes/ProjectSettings.xml | 2 +- servers/rendering_server.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 1da578167cf..78d25809c72 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -2367,7 +2367,7 @@ Maximum number of canvas item commands that can be batched into a single draw call. - + Maximum number of uniform sets that will be cached by the 2D renderer when batching draw calls. [b]Note:[/b] A project that uses a large number of unique sprite textures per frame may benefit from increasing this value. diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 2051d0caac0..5e0a1daf2e9 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -3584,7 +3584,7 @@ void RenderingServer::init() { GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/2d/shadow_atlas/size", PROPERTY_HINT_RANGE, "128,16384"), 2048); GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/2d/batching/item_buffer_size", PROPERTY_HINT_RANGE, "128,1048576,1"), 16384); - GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/2d/batching/uniform_set_cache_size", PROPERTY_HINT_RANGE, "256,1048576,1"), 256); + GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/2d/batching/uniform_set_cache_size", PROPERTY_HINT_RANGE, "256,1048576,1"), 4096); // Number of commands that can be drawn per frame. GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/gl_compatibility/item_buffer_size", PROPERTY_HINT_RANGE, "128,1048576,1"), 16384);