aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2023-05-08 11:45:12 +0100
committerGitHub <noreply@github.com>2023-05-08 12:45:12 +0200
commit1b28ecd63eb49917e3711eb7e06739ebe87e8f41 (patch)
tree4259bbedb1fc4d2ae9f4e0dbac30d42c41d6ddc9 /src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs
parent895d9b53bc37507fed6829a7f91a1b8e3237ab0b (diff)
Vulkan: Simplify MultiFenceHolder and managing them (#4845)1.1.770
* Vulkan: Simplify waitable add/remove Removal of unnecessary hashset and dictionary * Thread safety for GetBufferData in PersistentFlushBuffer * Fix WaitForFencesImpl thread safety * Proper methods for risky reference increments * Wrong type of CB. * Address feedback
Diffstat (limited to 'src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs')
-rw-r--r--src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs b/src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs
index 4cbb24ef..42b46eae 100644
--- a/src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs
+++ b/src/Ryujinx.Graphics.Vulkan/CommandBufferPool.cs
@@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Vulkan
public SemaphoreHolder Semaphore;
public List<IAuto> Dependants;
- public HashSet<MultiFenceHolder> Waitables;
+ public List<MultiFenceHolder> Waitables;
public HashSet<SemaphoreHolder> Dependencies;
public void Initialize(Vk api, Device device, CommandPool pool)
@@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Vulkan
api.AllocateCommandBuffers(device, allocateInfo, out CommandBuffer);
Dependants = new List<IAuto>();
- Waitables = new HashSet<MultiFenceHolder>();
+ Waitables = new List<MultiFenceHolder>();
Dependencies = new HashSet<SemaphoreHolder>();
}
}
@@ -143,8 +143,10 @@ namespace Ryujinx.Graphics.Vulkan
public void AddWaitable(int cbIndex, MultiFenceHolder waitable)
{
ref var entry = ref _commandBuffers[cbIndex];
- waitable.AddFence(cbIndex, entry.Fence);
- entry.Waitables.Add(waitable);
+ if (waitable.AddFence(cbIndex, entry.Fence))
+ {
+ entry.Waitables.Add(waitable);
+ }
}
public bool HasWaitableOnRentedCommandBuffer(MultiFenceHolder waitable, int offset, int size)
@@ -156,7 +158,7 @@ namespace Ryujinx.Graphics.Vulkan
ref var entry = ref _commandBuffers[i];
if (entry.InUse &&
- entry.Waitables.Contains(waitable) &&
+ waitable.HasFence(i) &&
waitable.IsBufferRangeInUse(i, offset, size))
{
return true;
@@ -331,7 +333,7 @@ namespace Ryujinx.Graphics.Vulkan
foreach (var waitable in entry.Waitables)
{
- waitable.RemoveFence(cbIndex, entry.Fence);
+ waitable.RemoveFence(cbIndex);
waitable.RemoveBufferUses(cbIndex);
}