From cc1575e8b7dab0f25a8b89b86704b490dd06e6e5 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 6 Jul 2022 12:09:03 +0200 Subject: [PATCH] [dxvk] Compile optimized graphics pipelines on worker threads if necessary --- src/dxvk/dxvk_graphics.cpp | 6 ++++++ src/dxvk/dxvk_graphics.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index 5dc946a5..86a9de93 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -465,6 +465,8 @@ namespace dxvk { DxvkShaderPipelineLibrary* vsLibrary, DxvkShaderPipelineLibrary* fsLibrary) : m_device (device), + m_manager (pipeMgr), + m_workers (&pipeMgr->m_workers), m_cache (&pipeMgr->m_cache), m_stateCache (&pipeMgr->m_stateCache), m_stats (&pipeMgr->m_stats), @@ -544,6 +546,10 @@ namespace dxvk { // a state cache worker and the current thread needs priority. instance = this->createInstance(state); this->writePipelineStateToCache(state); + + // If necessary, compile an optimized pipeline variant + if (!instance->fastHandle.load()) + m_workers->compileGraphicsPipeline(this, state); } } diff --git a/src/dxvk/dxvk_graphics.h b/src/dxvk/dxvk_graphics.h index 967e8134..c4b25721 100644 --- a/src/dxvk/dxvk_graphics.h +++ b/src/dxvk/dxvk_graphics.h @@ -360,6 +360,8 @@ namespace dxvk { private: DxvkDevice* m_device; + DxvkPipelineManager* m_manager; + DxvkPipelineWorkers* m_workers; DxvkPipelineCache* m_cache; DxvkStateCache* m_stateCache; DxvkPipelineStats* m_stats;