citra-emu
/
citra
Archived
1
0
Fork 0

gl_shader_disk_cache.cpp: Invalidate Tranferable cache on error (#6392)

This commit is contained in:
SachinVin 2023-04-10 00:46:44 +05:30 committed by GitHub
parent b6e73f0d49
commit e283de9b6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -126,8 +126,9 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
u32 version{};
if (transferable_file.ReadBytes(&version, sizeof(version)) != sizeof(version)) {
LOG_ERROR(Render_OpenGL,
"Failed to get transferable cache version for title id={} - skipping",
"Failed to get transferable cache version for title id={} - removing",
GetTitleID());
InvalidateAll();
return std::nullopt;
}
@ -147,7 +148,8 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
while (transferable_file.Tell() < transferable_file.GetSize()) {
TransferableEntryKind kind{};
if (transferable_file.ReadBytes(&kind, sizeof(u32)) != sizeof(u32)) {
LOG_ERROR(Render_OpenGL, "Failed to read transferable file - skipping");
LOG_ERROR(Render_OpenGL, "Failed to read transferable file - removing");
InvalidateAll();
return std::nullopt;
}
@ -155,7 +157,8 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
case TransferableEntryKind::Raw: {
ShaderDiskCacheRaw entry;
if (!entry.Load(transferable_file)) {
LOG_ERROR(Render_OpenGL, "Failed to load transferable raw entry - skipping");
LOG_ERROR(Render_OpenGL, "Failed to load transferable raw entry - removing");
InvalidateAll();
return std::nullopt;
}
transferable.emplace(entry.GetUniqueIdentifier(), ShaderDiskCacheRaw{});
@ -163,8 +166,9 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
break;
}
default:
LOG_ERROR(Render_OpenGL, "Unknown transferable shader cache entry kind={} - skipping",
LOG_ERROR(Render_OpenGL, "Unknown transferable shader cache entry kind={} - removing",
kind);
InvalidateAll();
return std::nullopt;
}
}
@ -516,6 +520,8 @@ void ShaderDiskCache::SaveVirtualPrecompiledFile() {
precompiled_path);
return;
}
precompiled_file.Flush();
}
bool ShaderDiskCache::EnsureDirectories() const {