Vulkan: Multithreaded creation of UID pipeline caches
Should give a decent speedup to boot time.
This commit is contained in:
parent
81b4ed2a81
commit
33f6668544
|
@ -113,9 +113,6 @@ bool Renderer::Initialize()
|
|||
m_bounding_box->GetGPUBufferSize());
|
||||
}
|
||||
|
||||
// Ensure all pipelines previously used by the game have been created.
|
||||
StateTracker::GetInstance()->ReloadPipelineUIDCache();
|
||||
|
||||
// Initialize post processing.
|
||||
m_post_processor = std::make_unique<VulkanPostProcessing>();
|
||||
if (!static_cast<VulkanPostProcessing*>(m_post_processor.get())
|
||||
|
|
|
@ -156,6 +156,10 @@ void StateTracker::ReloadPipelineUIDCache()
|
|||
PipelineInserter inserter(this);
|
||||
m_uid_cache.OpenAndRead(filename, inserter);
|
||||
}
|
||||
|
||||
// If we were using background compilation, ensure everything is ready before continuing.
|
||||
if (g_ActiveConfig.bBackgroundShaderCompiling)
|
||||
g_shader_cache->WaitForBackgroundCompilesToComplete();
|
||||
}
|
||||
|
||||
void StateTracker::AppendToPipelineUIDCache(const PipelineInfo& info)
|
||||
|
@ -212,12 +216,20 @@ bool StateTracker::PrecachePipelineUID(const SerializedPipelineUID& uid)
|
|||
pinfo.blend_state.hex = uid.blend_state_bits;
|
||||
pinfo.primitive_topology = uid.primitive_topology;
|
||||
|
||||
if (g_ActiveConfig.bBackgroundShaderCompiling)
|
||||
{
|
||||
// Use async for multithreaded compilation.
|
||||
g_shader_cache->GetPipelineWithCacheResultAsync(pinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
VkPipeline pipeline = g_shader_cache->GetPipeline(pinfo);
|
||||
if (pipeline == VK_NULL_HANDLE)
|
||||
{
|
||||
WARN_LOG(VIDEO, "Failed to get pipeline from cached UID.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't need to do anything with this pipeline, just make sure it exists.
|
||||
return true;
|
||||
|
|
|
@ -263,6 +263,9 @@ bool VideoBackend::Initialize(void* window_handle)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Ensure all pipelines previously used by the game have been created.
|
||||
StateTracker::GetInstance()->ReloadPipelineUIDCache();
|
||||
|
||||
// Lastly, precompile ubershaders, if requested.
|
||||
// This has to be done after the texture cache and shader cache are initialized.
|
||||
if (g_ActiveConfig.CanPrecompileUberShaders())
|
||||
|
|
Loading…
Reference in New Issue