1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 04:24:11 +01:00

[dxvk] Fix base pipeline assignment when compipling new pipelines

We might otherwise end up destroying our base pipeline.
This commit is contained in:
Philip Rebohle 2018-08-10 23:29:45 +02:00
parent 50dfab2797
commit 18b39d8239
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -168,14 +168,14 @@ namespace dxvk {
instance->m_stateVector, instance->m_renderPass,
0, m_fastPipelineBase);
// Use the new pipeline as the base pipeline for derivative pipelines
if (newPipelineBase == VK_NULL_HANDLE && newPipelineHandle != VK_NULL_HANDLE)
m_fastPipelineBase.compare_exchange_strong(newPipelineBase, newPipelineHandle);
// If an optimized version has been compiled
// in the meantime, discard the new pipeline
if (!instance->setFastPipeline(newPipelineHandle))
if (!instance->setFastPipeline(newPipelineHandle)) {
// If another thread finished compiling an optimized version of this
// pipeline before this one finished, discard the new pipeline object.
m_vkd->vkDestroyPipeline(m_vkd->device(), newPipelineHandle, nullptr);
} else if (newPipelineBase == VK_NULL_HANDLE && newPipelineHandle != VK_NULL_HANDLE) {
// Use the new pipeline as the base pipeline for derivative pipelines.
m_fastPipelineBase.compare_exchange_strong(newPipelineBase, newPipelineHandle);
}
}