GS/Vulkan: Fix incorrect layout in depth feedback loops

Was setting the incorrect texture slot as dirty.
This commit is contained in:
Stenzek 2023-12-22 04:11:38 +10:00 committed by Connor McLaughlin
parent 6a0bbea9c5
commit 9a4094e997
1 changed files with 28 additions and 15 deletions

View File

@ -3462,27 +3462,40 @@ void GSDeviceVK::OMSetRenderTargets(
{
if (vkRt)
{
// NVIDIA drivers appear to return random garbage when sampling the RT via a feedback loop, if the load op for
// the render pass is CLEAR. Using vkCmdClearAttachments() doesn't work, so we have to clear the image instead.
if (feedback_loop & FeedbackLoopFlag_ReadAndWriteRT && vkRt->GetState() == GSTexture::State::Cleared &&
IsDeviceNVIDIA())
if (feedback_loop & FeedbackLoopFlag_ReadAndWriteRT)
{
vkRt->CommitClear();
}
// NVIDIA drivers appear to return random garbage when sampling the RT via a feedback loop, if the load op for
// the render pass is CLEAR. Using vkCmdClearAttachments() doesn't work, so we have to clear the image instead.
if (vkRt->GetState() == GSTexture::State::Cleared && IsDeviceNVIDIA())
vkRt->CommitClear();
vkRt->TransitionToLayout((feedback_loop & FeedbackLoopFlag_ReadAndWriteRT) ?
GSTextureVK::Layout::FeedbackLoop :
GSTextureVK::Layout::ColorAttachment);
if (vkRt->GetLayout() != GSTextureVK::Layout::FeedbackLoop)
{
// need to update descriptors to reflect the new layout
m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_RT);
vkRt->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop);
}
}
else
{
vkRt->TransitionToLayout(GSTextureVK::Layout::ColorAttachment);
}
}
if (vkDs)
{
// need to update descriptors to reflect the new layout
if ((feedback_loop & FeedbackLoopFlag_ReadDS) && vkDs->GetLayout() != GSTextureVK::Layout::FeedbackLoop)
m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_RT);
vkDs->TransitionToLayout((feedback_loop & FeedbackLoopFlag_ReadDS) ?
GSTextureVK::Layout::FeedbackLoop :
GSTextureVK::Layout::DepthStencilAttachment);
if (feedback_loop & FeedbackLoopFlag_ReadDS)
{
if (vkDs->GetLayout() != GSTextureVK::Layout::FeedbackLoop)
{
m_dirty_flags |= (DIRTY_FLAG_TFX_TEXTURE_0 << TFX_TEXTURE_TEXTURE);
vkDs->TransitionToLayout(GSTextureVK::Layout::FeedbackLoop);
}
}
else
{
vkDs->TransitionToLayout(GSTextureVK::Layout::DepthStencilAttachment);
}
}
}