mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-25 11:46:27 +00:00
Temporary (?) shader cache changes to disable caching of shaders
This commit is contained in:
parent
c64380a688
commit
ecae0239ce
2 changed files with 15 additions and 12 deletions
|
@ -37,10 +37,11 @@ ShaderCache::~ShaderCache()
|
||||||
ClearCaches();
|
ClearCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShaderCache::Initialize()
|
bool ShaderCache::Initialize(bool force_no_cache)
|
||||||
{
|
{
|
||||||
m_api_type = g_backend_info.api_type;
|
m_api_type = g_backend_info.api_type;
|
||||||
m_host_config.bits = ShaderHostConfig::GetCurrent().bits;
|
m_host_config.bits = ShaderHostConfig::GetCurrent().bits;
|
||||||
|
m_should_cache = g_ActiveConfig.bShaderCache && !force_no_cache;
|
||||||
|
|
||||||
if (!CompileSharedPipelines())
|
if (!CompileSharedPipelines())
|
||||||
return false;
|
return false;
|
||||||
|
@ -56,7 +57,7 @@ void ShaderCache::InitializeShaderCache()
|
||||||
m_async_shader_compiler->ResizeWorkerThreads(g_ActiveConfig.GetShaderPrecompilerThreads());
|
m_async_shader_compiler->ResizeWorkerThreads(g_ActiveConfig.GetShaderPrecompilerThreads());
|
||||||
|
|
||||||
// Load shader and UID caches.
|
// Load shader and UID caches.
|
||||||
if (g_ActiveConfig.bShaderCache && m_api_type != APIType::Nothing)
|
if (m_should_cache && m_api_type != APIType::Nothing)
|
||||||
{
|
{
|
||||||
LoadCaches();
|
LoadCaches();
|
||||||
LoadPipelineUIDCache();
|
LoadPipelineUIDCache();
|
||||||
|
@ -84,7 +85,7 @@ void ShaderCache::Reload()
|
||||||
if (!CompileSharedPipelines())
|
if (!CompileSharedPipelines())
|
||||||
PanicAlertFmt("Failed to compile shared pipelines after reload.");
|
PanicAlertFmt("Failed to compile shared pipelines after reload.");
|
||||||
|
|
||||||
if (g_ActiveConfig.bShaderCache)
|
if (m_should_cache)
|
||||||
LoadCaches();
|
LoadCaches();
|
||||||
|
|
||||||
// Switch to the precompiling shader configuration while we rebuild.
|
// Switch to the precompiling shader configuration while we rebuild.
|
||||||
|
@ -125,7 +126,7 @@ const AbstractPipeline* ShaderCache::GetPipelineForUid(const GXPipelineUid& uid)
|
||||||
std::optional<AbstractPipelineConfig> pipeline_config = GetGXPipelineConfig(uid);
|
std::optional<AbstractPipelineConfig> pipeline_config = GetGXPipelineConfig(uid);
|
||||||
if (pipeline_config)
|
if (pipeline_config)
|
||||||
pipeline = g_gfx->CreatePipeline(*pipeline_config);
|
pipeline = g_gfx->CreatePipeline(*pipeline_config);
|
||||||
if (g_ActiveConfig.bShaderCache && !exists_in_cache)
|
if (m_should_cache && !exists_in_cache)
|
||||||
AppendGXPipelineUID(uid);
|
AppendGXPipelineUID(uid);
|
||||||
return InsertGXPipeline(uid, std::move(pipeline));
|
return InsertGXPipeline(uid, std::move(pipeline));
|
||||||
}
|
}
|
||||||
|
@ -470,7 +471,7 @@ const AbstractShader* ShaderCache::InsertVertexShader(const VertexShaderUid& uid
|
||||||
|
|
||||||
if (shader && !entry.shader)
|
if (shader && !entry.shader)
|
||||||
{
|
{
|
||||||
if (g_ActiveConfig.bShaderCache && g_backend_info.bSupportsShaderBinaries)
|
if (m_should_cache && g_backend_info.bSupportsShaderBinaries)
|
||||||
{
|
{
|
||||||
auto binary = shader->GetBinary();
|
auto binary = shader->GetBinary();
|
||||||
if (!binary.empty())
|
if (!binary.empty())
|
||||||
|
@ -492,7 +493,7 @@ const AbstractShader* ShaderCache::InsertVertexUberShader(const UberShader::Vert
|
||||||
|
|
||||||
if (shader && !entry.shader)
|
if (shader && !entry.shader)
|
||||||
{
|
{
|
||||||
if (g_ActiveConfig.bShaderCache && g_backend_info.bSupportsShaderBinaries)
|
if (m_should_cache && g_backend_info.bSupportsShaderBinaries)
|
||||||
{
|
{
|
||||||
auto binary = shader->GetBinary();
|
auto binary = shader->GetBinary();
|
||||||
if (!binary.empty())
|
if (!binary.empty())
|
||||||
|
@ -514,7 +515,7 @@ const AbstractShader* ShaderCache::InsertPixelShader(const PixelShaderUid& uid,
|
||||||
|
|
||||||
if (shader && !entry.shader)
|
if (shader && !entry.shader)
|
||||||
{
|
{
|
||||||
if (g_ActiveConfig.bShaderCache && g_backend_info.bSupportsShaderBinaries)
|
if (m_should_cache && g_backend_info.bSupportsShaderBinaries)
|
||||||
{
|
{
|
||||||
auto binary = shader->GetBinary();
|
auto binary = shader->GetBinary();
|
||||||
if (!binary.empty())
|
if (!binary.empty())
|
||||||
|
@ -536,7 +537,7 @@ const AbstractShader* ShaderCache::InsertPixelUberShader(const UberShader::Pixel
|
||||||
|
|
||||||
if (shader && !entry.shader)
|
if (shader && !entry.shader)
|
||||||
{
|
{
|
||||||
if (g_ActiveConfig.bShaderCache && g_backend_info.bSupportsShaderBinaries)
|
if (m_should_cache && g_backend_info.bSupportsShaderBinaries)
|
||||||
{
|
{
|
||||||
auto binary = shader->GetBinary();
|
auto binary = shader->GetBinary();
|
||||||
if (!binary.empty())
|
if (!binary.empty())
|
||||||
|
@ -563,7 +564,7 @@ const AbstractShader* ShaderCache::CreateGeometryShader(const GeometryShaderUid&
|
||||||
|
|
||||||
if (shader && !entry.shader)
|
if (shader && !entry.shader)
|
||||||
{
|
{
|
||||||
if (g_ActiveConfig.bShaderCache && g_backend_info.bSupportsShaderBinaries)
|
if (m_should_cache && g_backend_info.bSupportsShaderBinaries)
|
||||||
{
|
{
|
||||||
auto binary = shader->GetBinary();
|
auto binary = shader->GetBinary();
|
||||||
if (!binary.empty())
|
if (!binary.empty())
|
||||||
|
@ -875,7 +876,7 @@ const AbstractPipeline* ShaderCache::InsertGXPipeline(const GXPipelineUid& confi
|
||||||
{
|
{
|
||||||
entry.first = std::move(pipeline);
|
entry.first = std::move(pipeline);
|
||||||
|
|
||||||
if (g_ActiveConfig.bShaderCache)
|
if (m_should_cache)
|
||||||
{
|
{
|
||||||
auto cache_data = entry.first->GetCacheData();
|
auto cache_data = entry.first->GetCacheData();
|
||||||
if (!cache_data.empty())
|
if (!cache_data.empty())
|
||||||
|
@ -901,7 +902,7 @@ ShaderCache::InsertGXUberPipeline(const GXUberPipelineUid& config,
|
||||||
{
|
{
|
||||||
entry.first = std::move(pipeline);
|
entry.first = std::move(pipeline);
|
||||||
|
|
||||||
if (g_ActiveConfig.bShaderCache)
|
if (m_should_cache)
|
||||||
{
|
{
|
||||||
auto cache_data = entry.first->GetCacheData();
|
auto cache_data = entry.first->GetCacheData();
|
||||||
if (!cache_data.empty())
|
if (!cache_data.empty())
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
~ShaderCache();
|
~ShaderCache();
|
||||||
|
|
||||||
// Perform at startup, create descriptor layouts, compiles all static shaders.
|
// Perform at startup, create descriptor layouts, compiles all static shaders.
|
||||||
bool Initialize();
|
bool Initialize(bool force_no_cache = false);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
// Compiles/loads cached shaders.
|
// Compiles/loads cached shaders.
|
||||||
|
@ -252,6 +252,8 @@ private:
|
||||||
// Texture decoding shaders
|
// Texture decoding shaders
|
||||||
std::map<std::pair<u32, u32>, std::unique_ptr<AbstractShader>> m_texture_decoding_shaders;
|
std::map<std::pair<u32, u32>, std::unique_ptr<AbstractShader>> m_texture_decoding_shaders;
|
||||||
|
|
||||||
|
bool m_should_cache = false;
|
||||||
|
|
||||||
Common::EventHook m_frame_end_handler;
|
Common::EventHook m_frame_end_handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue