mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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:
parent
a53e053391
commit
ec8559f40a
@ -48,7 +48,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkPipeline DxvkComputePipeline::getPipelineHandle(
|
VkPipeline DxvkComputePipeline::getPipelineHandle(
|
||||||
const DxvkComputePipelineStateInfo& state) {
|
const DxvkComputePipelineStateInfo& state) {
|
||||||
VkPipeline newPipelineBase = VK_NULL_HANDLE;
|
|
||||||
VkPipeline newPipelineHandle = VK_NULL_HANDLE;
|
VkPipeline newPipelineHandle = VK_NULL_HANDLE;
|
||||||
|
|
||||||
{ std::lock_guard<sync::Spinlock> lock(m_mutex);
|
{ std::lock_guard<sync::Spinlock> lock(m_mutex);
|
||||||
@ -58,17 +57,15 @@ namespace dxvk {
|
|||||||
|
|
||||||
// If no pipeline instance exists with the given state
|
// If no pipeline instance exists with the given state
|
||||||
// vector, create a new one and add it to the list.
|
// vector, create a new one and add it to the list.
|
||||||
newPipelineBase = m_basePipeline.load();
|
newPipelineHandle = this->compilePipeline(state, m_basePipeline);
|
||||||
newPipelineHandle = this->compilePipeline(state, newPipelineBase);
|
|
||||||
|
|
||||||
// Add new pipeline to the set
|
// Add new pipeline to the set
|
||||||
m_pipelines.push_back({ state, newPipelineHandle });
|
m_pipelines.push_back({ state, newPipelineHandle });
|
||||||
m_pipeMgr->m_numComputePipelines += 1;
|
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)
|
if (newPipelineHandle != VK_NULL_HANDLE)
|
||||||
this->writePipelineStateToCache(state);
|
this->writePipelineStateToCache(state);
|
||||||
|
@ -80,7 +80,7 @@ namespace dxvk {
|
|||||||
sync::Spinlock m_mutex;
|
sync::Spinlock m_mutex;
|
||||||
std::vector<PipelineStruct> m_pipelines;
|
std::vector<PipelineStruct> m_pipelines;
|
||||||
|
|
||||||
std::atomic<VkPipeline> m_basePipeline = { VK_NULL_HANDLE };
|
VkPipeline m_basePipeline = VK_NULL_HANDLE;
|
||||||
|
|
||||||
bool findPipeline(
|
bool findPipeline(
|
||||||
const DxvkComputePipelineStateInfo& state,
|
const DxvkComputePipelineStateInfo& state,
|
||||||
|
@ -108,7 +108,6 @@ namespace dxvk {
|
|||||||
const DxvkRenderPass& renderPass) {
|
const DxvkRenderPass& renderPass) {
|
||||||
VkRenderPass renderPassHandle = renderPass.getDefaultHandle();
|
VkRenderPass renderPassHandle = renderPass.getDefaultHandle();
|
||||||
|
|
||||||
VkPipeline newPipelineBase = VK_NULL_HANDLE;
|
|
||||||
VkPipeline newPipelineHandle = VK_NULL_HANDLE;
|
VkPipeline newPipelineHandle = VK_NULL_HANDLE;
|
||||||
|
|
||||||
{ std::lock_guard<sync::Spinlock> lock(m_mutex);
|
{ std::lock_guard<sync::Spinlock> lock(m_mutex);
|
||||||
@ -125,18 +124,16 @@ namespace dxvk {
|
|||||||
|
|
||||||
// If no pipeline instance exists with the given state
|
// If no pipeline instance exists with the given state
|
||||||
// vector, create a new one and add it to the list.
|
// vector, create a new one and add it to the list.
|
||||||
newPipelineBase = m_basePipeline.load();
|
newPipelineHandle = this->compilePipeline(state, renderPassHandle, m_basePipeline);
|
||||||
newPipelineHandle = this->compilePipeline(state, renderPassHandle, newPipelineBase);
|
|
||||||
|
|
||||||
// Add new pipeline to the set
|
// Add new pipeline to the set
|
||||||
m_pipelines.emplace_back(state, renderPassHandle, newPipelineHandle);
|
m_pipelines.emplace_back(state, renderPassHandle, newPipelineHandle);
|
||||||
m_pipeMgr->m_numGraphicsPipelines += 1;
|
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)
|
if (newPipelineHandle != VK_NULL_HANDLE)
|
||||||
this->writePipelineStateToCache(state, renderPass.format());
|
this->writePipelineStateToCache(state, renderPass.format());
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ namespace dxvk {
|
|||||||
std::vector<DxvkGraphicsPipelineInstance> m_pipelines;
|
std::vector<DxvkGraphicsPipelineInstance> m_pipelines;
|
||||||
|
|
||||||
// Pipeline handles used for derivative 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 DxvkGraphicsPipelineInstance* findInstance(
|
||||||
const DxvkGraphicsPipelineStateInfo& state,
|
const DxvkGraphicsPipelineStateInfo& state,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user