mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-29 04:24:17 +01:00
Vulkan: Experimental fix for self-dependency barriers during renderpass (#431)
This commit is contained in:
parent
d4e14d2b05
commit
a129d22a57
@ -1196,30 +1196,15 @@ void VulkanRenderer::draw_setRenderPass()
|
|||||||
// update self-dependency flag
|
// update self-dependency flag
|
||||||
if (m_state.descriptorSetsChanged || m_state.activeRenderpassFBO != fboVk)
|
if (m_state.descriptorSetsChanged || m_state.activeRenderpassFBO != fboVk)
|
||||||
{
|
{
|
||||||
bool hadDep = m_state.hasRenderSelfDependency;
|
|
||||||
m_state.hasRenderSelfDependency = fboVk->CheckForCollision(m_state.activeVertexDS, m_state.activeGeometryDS, m_state.activePixelDS);
|
m_state.hasRenderSelfDependency = fboVk->CheckForCollision(m_state.activeVertexDS, m_state.activeGeometryDS, m_state.activePixelDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto vkObjRenderPass = fboVk->GetRenderPassObj();
|
auto vkObjRenderPass = fboVk->GetRenderPassObj();
|
||||||
auto vkObjFramebuffer = fboVk->GetFramebufferObj();
|
auto vkObjFramebuffer = fboVk->GetFramebufferObj();
|
||||||
|
|
||||||
if (m_state.hasRenderSelfDependency)
|
bool overridePassReuse = m_state.hasRenderSelfDependency && (GetConfig().vk_accurate_barriers || m_state.activePipelineInfo->neverSkipAccurateBarrier);
|
||||||
{
|
|
||||||
bool triggerBarrier = GetConfig().vk_accurate_barriers || m_state.activePipelineInfo->neverSkipAccurateBarrier;
|
|
||||||
if (triggerBarrier)
|
|
||||||
{
|
|
||||||
VkMemoryBarrier memoryBarrier{};
|
|
||||||
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
|
||||||
memoryBarrier.srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
|
||||||
memoryBarrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
|
||||||
VkPipelineStageFlags srcStage = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
|
||||||
VkPipelineStageFlags dstStage = VK_PIPELINE_STAGE_VERTEX_SHADER_BIT | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
|
|
||||||
vkCmdPipelineBarrier(m_state.currentCommandBuffer, srcStage, dstStage, 0, 1, &memoryBarrier, 0, nullptr, 0, nullptr);
|
|
||||||
performanceMonitor.vk.numDrawBarriersPerFrame.increment();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_state.activeRenderpassFBO == fboVk)
|
if (!overridePassReuse && m_state.activeRenderpassFBO == fboVk)
|
||||||
{
|
{
|
||||||
if (m_state.descriptorSetsChanged)
|
if (m_state.descriptorSetsChanged)
|
||||||
sync_inputTexturesChanged();
|
sync_inputTexturesChanged();
|
||||||
|
Loading…
Reference in New Issue
Block a user