summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario <dariosamo@gmail.com>2024-04-05 13:00:20 -0300
committerDario <dariosamo@gmail.com>2024-04-05 13:14:07 -0300
commitecaafa6001e47ee0f8157e0e4846afd6e758a436 (patch)
treeb4eb94c6a45ce93c66d19622489b3dfae02f3600
parent655e93d5846b2ef8ebb7d22c8878f51b8f22b312 (diff)
downloadredot-engine-ecaafa6001e47ee0f8157e0e4846afd6e758a436.tar.gz
Add toggle for enabling or disabling RenderingDevice's pipeline cache.
-rw-r--r--core/config/project_settings.cpp1
-rw-r--r--doc/classes/ProjectSettings.xml4
-rw-r--r--servers/rendering/rendering_device.cpp3
3 files changed, 7 insertions, 1 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 14023c5c75..1508469e27 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -1538,6 +1538,7 @@ ProjectSettings::ProjectSettings() {
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/rendering_device/staging_buffer/block_size_kb", PROPERTY_HINT_RANGE, "4,2048,1,or_greater"), 256);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/rendering_device/staging_buffer/max_size_mb", PROPERTY_HINT_RANGE, "1,1024,1,or_greater"), 128);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/rendering_device/staging_buffer/texture_upload_region_size_px", PROPERTY_HINT_RANGE, "1,256,1,or_greater"), 64);
+ GLOBAL_DEF_RST(PropertyInfo(Variant::BOOL, "rendering/rendering_device/pipeline_cache/enable"), true);
GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "rendering/rendering_device/pipeline_cache/save_chunk_size_mb", PROPERTY_HINT_RANGE, "0.000001,64.0,0.001,or_greater"), 3.0);
GLOBAL_DEF(PropertyInfo(Variant::INT, "rendering/rendering_device/vulkan/max_descriptors_per_pool", PROPERTY_HINT_RANGE, "1,256,1,or_greater"), 64);
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 4d3e838bb1..6a6f53ac60 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -2727,6 +2727,10 @@
<member name="rendering/rendering_device/driver.windows" type="String" setter="" getter="">
Windows override for [member rendering/rendering_device/driver].
</member>
+ <member name="rendering/rendering_device/pipeline_cache/enable" type="bool" setter="" getter="" default="true">
+ Enable the pipeline cache that is saved to disk if the graphics API supports it.
+ [b]Note:[/b] This property is unable to control the pipeline caching the GPU driver itself does. Only turn this off along with deleting the contents of the driver's cache if you wish to simulate the experience a user will get when starting the game for the first time.
+ </member>
<member name="rendering/rendering_device/pipeline_cache/save_chunk_size_mb" type="float" setter="" getter="" default="3.0">
Determines at which interval pipeline cache is saved to disk. The lower the value, the more often it is saved.
</member>
diff --git a/servers/rendering/rendering_device.cpp b/servers/rendering/rendering_device.cpp
index 7dfff0b76f..1fdccb929b 100644
--- a/servers/rendering/rendering_device.cpp
+++ b/servers/rendering/rendering_device.cpp
@@ -5089,7 +5089,8 @@ Error RenderingDevice::initialize(RenderingContextDriver *p_context, DisplayServ
draw_list = nullptr;
compute_list = nullptr;
- if (main_instance) {
+ bool project_pipeline_cache_enable = GLOBAL_GET("rendering/rendering_device/pipeline_cache/enable");
+ if (main_instance && project_pipeline_cache_enable) {
// Only the instance that is not a local device and is also the singleton is allowed to manage a pipeline cache.
pipeline_cache_file_path = vformat("user://vulkan/pipelines.%s.%s",
OS::get_singleton()->get_current_rendering_method(),