1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 13:54:16 +01:00

[dxvk] Remove unneeded atomic that holds base pipeline handles

No longer needed because the full pipeline object gets locked anyway.
This commit is contained in:
Philip Rebohle 2018-10-29 12:11:33 +01:00
parent a53e053391
commit ec8559f40a
4 changed files with 10 additions and 16 deletions

View File

@ -48,7 +48,6 @@ namespace dxvk {
VkPipeline DxvkComputePipeline::getPipelineHandle(
const DxvkComputePipelineStateInfo& state) {
VkPipeline newPipelineBase = VK_NULL_HANDLE;
VkPipeline newPipelineHandle = VK_NULL_HANDLE;
{ std::lock_guard<sync::Spinlock> lock(m_mutex);
@ -58,17 +57,15 @@ namespace dxvk {
// If no pipeline instance exists with the given state
// vector, create a new one and add it to the list.
newPipelineBase = m_basePipeline.load();
newPipelineHandle = this->compilePipeline(state, newPipelineBase);
newPipelineHandle = this->compilePipeline(state, m_basePipeline);
// Add new pipeline to the set
m_pipelines.push_back({ state, newPipelineHandle });
m_pipeMgr->m_numComputePipelines += 1;
if (!m_basePipeline && newPipelineHandle)
m_basePipeline = newPipelineHandle;
}
// Use the new pipeline as the base pipeline for derivative pipelines
if (newPipelineBase == VK_NULL_HANDLE && newPipelineHandle != VK_NULL_HANDLE)
m_basePipeline.compare_exchange_strong(newPipelineBase, newPipelineHandle);
if (newPipelineHandle != VK_NULL_HANDLE)
this->writePipelineStateToCache(state);

View File

@ -80,7 +80,7 @@ namespace dxvk {
sync::Spinlock m_mutex;
std::vector<PipelineStruct> m_pipelines;
std::atomic<VkPipeline> m_basePipeline = { VK_NULL_HANDLE };
VkPipeline m_basePipeline = VK_NULL_HANDLE;
bool findPipeline(
const DxvkComputePipelineStateInfo& state,

View File

@ -108,7 +108,6 @@ namespace dxvk {
const DxvkRenderPass& renderPass) {
VkRenderPass renderPassHandle = renderPass.getDefaultHandle();
VkPipeline newPipelineBase = VK_NULL_HANDLE;
VkPipeline newPipelineHandle = VK_NULL_HANDLE;
{ std::lock_guard<sync::Spinlock> lock(m_mutex);
@ -125,18 +124,16 @@ namespace dxvk {
// If no pipeline instance exists with the given state
// vector, create a new one and add it to the list.
newPipelineBase = m_basePipeline.load();
newPipelineHandle = this->compilePipeline(state, renderPassHandle, newPipelineBase);
newPipelineHandle = this->compilePipeline(state, renderPassHandle, m_basePipeline);
// 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;
}
// Use the new pipeline as the base pipeline for derivative pipelines
if (newPipelineBase == VK_NULL_HANDLE && newPipelineHandle != VK_NULL_HANDLE)
m_basePipeline.compare_exchange_strong(newPipelineBase, newPipelineHandle);
if (newPipelineHandle != VK_NULL_HANDLE)
this->writePipelineStateToCache(state, renderPass.format());

View File

@ -239,7 +239,7 @@ namespace dxvk {
std::vector<DxvkGraphicsPipelineInstance> m_pipelines;
// Pipeline handles used for derivative pipelines
std::atomic<VkPipeline> m_basePipeline = { VK_NULL_HANDLE };
VkPipeline m_basePipeline = VK_NULL_HANDLE;
const DxvkGraphicsPipelineInstance* findInstance(
const DxvkGraphicsPipelineStateInfo& state,