mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-13 06:45:45 -04:00
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.
This commit is contained in:
@ -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<std::vector<u8>> 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<u64>(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;
|
||||
|
Reference in New Issue
Block a user