From dcf10561b996cdba111c5a3c3fe128781ab44021 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 15 Nov 2023 21:36:25 -0300 Subject: Fix missing texture flush for draw then DMA copy sequence without render target change (#5933) * Unbind render targets before DMA copy * Move DirtyAction to TextureGroupHandle * Fix lost copy dependency bug * XML doc --- src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs | 38 ++------------------------ 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs') diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs index e828cb9f..b93f3832 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs @@ -709,8 +709,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// /// The texture that has been modified /// True if this texture is being bound, false if unbound - /// Indicates if the modified flag should be set - public void SignalModifying(Texture texture, bool bound, bool setModified) + public void SignalModifying(Texture texture, bool bound) { ModifiedSequence = _context.GetModifiedSequence(); @@ -722,7 +721,7 @@ namespace Ryujinx.Graphics.Gpu.Image { TextureGroupHandle group = _handles[baseHandle + i]; - group.SignalModifying(bound, _context, setModified); + group.SignalModifying(bound, _context); } }); } @@ -993,26 +992,6 @@ namespace Ryujinx.Graphics.Gpu.Image } } - /// - /// The action to perform when a memory tracking handle is flipped to dirty. - /// This notifies overlapping textures that the memory needs to be synchronized. - /// - /// The handle that a dirty flag was set on - private void DirtyAction(TextureGroupHandle groupHandle) - { - // Notify all textures that belong to this handle. - - Storage.SignalGroupDirty(); - - lock (groupHandle.Overlaps) - { - foreach (Texture overlap in groupHandle.Overlaps) - { - overlap.SignalGroupDirty(); - } - } - } - /// /// Generate a CpuRegionHandle for a given address and size range in CPU VA. /// @@ -1084,11 +1063,6 @@ namespace Ryujinx.Graphics.Gpu.Image views, result.ToArray()); - foreach (RegionHandle handle in result) - { - handle.RegisterDirtyEvent(() => DirtyAction(groupHandle)); - } - return groupHandle; } @@ -1360,11 +1334,6 @@ namespace Ryujinx.Graphics.Gpu.Image var groupHandle = new TextureGroupHandle(this, 0, Storage.Size, _views, 0, 0, 0, _allOffsets.Length, cpuRegionHandles); - foreach (RegionHandle handle in cpuRegionHandles) - { - handle.RegisterDirtyEvent(() => DirtyAction(groupHandle)); - } - handles = new TextureGroupHandle[] { groupHandle }; } else @@ -1620,6 +1589,7 @@ namespace Ryujinx.Graphics.Gpu.Image if ((ignore == null || !handle.HasDependencyTo(ignore)) && handle.Modified) { handle.Modified = false; + handle.DeferredCopy = null; Storage.SignalModifiedDirty(); lock (handle.Overlaps) @@ -1666,8 +1636,6 @@ namespace Ryujinx.Graphics.Gpu.Image return; } - Storage.ModifiedSinceLastFlush = false; - // There is a small gap here where the action is removed but _actionRegistered is still 1. // In this case it will skip registering the action, but here we are already handling it, // so there shouldn't be any issue as it's the same handler for all actions. -- cgit v1.2.3