From a93dd74f711789e259819b7330a51c7f52de494d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 14 Jul 2019 13:58:00 +0200 Subject: [PATCH] [dxvk] Don't use derivative pipelines No driver appears to be taking advantage of this, so why bother. --- src/dxvk/dxvk_compute.cpp | 14 ++++---------- src/dxvk/dxvk_compute.h | 5 +---- src/dxvk/dxvk_graphics.cpp | 14 +++----------- src/dxvk/dxvk_graphics.h | 6 +----- 4 files changed, 9 insertions(+), 30 deletions(-) diff --git a/src/dxvk/dxvk_compute.cpp b/src/dxvk/dxvk_compute.cpp index 25b1cffaf..ebd86f12e 100644 --- a/src/dxvk/dxvk_compute.cpp +++ b/src/dxvk/dxvk_compute.cpp @@ -52,14 +52,11 @@ namespace dxvk { // If no pipeline instance exists with the given state // vector, create a new one and add it to the list. - newPipelineHandle = this->compilePipeline(state, m_basePipeline); + newPipelineHandle = this->compilePipeline(state); // Add new pipeline to the set m_pipelines.push_back({ state, newPipelineHandle }); m_pipeMgr->m_numComputePipelines += 1; - - if (!m_basePipeline && newPipelineHandle) - m_basePipeline = newPipelineHandle; } if (newPipelineHandle != VK_NULL_HANDLE) @@ -84,8 +81,7 @@ namespace dxvk { VkPipeline DxvkComputePipeline::compilePipeline( - const DxvkComputePipelineStateInfo& state, - VkPipeline baseHandle) const { + const DxvkComputePipelineStateInfo& state) const { std::vector bindings; if (Logger::logLevel() <= LogLevel::Debug) { @@ -107,12 +103,10 @@ namespace dxvk { VkComputePipelineCreateInfo info; info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO; info.pNext = nullptr; - info.flags = baseHandle == VK_NULL_HANDLE - ? VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT - : VK_PIPELINE_CREATE_DERIVATIVE_BIT; + info.flags = 0; info.stage = csm.stageInfo(&specInfo); info.layout = m_layout->pipelineLayout(); - info.basePipelineHandle = baseHandle; + info.basePipelineHandle = VK_NULL_HANDLE; info.basePipelineIndex = -1; // Time pipeline compilation for debugging purposes diff --git a/src/dxvk/dxvk_compute.h b/src/dxvk/dxvk_compute.h index 740030d94..769dc9561 100644 --- a/src/dxvk/dxvk_compute.h +++ b/src/dxvk/dxvk_compute.h @@ -82,15 +82,12 @@ namespace dxvk { sync::Spinlock m_mutex; std::vector m_pipelines; - VkPipeline m_basePipeline = VK_NULL_HANDLE; - bool findPipeline( const DxvkComputePipelineStateInfo& state, VkPipeline& pipeline) const; VkPipeline compilePipeline( - const DxvkComputePipelineStateInfo& state, - VkPipeline baseHandle) const; + const DxvkComputePipelineStateInfo& state) const; void destroyPipeline( VkPipeline pipeline); diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index 012527af3..924031993 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -119,14 +119,11 @@ namespace dxvk { // If no pipeline instance exists with the given state // vector, create a new one and add it to the list. - newPipelineHandle = this->compilePipeline(state, renderPass, m_basePipeline); + newPipelineHandle = this->compilePipeline(state, renderPass); // Add new pipeline to the set m_pipelines.emplace_back(state, renderPassHandle, newPipelineHandle); m_pipeMgr->m_numGraphicsPipelines += 1; - - if (!m_basePipeline && newPipelineHandle) - m_basePipeline = newPipelineHandle; } if (newPipelineHandle != VK_NULL_HANDLE) @@ -150,8 +147,7 @@ namespace dxvk { VkPipeline DxvkGraphicsPipeline::compilePipeline( const DxvkGraphicsPipelineStateInfo& state, - const DxvkRenderPass& renderPass, - VkPipeline baseHandle) const { + const DxvkRenderPass& renderPass) const { if (Logger::logLevel() <= LogLevel::Debug) { Logger::debug("Compiling graphics pipeline..."); this->logPipelineState(LogLevel::Debug, state); @@ -427,13 +423,9 @@ namespace dxvk { info.layout = m_layout->pipelineLayout(); info.renderPass = renderPass.getDefaultHandle(); info.subpass = 0; - info.basePipelineHandle = baseHandle; + info.basePipelineHandle = VK_NULL_HANDLE; info.basePipelineIndex = -1; - info.flags |= baseHandle == VK_NULL_HANDLE - ? VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT - : VK_PIPELINE_CREATE_DERIVATIVE_BIT; - if (tsInfo.patchControlPoints == 0) info.pTessellationState = nullptr; diff --git a/src/dxvk/dxvk_graphics.h b/src/dxvk/dxvk_graphics.h index 8b80dbfcc..976cf590f 100644 --- a/src/dxvk/dxvk_graphics.h +++ b/src/dxvk/dxvk_graphics.h @@ -273,17 +273,13 @@ namespace dxvk { alignas(CACHE_LINE_SIZE) sync::Spinlock m_mutex; std::vector m_pipelines; - // Pipeline handles used for derivative pipelines - VkPipeline m_basePipeline = VK_NULL_HANDLE; - const DxvkGraphicsPipelineInstance* findInstance( const DxvkGraphicsPipelineStateInfo& state, VkRenderPass renderPass) const; VkPipeline compilePipeline( const DxvkGraphicsPipelineStateInfo& state, - const DxvkRenderPass& renderPass, - VkPipeline baseHandle) const; + const DxvkRenderPass& renderPass) const; void destroyPipeline( VkPipeline pipeline) const;