diff options
author | riperiperi <rhy3756547@hotmail.com> | 2022-12-01 15:30:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-01 16:30:13 +0100 |
commit | 458452279cee03bfe1bbf2c3daf3fc9722b03a74 (patch) | |
tree | d62389dca124f75f2245d03d288ff54b87b7269e /Ryujinx.Graphics.Vulkan/SyncManager.cs | |
parent | 817b89767aa31b3b2847203b27151044f5d323f6 (diff) |
GPU: Track buffer migrations and flush source on incomplete copy (#3952)1.1.405
* Track buffer migrations and flush source on incomplete copy
Makes sure that the modified range list is always from the latest iteration of the buffer, and flushes earlier iterations of a buffer if the data has not been migrated yet.
* Cleanup 1
* Reduce cost for redundant signal checks on Vulkan
* Only inherit the range list if there are pending ranges.
* Fix OpenGL
* Address Feedback
* Whoops
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/SyncManager.cs')
-rw-r--r-- | Ryujinx.Graphics.Vulkan/SyncManager.cs | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Vulkan/SyncManager.cs b/Ryujinx.Graphics.Vulkan/SyncManager.cs index a39862d0..35e3adf1 100644 --- a/Ryujinx.Graphics.Vulkan/SyncManager.cs +++ b/Ryujinx.Graphics.Vulkan/SyncManager.cs @@ -11,6 +11,7 @@ namespace Ryujinx.Graphics.Vulkan { public ulong ID; public MultiFenceHolder Waitable; + public bool Signalled; } private ulong _firstHandle = 0; @@ -45,6 +46,37 @@ namespace Ryujinx.Graphics.Vulkan } } + public ulong GetCurrent() + { + lock (_handles) + { + ulong lastHandle = _firstHandle; + + foreach (SyncHandle handle in _handles) + { + lock (handle) + { + if (handle.Waitable == null) + { + continue; + } + + if (handle.ID > lastHandle) + { + bool signaled = handle.Signalled || handle.Waitable.WaitForFences(_gd.Api, _device, 0); + if (signaled) + { + lastHandle = handle.ID; + handle.Signalled = true; + } + } + } + } + + return lastHandle; + } + } + public void Wait(ulong id) { SyncHandle result = null; @@ -75,11 +107,15 @@ namespace Ryujinx.Graphics.Vulkan return; } - bool signaled = result.Waitable.WaitForFences(_gd.Api, _device, 1000000000); + bool signaled = result.Signalled || result.Waitable.WaitForFences(_gd.Api, _device, 1000000000); if (!signaled) { Logger.Error?.PrintMsg(LogClass.Gpu, $"VK Sync Object {result.ID} failed to signal within 1000ms. Continuing..."); } + else + { + result.Signalled = true; + } } } } |