From 9265dd72bac067e82c95031b359d3ce7da65d220 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 22 Jun 2020 15:58:10 +1000 Subject: [PATCH] Vulkan/ShaderCache: Skip writing pipeline cache when size matches Comparing all the data wasn't working, at least for Intel. I'm guessing there's some modification time field in there which keeps changing. --- src/common/vulkan/shader_cache.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/vulkan/shader_cache.cpp b/src/common/vulkan/shader_cache.cpp index f63542815..2ba5074f6 100644 --- a/src/common/vulkan/shader_cache.cpp +++ b/src/common/vulkan/shader_cache.cpp @@ -344,9 +344,8 @@ bool ShaderCache::FlushPipelineCache() data.resize(data_size); // Save disk writes if it hasn't changed, think of the poor SSDs. - std::optional> existing_data = FileSystem::ReadBinaryFile(m_pipeline_cache_filename.c_str()); - if (!existing_data.has_value() || existing_data->size() != data_size || - std::memcmp(existing_data->data(), data.data(), data_size) != 0) + FILESYSTEM_STAT_DATA sd; + if (!FileSystem::StatFile(m_pipeline_cache_filename.c_str(), &sd) || sd.Size != static_cast(data_size)) { Log_InfoPrintf("Writing %zu bytes to '%s'", data_size, m_pipeline_cache_filename.c_str()); if (!FileSystem::WriteBinaryFile(m_pipeline_cache_filename.c_str(), data.data(), data.size())) @@ -357,7 +356,7 @@ bool ShaderCache::FlushPipelineCache() } else { - Log_WarningPrintf("Skipping updating pipeline cache '%s' due to no changes.", m_pipeline_cache_filename.c_str()); + Log_InfoPrintf("Skipping updating pipeline cache '%s' due to no changes.", m_pipeline_cache_filename.c_str()); } m_pipeline_cache_dirty = false;