aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/Multithreading
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.GAL/Multithreading')
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs4
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/CommandType.cs2
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs25
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs20
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs12
5 files changed, 63 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs b/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs
index 82a75ea7..47ceeb7d 100644
--- a/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs
+++ b/Ryujinx.Graphics.GAL/Multithreading/CommandHelper.cs
@@ -181,8 +181,12 @@ namespace Ryujinx.Graphics.GAL.Multithreading
SetLineParametersCommand.Run(ref GetCommand<SetLineParametersCommand>(memory), threaded, renderer);
_lookup[(int)CommandType.SetLogicOpState] = (Span<byte> memory, ThreadedRenderer threaded, IRenderer renderer) =>
SetLogicOpStateCommand.Run(ref GetCommand<SetLogicOpStateCommand>(memory), threaded, renderer);
+ _lookup[(int)CommandType.SetPatchParameters] = (Span<byte> memory, ThreadedRenderer threaded, IRenderer renderer) =>
+ SetPatchParametersCommand.Run(ref GetCommand<SetPatchParametersCommand>(memory), threaded, renderer);
_lookup[(int)CommandType.SetPointParameters] = (Span<byte> memory, ThreadedRenderer threaded, IRenderer renderer) =>
SetPointParametersCommand.Run(ref GetCommand<SetPointParametersCommand>(memory), threaded, renderer);
+ _lookup[(int)CommandType.SetPolygonMode] = (Span<byte> memory, ThreadedRenderer threaded, IRenderer renderer) =>
+ SetPolygonModeCommand.Run(ref GetCommand<SetPolygonModeCommand>(memory), threaded, renderer);
_lookup[(int)CommandType.SetPrimitiveRestart] = (Span<byte> memory, ThreadedRenderer threaded, IRenderer renderer) =>
SetPrimitiveRestartCommand.Run(ref GetCommand<SetPrimitiveRestartCommand>(memory), threaded, renderer);
_lookup[(int)CommandType.SetPrimitiveTopology] = (Span<byte> memory, ThreadedRenderer threaded, IRenderer renderer) =>
diff --git a/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs b/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs
index 0761a7f0..ac73a3fe 100644
--- a/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs
+++ b/Ryujinx.Graphics.GAL/Multithreading/CommandType.cs
@@ -72,7 +72,9 @@
SetIndexBuffer,
SetLineParameters,
SetLogicOpState,
+ SetPatchParameters,
SetPointParameters,
+ SetPolygonMode,
SetPrimitiveRestart,
SetPrimitiveTopology,
SetProgram,
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs
new file mode 100644
index 00000000..7847e8d0
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPatchParametersCommand.cs
@@ -0,0 +1,25 @@
+using Ryujinx.Common.Memory;
+using System;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands
+{
+ struct SetPatchParametersCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.SetPatchParameters;
+ private int _vertices;
+ private Array4<float> _defaultOuterLevel;
+ private Array2<float> _defaultInnerLevel;
+
+ public void Set(int vertices, ReadOnlySpan<float> defaultOuterLevel, ReadOnlySpan<float> defaultInnerLevel)
+ {
+ _vertices = vertices;
+ defaultOuterLevel.CopyTo(_defaultOuterLevel.ToSpan());
+ defaultInnerLevel.CopyTo(_defaultInnerLevel.ToSpan());
+ }
+
+ public static void Run(ref SetPatchParametersCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.Pipeline.SetPatchParameters(command._vertices, command._defaultOuterLevel.ToSpan(), command._defaultInnerLevel.ToSpan());
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs
new file mode 100644
index 00000000..6de78f04
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/SetPolygonModeCommand.cs
@@ -0,0 +1,20 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands
+{
+ struct SetPolygonModeCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.SetPolygonMode;
+ private PolygonMode _frontMode;
+ private PolygonMode _backMode;
+
+ public void Set(PolygonMode frontMode, PolygonMode backMode)
+ {
+ _frontMode = frontMode;
+ _backMode = backMode;
+ }
+
+ public static void Run(ref SetPolygonModeCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.Pipeline.SetPolygonMode(command._frontMode, command._backMode);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs b/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs
index 0f523481..3c39a77f 100644
--- a/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs
+++ b/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs
@@ -179,12 +179,24 @@ namespace Ryujinx.Graphics.GAL.Multithreading
_renderer.QueueCommand();
}
+ public void SetPatchParameters(int vertices, ReadOnlySpan<float> defaultOuterLevel, ReadOnlySpan<float> defaultInnerLevel)
+ {
+ _renderer.New<SetPatchParametersCommand>().Set(vertices, defaultOuterLevel, defaultInnerLevel);
+ _renderer.QueueCommand();
+ }
+
public void SetPointParameters(float size, bool isProgramPointSize, bool enablePointSprite, Origin origin)
{
_renderer.New<SetPointParametersCommand>().Set(size, isProgramPointSize, enablePointSprite, origin);
_renderer.QueueCommand();
}
+ public void SetPolygonMode(PolygonMode frontMode, PolygonMode backMode)
+ {
+ _renderer.New<SetPolygonModeCommand>().Set(frontMode, backMode);
+ _renderer.QueueCommand();
+ }
+
public void SetPrimitiveRestart(bool enable, int index)
{
_renderer.New<SetPrimitiveRestartCommand>().Set(enable, index);