mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-27 05:20:06 +00:00
gl_shader_disk_cache.cpp: Invalidate Tranferable cache on error (#6392)
This commit is contained in:
parent
b6e73f0d49
commit
e283de9b6d
@ -126,8 +126,9 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
|
|||||||
u32 version{};
|
u32 version{};
|
||||||
if (transferable_file.ReadBytes(&version, sizeof(version)) != sizeof(version)) {
|
if (transferable_file.ReadBytes(&version, sizeof(version)) != sizeof(version)) {
|
||||||
LOG_ERROR(Render_OpenGL,
|
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());
|
GetTitleID());
|
||||||
|
InvalidateAll();
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +148,8 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
|
|||||||
while (transferable_file.Tell() < transferable_file.GetSize()) {
|
while (transferable_file.Tell() < transferable_file.GetSize()) {
|
||||||
TransferableEntryKind kind{};
|
TransferableEntryKind kind{};
|
||||||
if (transferable_file.ReadBytes(&kind, sizeof(u32)) != sizeof(u32)) {
|
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;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +157,8 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
|
|||||||
case TransferableEntryKind::Raw: {
|
case TransferableEntryKind::Raw: {
|
||||||
ShaderDiskCacheRaw entry;
|
ShaderDiskCacheRaw entry;
|
||||||
if (!entry.Load(transferable_file)) {
|
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;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
transferable.emplace(entry.GetUniqueIdentifier(), ShaderDiskCacheRaw{});
|
transferable.emplace(entry.GetUniqueIdentifier(), ShaderDiskCacheRaw{});
|
||||||
@ -163,8 +166,9 @@ std::optional<std::vector<ShaderDiskCacheRaw>> ShaderDiskCache::LoadTransferable
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Render_OpenGL, "Unknown transferable shader cache entry kind={} - skipping",
|
LOG_ERROR(Render_OpenGL, "Unknown transferable shader cache entry kind={} - removing",
|
||||||
kind);
|
kind);
|
||||||
|
InvalidateAll();
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,6 +520,8 @@ void ShaderDiskCache::SaveVirtualPrecompiledFile() {
|
|||||||
precompiled_path);
|
precompiled_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
precompiled_file.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShaderDiskCache::EnsureDirectories() const {
|
bool ShaderDiskCache::EnsureDirectories() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user