aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.OpenGL')
-rw-r--r--Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs5
-rw-r--r--Ryujinx.Graphics.OpenGL/Sync.cs31
2 files changed, 36 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs b/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs
index e26fe6b6..63c96fa2 100644
--- a/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs
+++ b/Ryujinx.Graphics.OpenGL/OpenGLRenderer.cs
@@ -238,6 +238,11 @@ namespace Ryujinx.Graphics.OpenGL
_sync.Wait(id);
}
+ public ulong GetCurrentSync()
+ {
+ return _sync.GetCurrent();
+ }
+
public void Screenshot()
{
_window.ScreenCaptureRequested = true;
diff --git a/Ryujinx.Graphics.OpenGL/Sync.cs b/Ryujinx.Graphics.OpenGL/Sync.cs
index de94fd31..58818e6a 100644
--- a/Ryujinx.Graphics.OpenGL/Sync.cs
+++ b/Ryujinx.Graphics.OpenGL/Sync.cs
@@ -40,6 +40,37 @@ namespace Ryujinx.Graphics.OpenGL
}
}
+ public ulong GetCurrent()
+ {
+ lock (_handles)
+ {
+ ulong lastHandle = _firstHandle;
+
+ foreach (SyncHandle handle in _handles)
+ {
+ lock (handle)
+ {
+ if (handle.Handle == IntPtr.Zero)
+ {
+ continue;
+ }
+
+ if (handle.ID > lastHandle)
+ {
+ WaitSyncStatus syncResult = GL.ClientWaitSync(handle.Handle, _syncFlags, 0);
+
+ if (syncResult == WaitSyncStatus.AlreadySignaled)
+ {
+ lastHandle = handle.ID;
+ }
+ }
+ }
+ }
+
+ return lastHandle;
+ }
+ }
+
public void Wait(ulong id)
{
SyncHandle result = null;