From cec089a271ad7ca8d1da79a605e893aa5d91f0f0 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 27 Mar 2022 05:23:24 +1000 Subject: [PATCH] D3D11/ShaderCache: Don't delete cache when running 2 instances --- common/D3D11/ShaderCache.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/D3D11/ShaderCache.cpp b/common/D3D11/ShaderCache.cpp index dc317a4590..3d4f0351d0 100644 --- a/common/D3D11/ShaderCache.cpp +++ b/common/D3D11/ShaderCache.cpp @@ -130,7 +130,17 @@ bool D3D11::ShaderCache::ReadExisting(const std::string& index_filename, const s { m_index_file = FileSystem::OpenCFile(index_filename.c_str(), "r+b"); if (!m_index_file) + { + // special case here: when there's a sharing violation (i.e. two instances running), + // we don't want to blow away the cache. so just continue without a cache. + if (errno == EACCES) + { + Console.WriteLn("Failed to open shader cache index with EACCES, are you running two instances?"); + return true; + } + return false; + } u32 file_version = 0; u32 data_version = 0;