From 94cc365b635b0c42f6443af724ff0cdcb7ab00a3 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Sat, 3 Jul 2021 05:55:04 +0100 Subject: [PATCH] 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 --- Ryujinx.Graphics.Gpu/Image/TextureManager.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs index 74c9766a5..9cab343ad 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs @@ -154,7 +154,12 @@ namespace Ryujinx.Graphics.Gpu.Image if (_rtColors[index] != color) { _rtColors[index]?.SignalModifying(false); - color?.SignalModifying(true); + + if (color != null) + { + color.SynchronizeMemory(); + color.SignalModifying(true); + } _rtColors[index] = color; } @@ -175,7 +180,12 @@ namespace Ryujinx.Graphics.Gpu.Image if (_rtDepthStencil != depthStencil) { _rtDepthStencil?.SignalModifying(false); - depthStencil?.SignalModifying(true); + + if (depthStencil != null) + { + depthStencil.SynchronizeMemory(); + depthStencil.SignalModifying(true); + } _rtDepthStencil = depthStencil; }