Browse Source

Merge pull request #89180 from akien-mga/vulkan-pipelines-cache-silence-wrong-warning

Vulkan: Don't warn about invalid pipelines cache if missing
Rémi Verschelde 1 year ago
parent
commit
bee7e12c8c

+ 3 - 1
drivers/vulkan/rendering_device_driver_vulkan.cpp

@@ -3828,7 +3828,9 @@ bool RenderingDeviceDriverVulkan::pipeline_cache_create(const Vector<uint8_t> &p
 
 
 	// Parse.
 	// Parse.
 	{
 	{
-		if (p_data.size() <= (int)sizeof(PipelineCacheHeader)) {
+		if (p_data.is_empty()) {
+			// No pre-existing cache, just create it.
+		} else if (p_data.size() <= (int)sizeof(PipelineCacheHeader)) {
 			WARN_PRINT("Invalid/corrupt pipelines cache.");
 			WARN_PRINT("Invalid/corrupt pipelines cache.");
 		} else {
 		} else {
 			const PipelineCacheHeader *loaded_header = reinterpret_cast<const PipelineCacheHeader *>(p_data.ptr());
 			const PipelineCacheHeader *loaded_header = reinterpret_cast<const PipelineCacheHeader *>(p_data.ptr());

+ 3 - 3
servers/rendering/rendering_device.cpp

@@ -5091,12 +5091,12 @@ Error RenderingDevice::initialize(RenderingContextDriver *p_context, DisplayServ
 
 
 	if (main_instance) {
 	if (main_instance) {
 		// Only the instance that is not a local device and is also the singleton is allowed to manage a pipeline cache.
 		// 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 = "user://vulkan/pipelines";
-		pipeline_cache_file_path += "." + device.name.validate_filename().replace(" ", "_").to_lower();
+		pipeline_cache_file_path = vformat("user://vulkan/pipelines.%s.%s",
+				OS::get_singleton()->get_current_rendering_method(),
+				device.name.validate_filename().replace(" ", "_").to_lower());
 		if (Engine::get_singleton()->is_editor_hint()) {
 		if (Engine::get_singleton()->is_editor_hint()) {
 			pipeline_cache_file_path += ".editor";
 			pipeline_cache_file_path += ".editor";
 		}
 		}
-
 		pipeline_cache_file_path += ".cache";
 		pipeline_cache_file_path += ".cache";
 
 
 		Vector<uint8_t> cache_data = _load_pipeline_cache();
 		Vector<uint8_t> cache_data = _load_pipeline_cache();