Skip to content

Commit

Permalink
GS/DX12: Fix targets getting stuck undirtied
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jul 8, 2023
1 parent a2c9069 commit ebb291e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pcsx2/GS/Renderers/DX12/GSDevice12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@ void GSDevice12::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r,
// otherwise we need to do an attachment clear
EndRenderPass();

dTexVK->SetState(GSTexture::State::Dirty);

if (dTexVK->GetType() != GSTexture::Type::DepthStencil)
{
dTexVK->TransitionToState(D3D12_RESOURCE_STATE_RENDER_TARGET);
Expand Down Expand Up @@ -1523,6 +1525,25 @@ void GSDevice12::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector
// framebuffer change
EndRenderPass();
}
else if (InRenderPass())
{
// Framebuffer unchanged, but check for clears. Have to restart render pass, unlike Vulkan.
// We'll take care of issuing the actual clear there, because we have to start one anyway.
if (vkRt && vkRt->GetState() != GSTexture::State::Dirty)
{
if (vkRt->GetState() == GSTexture::State::Cleared)
EndRenderPass();
else
vkRt->SetState(GSTexture::State::Dirty);
}
if (vkDs && vkDs->GetState() != GSTexture::State::Dirty)
{
if (vkDs->GetState() == GSTexture::State::Cleared)
EndRenderPass();
else
vkDs->SetState(GSTexture::State::Dirty);
}
}

m_current_render_target = vkRt;
m_current_depth_target = vkDs;
Expand Down

0 comments on commit ebb291e

Please sign in to comment.