Skip to content

Commit

Permalink
GPUDevice: Fix pipeline cache loading
Browse files Browse the repository at this point in the history
(again)
  • Loading branch information
stenzek committed Sep 6, 2024
1 parent a074699 commit 4c59513
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/util/gpu_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,9 @@ std::string GPUDevice::GetShaderCacheBaseName(std::string_view type) const

bool GPUDevice::OpenPipelineCache(const std::string& filename)
{
// Let it create if it does not exist.
if (!FileSystem::FileExists(filename.c_str()))
return true;

Error error;
CompressHelpers::OptionalByteBuffer data =
CompressHelpers::DecompressFile(CompressHelpers::CompressType::Zstandard, filename.c_str(), std::nullopt, &error);
if (!data.has_value())
{
ERROR_LOG("Failed to load pipeline cache from '{}': {}", Path::GetFileName(filename), error.GetDescription());
data.reset();
}

if (data.has_value())
{
Expand All @@ -535,6 +526,7 @@ bool GPUDevice::OpenPipelineCache(const std::string& filename)
}
else
{
ERROR_LOG("Failed to load pipeline cache from '{}': {}", Path::GetFileName(filename), error.GetDescription());
s_pipeline_cache_size = 0;
s_pipeline_cache_hash = {};
}
Expand All @@ -546,7 +538,8 @@ bool GPUDevice::OpenPipelineCache(const std::string& filename)
return false;
}

INFO_LOG("Pipeline cache hash: {}", SHA1Digest::DigestToString(s_pipeline_cache_hash));
INFO_LOG("Loaded pipeline cache: {} bytes with hash: {}", s_pipeline_cache_size,
SHA1Digest::DigestToString(s_pipeline_cache_hash));
return true;
}

Expand Down

0 comments on commit 4c59513

Please sign in to comment.