aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2021-12-19 14:32:52 +0000
committerGitHub <noreply@github.com>2021-12-19 11:32:52 -0300
commit521a07e6125d3a5d9781512639387a9be5f09107 (patch)
treee02db15b1e44d4e339185f3ef397cce0e3b0e719
parente24949ca2c7051586f6518ef524c93db0d4827c2 (diff)
Add support for releasing a semaphore to DmaClass (#2926)
* Add support for releasing a semaphore to DmaClass Fixes freezes in OpenGL games, primarily GameMaker ones such as Undertale. * Address Feedback
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs36
1 files changed, 34 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs b/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
index 8e4ac5e2..856d52a9 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
@@ -1,4 +1,5 @@
using Ryujinx.Common;
+using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Device;
using Ryujinx.Graphics.Gpu.Engine.Threed;
using Ryujinx.Graphics.Texture;
@@ -99,10 +100,31 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
}
/// <summary>
+ /// Releases a semaphore for a given LaunchDma method call.
+ /// </summary>
+ /// <param name="argument">The LaunchDma call argument</param>
+ private void ReleaseSemaphore(int argument)
+ {
+ LaunchDmaSemaphoreType type = (LaunchDmaSemaphoreType)((argument >> 3) & 0x3);
+ if (type != LaunchDmaSemaphoreType.None)
+ {
+ ulong address = ((ulong)_state.State.SetSemaphoreA << 32) | _state.State.SetSemaphoreB;
+ if (type == LaunchDmaSemaphoreType.ReleaseOneWordSemaphore)
+ {
+ _channel.MemoryManager.Write(address, _state.State.SetSemaphorePayload);
+ }
+ else /* if (type == LaunchDmaSemaphoreType.ReleaseFourWordSemaphore) */
+ {
+ Logger.Warning?.Print(LogClass.Gpu, "DMA semaphore type ReleaseFourWordSemaphore was used, but is not currently implemented.");
+ }
+ }
+ }
+
+ /// <summary>
/// Performs a buffer to buffer, or buffer to texture copy.
/// </summary>
- /// <param name="argument">Method call argument</param>
- private void LaunchDma(int argument)
+ /// <param name="argument">The LaunchDma call argument</param>
+ private void DmaCopy(int argument)
{
var memoryManager = _channel.MemoryManager;
@@ -296,5 +318,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
}
}
}
+
+ /// <summary>
+ /// Performs a buffer to buffer, or buffer to texture copy, then optionally releases a semaphore.
+ /// </summary>
+ /// <param name="argument">Method call argument</param>
+ private void LaunchDma(int argument)
+ {
+ DmaCopy(argument);
+ ReleaseSemaphore(argument);
+ }
}
}