lr dx11: fix exit crash. Save shader cache where vk cache is
This commit is contained in:
parent
4d60150345
commit
2478b72a3e
|
@ -121,9 +121,9 @@ std::string getSavestatePath(int index, bool writable)
|
|||
return get_readonly_data_path(state_file);
|
||||
}
|
||||
|
||||
std::string getVulkanCachePath()
|
||||
std::string getShaderCachePath(const std::string& filename)
|
||||
{
|
||||
return get_writable_data_path("vulkan_pipeline.cache");
|
||||
return get_writable_data_path(filename);
|
||||
}
|
||||
|
||||
std::string getTextureLoadPath(const std::string& gameId)
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace hostfs
|
|||
std::string getTextureLoadPath(const std::string& gameId);
|
||||
std::string getTextureDumpPath();
|
||||
|
||||
std::string getVulkanCachePath();
|
||||
std::string getShaderCachePath(const std::string& filename);
|
||||
|
||||
std::string getBiosFontPath();
|
||||
}
|
||||
|
|
|
@ -564,7 +564,7 @@ void CachedDX11Shaders::saveCache(const std::string& filename)
|
|||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
std::string path = get_writable_data_path(filename);
|
||||
std::string path = hostfs::getShaderCachePath(filename);
|
||||
FILE *fp = nowide::fopen(path.c_str(), "wb");
|
||||
if (fp == nullptr)
|
||||
{
|
||||
|
@ -589,7 +589,7 @@ void CachedDX11Shaders::loadCache(const std::string& filename)
|
|||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
std::string path = get_writable_data_path(filename);
|
||||
std::string path = hostfs::getShaderCachePath(filename);
|
||||
FILE *fp = nowide::fopen(path.c_str(), "rb");
|
||||
if (fp != nullptr)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,9 @@ DX11Context theDX11Context;
|
|||
bool DX11Context::init(ID3D11Device *device, ID3D11DeviceContext *deviceContext, pD3DCompile D3DCompile, D3D_FEATURE_LEVEL featureLevel)
|
||||
{
|
||||
NOTICE_LOG(RENDERER, "DX11 Context initializing");
|
||||
device->AddRef();
|
||||
pDevice.reset(device);
|
||||
deviceContext->AddRef();
|
||||
pDeviceContext.reset(deviceContext);
|
||||
this->D3DCompile = D3DCompile;
|
||||
this->featureLevel = featureLevel;
|
||||
|
|
|
@ -251,7 +251,7 @@ bool VulkanContext::init(retro_hw_render_interface_vulkan *retro_render_if)
|
|||
descriptorPool = device.createDescriptorPoolUnique(vk::DescriptorPoolCreateInfo(vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet,
|
||||
10000, ARRAY_SIZE(pool_sizes), pool_sizes));
|
||||
|
||||
std::string cachePath = hostfs::getVulkanCachePath();
|
||||
std::string cachePath = hostfs::getShaderCachePath("vulkan_pipeline.cache");
|
||||
FILE *f = fopen(cachePath.c_str(), "rb");
|
||||
if (f == nullptr)
|
||||
pipelineCache = device.createPipelineCacheUnique(vk::PipelineCacheCreateInfo());
|
||||
|
@ -307,7 +307,7 @@ void VulkanContext::term()
|
|||
std::vector<u8> cacheData = device.getPipelineCacheData(*pipelineCache);
|
||||
if (!cacheData.empty())
|
||||
{
|
||||
std::string cachePath = hostfs::getVulkanCachePath();
|
||||
std::string cachePath = hostfs::getShaderCachePath("vulkan_pipeline.cache");
|
||||
FILE *f = fopen(cachePath.c_str(), "wb");
|
||||
if (f != nullptr)
|
||||
{
|
||||
|
|
|
@ -446,7 +446,7 @@ bool VulkanContext::InitDevice()
|
|||
10000, ARRAY_SIZE(pool_sizes), pool_sizes));
|
||||
|
||||
|
||||
std::string cachePath = hostfs::getVulkanCachePath();
|
||||
std::string cachePath = hostfs::getShaderCachePath("vulkan_pipeline.cache");
|
||||
FILE *f = nowide::fopen(cachePath.c_str(), "rb");
|
||||
if (f == nullptr)
|
||||
pipelineCache = device->createPipelineCacheUnique(vk::PipelineCacheCreateInfo());
|
||||
|
@ -940,7 +940,7 @@ void VulkanContext::term()
|
|||
std::vector<u8> cacheData = device->getPipelineCacheData(*pipelineCache);
|
||||
if (!cacheData.empty())
|
||||
{
|
||||
std::string cachePath = hostfs::getVulkanCachePath();
|
||||
std::string cachePath = hostfs::getShaderCachePath("vulkan_pipeline.cache");
|
||||
FILE *f = nowide::fopen(cachePath.c_str(), "wb");
|
||||
if (f != nullptr)
|
||||
{
|
||||
|
|
|
@ -107,9 +107,9 @@ std::string getSavestatePath(int index, bool writable)
|
|||
return "";
|
||||
}
|
||||
|
||||
std::string getVulkanCachePath()
|
||||
std::string getShaderCachePath(const std::string& filename)
|
||||
{
|
||||
return std::string(game_dir_no_slash) + std::string(path_default_slash()) + "vulkan_pipeline.cache";
|
||||
return std::string(game_dir_no_slash) + std::string(path_default_slash()) + filename;
|
||||
}
|
||||
|
||||
std::string getTextureLoadPath(const std::string& gameId)
|
||||
|
|
Loading…
Reference in New Issue