diff options
| author | riperiperi <rhy3756547@hotmail.com> | 2023-05-08 11:45:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-08 12:45:12 +0200 |
| commit | 1b28ecd63eb49917e3711eb7e06739ebe87e8f41 (patch) | |
| tree | 4259bbedb1fc4d2ae9f4e0dbac30d42c41d6ddc9 /src/Ryujinx.Graphics.Vulkan/Auto.cs | |
| parent | 895d9b53bc37507fed6829a7f91a1b8e3237ab0b (diff) | |
Vulkan: Simplify MultiFenceHolder and managing them (#4845)
* 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/Auto.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Vulkan/Auto.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Vulkan/Auto.cs b/src/Ryujinx.Graphics.Vulkan/Auto.cs index 77261de9..fdce7232 100644 --- a/src/Ryujinx.Graphics.Vulkan/Auto.cs +++ b/src/Ryujinx.Graphics.Vulkan/Auto.cs @@ -105,6 +105,23 @@ namespace Ryujinx.Graphics.Vulkan } } + public bool TryIncrementReferenceCount() + { + int lastValue; + do + { + lastValue = _referenceCount; + + if (lastValue == 0) + { + return false; + } + } + while (Interlocked.CompareExchange(ref _referenceCount, lastValue + 1, lastValue) != lastValue); + + return true; + } + public void IncrementReferenceCount() { if (Interlocked.Increment(ref _referenceCount) == 1) |
