Honour copy dependencies when switching render target (#2433)

* Honour copy dependencies when switching render target

When switching from one render target to another, when both have a copy dependency to each other, a copy can be deferred on the second target when unbinding the first.

Before, this would not be honoured before binding the new texture, so the copy would stay deferred until the render targets change again, at which point it would copy in old data and essentially clear all the draws done during that time.

This change runs synchronize memory to make sure that copies are honoured. This can cause a redundant copy, but it's better than it breaking for now.

This should fix miiedit on AMD/Intel GPUs on windows. May fix other games, or perhaps rare copy dependency bugs on NVIDIA too.

* Address feedback
This commit is contained in:
riperiperi 2021-07-03 05:55:04 +01:00 committed by GitHub
parent f4078ae267
commit 94cc365b63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,7 +154,12 @@ namespace Ryujinx.Graphics.Gpu.Image
if (_rtColors[index] != color) if (_rtColors[index] != color)
{ {
_rtColors[index]?.SignalModifying(false); _rtColors[index]?.SignalModifying(false);
color?.SignalModifying(true);
if (color != null)
{
color.SynchronizeMemory();
color.SignalModifying(true);
}
_rtColors[index] = color; _rtColors[index] = color;
} }
@ -175,7 +180,12 @@ namespace Ryujinx.Graphics.Gpu.Image
if (_rtDepthStencil != depthStencil) if (_rtDepthStencil != depthStencil)
{ {
_rtDepthStencil?.SignalModifying(false); _rtDepthStencil?.SignalModifying(false);
depthStencil?.SignalModifying(true);
if (depthStencil != null)
{
depthStencil.SynchronizeMemory();
depthStencil.SignalModifying(true);
}
_rtDepthStencil = depthStencil; _rtDepthStencil = depthStencil;
} }