mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
Renderers: Make shader cache path a prefix instead of directory
This commit is contained in:
parent
b9ffca1ddf
commit
f396a2c373
|
@ -160,7 +160,6 @@ std::string ShaderCache::GetCacheBaseFileName(const std::string_view& base_path,
|
||||||
bool debug)
|
bool debug)
|
||||||
{
|
{
|
||||||
std::string base_filename(base_path);
|
std::string base_filename(base_path);
|
||||||
base_filename += FS_OSPATH_SEPERATOR_CHARACTER;
|
|
||||||
base_filename += "d3d_shaders_";
|
base_filename += "d3d_shaders_";
|
||||||
|
|
||||||
switch (feature_level)
|
switch (feature_level)
|
||||||
|
|
|
@ -244,12 +244,12 @@ ShaderCache::CacheIndexKey ShaderCache::GetCacheKey(const std::string_view& vert
|
||||||
|
|
||||||
std::string ShaderCache::GetIndexFileName() const
|
std::string ShaderCache::GetIndexFileName() const
|
||||||
{
|
{
|
||||||
return StringUtil::StdStringFromFormat("%s%cgl_programs.idx", m_base_path.c_str(), FS_OSPATH_SEPERATOR_CHARACTER);
|
return StringUtil::StdStringFromFormat("%sgl_programs.idx", m_base_path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ShaderCache::GetBlobFileName() const
|
std::string ShaderCache::GetBlobFileName() const
|
||||||
{
|
{
|
||||||
return StringUtil::StdStringFromFormat("%s%cgl_programs.bin", m_base_path.c_str(), FS_OSPATH_SEPERATOR_CHARACTER);
|
return StringUtil::StdStringFromFormat("%sgl_programs.bin", m_base_path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<Program> ShaderCache::GetProgram(const std::string_view vertex_shader,
|
std::optional<Program> ShaderCache::GetProgram(const std::string_view vertex_shader,
|
||||||
|
|
|
@ -375,7 +375,6 @@ void ShaderCache::ClosePipelineCache()
|
||||||
std::string ShaderCache::GetShaderCacheBaseFileName(const std::string_view& base_path, bool debug)
|
std::string ShaderCache::GetShaderCacheBaseFileName(const std::string_view& base_path, bool debug)
|
||||||
{
|
{
|
||||||
std::string base_filename(base_path);
|
std::string base_filename(base_path);
|
||||||
base_filename += FS_OSPATH_SEPERATOR_CHARACTER;
|
|
||||||
base_filename += "vulkan_shaders";
|
base_filename += "vulkan_shaders";
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
@ -387,7 +386,6 @@ std::string ShaderCache::GetShaderCacheBaseFileName(const std::string_view& base
|
||||||
std::string ShaderCache::GetPipelineCacheBaseFileName(const std::string_view& base_path, bool debug)
|
std::string ShaderCache::GetPipelineCacheBaseFileName(const std::string_view& base_path, bool debug)
|
||||||
{
|
{
|
||||||
std::string base_filename(base_path);
|
std::string base_filename(base_path);
|
||||||
base_filename += FS_OSPATH_SEPERATOR_CHARACTER;
|
|
||||||
base_filename += "vulkan_pipelines";
|
base_filename += "vulkan_pipelines";
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|
|
@ -38,7 +38,7 @@ bool GPU_HW_D3D11::Initialize(HostDisplay* host_display, System* system, DMA* dm
|
||||||
if (!m_device || !m_context)
|
if (!m_device || !m_context)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_shader_cache.Open(system->GetHostInterface()->GetUserDirectoryRelativePath("cache"), m_device->GetFeatureLevel(),
|
m_shader_cache.Open(system->GetHostInterface()->GetShaderCacheBasePath(), m_device->GetFeatureLevel(),
|
||||||
system->GetSettings().gpu_use_debug_device);
|
system->GetSettings().gpu_use_debug_device);
|
||||||
|
|
||||||
if (!CreateFramebuffer())
|
if (!CreateFramebuffer())
|
||||||
|
|
|
@ -39,7 +39,7 @@ bool GPU_HW_OpenGL::Initialize(HostDisplay* host_display, System* system, DMA* d
|
||||||
|
|
||||||
SetCapabilities(host_display);
|
SetCapabilities(host_display);
|
||||||
|
|
||||||
m_shader_cache.Open(IsGLES(), system->GetHostInterface()->GetUserDirectoryRelativePath("cache"));
|
m_shader_cache.Open(IsGLES(), system->GetHostInterface()->GetShaderCacheBasePath());
|
||||||
|
|
||||||
if (!GPU_HW::Initialize(host_display, system, dma, interrupt_controller, timers))
|
if (!GPU_HW::Initialize(host_display, system, dma, interrupt_controller, timers))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -318,9 +318,9 @@ void HostInterface::OnRunningGameChanged() {}
|
||||||
|
|
||||||
void HostInterface::OnControllerTypeChanged(u32 slot) {}
|
void HostInterface::OnControllerTypeChanged(u32 slot) {}
|
||||||
|
|
||||||
std::string HostInterface::GetShaderCacheDirectory()
|
std::string HostInterface::GetShaderCacheBasePath() const
|
||||||
{
|
{
|
||||||
return GetUserDirectoryRelativePath("cache");
|
return GetUserDirectoryRelativePath("cache/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
void HostInterface::SetDefaultSettings(SettingsInterface& si)
|
||||||
|
|
|
@ -103,6 +103,9 @@ public:
|
||||||
/// Returns the default path to a memory card for a specific game.
|
/// Returns the default path to a memory card for a specific game.
|
||||||
virtual std::string GetGameMemoryCardPath(const char* game_code, u32 slot) const;
|
virtual std::string GetGameMemoryCardPath(const char* game_code, u32 slot) const;
|
||||||
|
|
||||||
|
/// Returns the path to the shader cache directory.
|
||||||
|
virtual std::string GetShaderCacheBasePath() const;
|
||||||
|
|
||||||
/// Returns a setting value from the configuration.
|
/// Returns a setting value from the configuration.
|
||||||
virtual std::string GetSettingValue(const char* section, const char* key, const char* default_value = "") = 0;
|
virtual std::string GetSettingValue(const char* section, const char* key, const char* default_value = "") = 0;
|
||||||
|
|
||||||
|
@ -127,9 +130,6 @@ protected:
|
||||||
virtual void OnRunningGameChanged();
|
virtual void OnRunningGameChanged();
|
||||||
virtual void OnControllerTypeChanged(u32 slot);
|
virtual void OnControllerTypeChanged(u32 slot);
|
||||||
|
|
||||||
/// Returns the path to the shader cache directory.
|
|
||||||
virtual std::string GetShaderCacheDirectory();
|
|
||||||
|
|
||||||
/// Restores all settings to defaults.
|
/// Restores all settings to defaults.
|
||||||
virtual void SetDefaultSettings(SettingsInterface& si);
|
virtual void SetDefaultSettings(SettingsInterface& si);
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,7 @@ bool QtHostInterface::AcquireHostDisplay()
|
||||||
createImGuiContext(display_widget->devicePixelRatioFromScreen());
|
createImGuiContext(display_widget->devicePixelRatioFromScreen());
|
||||||
|
|
||||||
if (!m_display->MakeRenderContextCurrent() ||
|
if (!m_display->MakeRenderContextCurrent() ||
|
||||||
!m_display->InitializeRenderDevice(GetShaderCacheDirectory(), m_settings.gpu_use_debug_device))
|
!m_display->InitializeRenderDevice(GetShaderCacheBasePath(), m_settings.gpu_use_debug_device))
|
||||||
{
|
{
|
||||||
destroyImGuiContext();
|
destroyImGuiContext();
|
||||||
m_display->DestroyRenderDevice();
|
m_display->DestroyRenderDevice();
|
||||||
|
|
|
@ -131,7 +131,7 @@ bool SDLHostInterface::CreateDisplay()
|
||||||
|
|
||||||
Assert(display);
|
Assert(display);
|
||||||
if (!display->CreateRenderDevice(wi.value(), m_settings.gpu_adapter, m_settings.gpu_use_debug_device) ||
|
if (!display->CreateRenderDevice(wi.value(), m_settings.gpu_adapter, m_settings.gpu_use_debug_device) ||
|
||||||
!display->InitializeRenderDevice(GetShaderCacheDirectory(), m_settings.gpu_use_debug_device))
|
!display->InitializeRenderDevice(GetShaderCacheBasePath(), m_settings.gpu_use_debug_device))
|
||||||
{
|
{
|
||||||
ReportError("Failed to create/initialize display render device");
|
ReportError("Failed to create/initialize display render device");
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue