aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Vulkan/SyncManager.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-01 12:31:42 +0200
committerGitHub <noreply@github.com>2023-07-01 12:31:42 +0200
commit801b71a12883f8a104c699a92a9aa997e2a6d609 (patch)
tree65a93c437abe7f598726e2654103ebfa0e62f477 /src/Ryujinx.Graphics.Vulkan/SyncManager.cs
parent12c5f6ee89a2e93814d144a2c92acbf3f8a4788f (diff)
[Ryujinx.Graphics.Vulkan] Address dotnet-format issues (#5378)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0059 warnings * Address dotnet format CA1816 warnings * Fix new dotnet-format issues after rebase * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Format if-blocks correctly * Another rebase, another dotnet format run * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format style after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Run dotnet format after rebase * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Remove redundant code * Rename generics * Address review feedback * Remove SetOrigin
Diffstat (limited to 'src/Ryujinx.Graphics.Vulkan/SyncManager.cs')
-rw-r--r--src/Ryujinx.Graphics.Vulkan/SyncManager.cs36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/Ryujinx.Graphics.Vulkan/SyncManager.cs b/src/Ryujinx.Graphics.Vulkan/SyncManager.cs
index b3f6e8e5..35e9ab97 100644
--- a/src/Ryujinx.Graphics.Vulkan/SyncManager.cs
+++ b/src/Ryujinx.Graphics.Vulkan/SyncManager.cs
@@ -21,13 +21,13 @@ namespace Ryujinx.Graphics.Vulkan
}
}
- private ulong _firstHandle = 0;
+ private ulong _firstHandle;
private readonly VulkanRenderer _gd;
private readonly Device _device;
- private List<SyncHandle> _handles;
- private ulong FlushId;
- private long WaitTicks;
+ private readonly List<SyncHandle> _handles;
+ private ulong _flushId;
+ private long _waitTicks;
public SyncManager(VulkanRenderer gd, Device device)
{
@@ -38,13 +38,13 @@ namespace Ryujinx.Graphics.Vulkan
public void RegisterFlush()
{
- FlushId++;
+ _flushId++;
}
public void Create(ulong id, bool strict)
{
- ulong flushId = FlushId;
- MultiFenceHolder waitable = new MultiFenceHolder();
+ ulong flushId = _flushId;
+ MultiFenceHolder waitable = new();
if (strict || _gd.InterruptAction == null)
{
_gd.FlushAllCommands();
@@ -58,11 +58,11 @@ namespace Ryujinx.Graphics.Vulkan
_gd.CommandBufferPool.AddInUseWaitable(waitable);
}
- SyncHandle handle = new SyncHandle
+ SyncHandle handle = new()
{
ID = id,
Waitable = waitable,
- FlushId = flushId
+ FlushId = flushId,
};
lock (_handles)
@@ -132,11 +132,11 @@ namespace Ryujinx.Graphics.Vulkan
long beforeTicks = Stopwatch.GetTimestamp();
- if (result.NeedsFlush(FlushId))
+ if (result.NeedsFlush(_flushId))
{
_gd.InterruptAction(() =>
{
- if (result.NeedsFlush(FlushId))
+ if (result.NeedsFlush(_flushId))
{
_gd.FlushAllCommands();
}
@@ -158,7 +158,7 @@ namespace Ryujinx.Graphics.Vulkan
}
else
{
- WaitTicks += Stopwatch.GetTimestamp() - beforeTicks;
+ _waitTicks += Stopwatch.GetTimestamp() - beforeTicks;
result.Signalled = true;
}
}
@@ -177,7 +177,10 @@ namespace Ryujinx.Graphics.Vulkan
first = _handles.FirstOrDefault();
}
- if (first == null || first.NeedsFlush(FlushId)) break;
+ if (first == null || first.NeedsFlush(_flushId))
+ {
+ break;
+ }
bool signaled = first.Waitable.WaitForFences(_gd.Api, _device, 0);
if (signaled)
@@ -192,7 +195,8 @@ namespace Ryujinx.Graphics.Vulkan
first.Waitable = null;
}
}
- } else
+ }
+ else
{
// This sync handle and any following have not been reached yet.
break;
@@ -202,8 +206,8 @@ namespace Ryujinx.Graphics.Vulkan
public long GetAndResetWaitTicks()
{
- long result = WaitTicks;
- WaitTicks = 0;
+ long result = _waitTicks;
+ _waitTicks = 0;
return result;
}