aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer')
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs21
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs29
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs28
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs23
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs22
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs25
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs20
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs12
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs30
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs18
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs12
11 files changed, 240 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs
new file mode 100644
index 00000000..41987da1
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ActionCommand.cs
@@ -0,0 +1,21 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using System;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct ActionCommand : IGALCommand, IGALCommand<ActionCommand>
+ {
+ public CommandType CommandType => CommandType.Action;
+ private TableRef<Action> _action;
+
+ public void Set(TableRef<Action> action)
+ {
+ _action = action;
+ }
+
+ public static void Run(ref ActionCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._action.Get(threaded)();
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs
new file mode 100644
index 00000000..b36d8bbe
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs
@@ -0,0 +1,29 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct CreateBufferCommand : IGALCommand, IGALCommand<CreateBufferCommand>
+ {
+ public CommandType CommandType => CommandType.CreateBuffer;
+ private BufferHandle _threadedHandle;
+ private int _size;
+ private BufferHandle _storageHint;
+
+ public void Set(BufferHandle threadedHandle, int size, BufferHandle storageHint)
+ {
+ _threadedHandle = threadedHandle;
+ _size = size;
+ _storageHint = storageHint;
+ }
+
+ public static void Run(ref CreateBufferCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ BufferHandle hint = BufferHandle.Null;
+
+ if (command._storageHint != BufferHandle.Null)
+ {
+ hint = threaded.Buffers.MapBuffer(command._storageHint);
+ }
+
+ threaded.Buffers.AssignBuffer(command._threadedHandle, renderer.CreateBuffer(command._size, hint));
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs
new file mode 100644
index 00000000..19563e12
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateProgramCommand.cs
@@ -0,0 +1,28 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources.Programs;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct CreateProgramCommand : IGALCommand, IGALCommand<CreateProgramCommand>
+ {
+ public CommandType CommandType => CommandType.CreateProgram;
+ private TableRef<IProgramRequest> _request;
+
+ public void Set(TableRef<IProgramRequest> request)
+ {
+ _request = request;
+ }
+
+ public static void Run(ref CreateProgramCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ IProgramRequest request = command._request.Get(threaded);
+
+ if (request.Threaded.Base == null)
+ {
+ request.Threaded.Base = request.Create(renderer);
+ }
+
+ threaded.Programs.ProcessQueue();
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs
new file mode 100644
index 00000000..6ab862d4
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSamplerCommand.cs
@@ -0,0 +1,23 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct CreateSamplerCommand : IGALCommand, IGALCommand<CreateSamplerCommand>
+ {
+ public CommandType CommandType => CommandType.CreateSampler;
+ private TableRef<ThreadedSampler> _sampler;
+ private SamplerCreateInfo _info;
+
+ public void Set(TableRef<ThreadedSampler> sampler, SamplerCreateInfo info)
+ {
+ _sampler = sampler;
+ _info = info;
+ }
+
+ public static void Run(ref CreateSamplerCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._sampler.Get(threaded).Base = renderer.CreateSampler(command._info);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs
new file mode 100644
index 00000000..32afb051
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateSyncCommand.cs
@@ -0,0 +1,22 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct CreateSyncCommand : IGALCommand, IGALCommand<CreateSyncCommand>
+ {
+ public CommandType CommandType => CommandType.CreateSync;
+ private ulong _id;
+ private bool _strict;
+
+ public void Set(ulong id, bool strict)
+ {
+ _id = id;
+ _strict = strict;
+ }
+
+ public static void Run(ref CreateSyncCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.CreateSync(command._id, command._strict);
+
+ threaded.Sync.AssignSync(command._id);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs
new file mode 100644
index 00000000..0347ded4
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureCommand.cs
@@ -0,0 +1,25 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct CreateTextureCommand : IGALCommand, IGALCommand<CreateTextureCommand>
+ {
+ public CommandType CommandType => CommandType.CreateTexture;
+ private TableRef<ThreadedTexture> _texture;
+ private TextureCreateInfo _info;
+ private float _scale;
+
+ public void Set(TableRef<ThreadedTexture> texture, TextureCreateInfo info, float scale)
+ {
+ _texture = texture;
+ _info = info;
+ _scale = scale;
+ }
+
+ public static void Run(ref CreateTextureCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._texture.Get(threaded).Base = renderer.CreateTexture(command._info, command._scale);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs
new file mode 100644
index 00000000..4111dcfd
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/GetCapabilitiesCommand.cs
@@ -0,0 +1,20 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct GetCapabilitiesCommand : IGALCommand, IGALCommand<GetCapabilitiesCommand>
+ {
+ public CommandType CommandType => CommandType.GetCapabilities;
+ private TableRef<ResultBox<Capabilities>> _result;
+
+ public void Set(TableRef<ResultBox<Capabilities>> result)
+ {
+ _result = result;
+ }
+
+ public static void Run(ref GetCapabilitiesCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._result.Get(threaded).Result = renderer.GetCapabilities();
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs
new file mode 100644
index 00000000..820908f3
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/PreFrameCommand.cs
@@ -0,0 +1,12 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct PreFrameCommand : IGALCommand, IGALCommand<PreFrameCommand>
+ {
+ public CommandType CommandType => CommandType.PreFrame;
+
+ public static void Run(ref PreFrameCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.PreFrame();
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs
new file mode 100644
index 00000000..4b0210cb
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ReportCounterCommand.cs
@@ -0,0 +1,30 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using System;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct ReportCounterCommand : IGALCommand, IGALCommand<ReportCounterCommand>
+ {
+ public CommandType CommandType => CommandType.ReportCounter;
+ private TableRef<ThreadedCounterEvent> _event;
+ private CounterType _type;
+ private TableRef<EventHandler<ulong>> _resultHandler;
+ private bool _hostReserved;
+
+ public void Set(TableRef<ThreadedCounterEvent> evt, CounterType type, TableRef<EventHandler<ulong>> resultHandler, bool hostReserved)
+ {
+ _event = evt;
+ _type = type;
+ _resultHandler = resultHandler;
+ _hostReserved = hostReserved;
+ }
+
+ public static void Run(ref ReportCounterCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedCounterEvent evt = command._event.Get(threaded);
+
+ evt.Create(renderer, command._type, command._resultHandler.Get(threaded), command._hostReserved);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs
new file mode 100644
index 00000000..3d796041
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/ResetCounterCommand.cs
@@ -0,0 +1,18 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct ResetCounterCommand : IGALCommand, IGALCommand<ResetCounterCommand>
+ {
+ public CommandType CommandType => CommandType.ResetCounter;
+ private CounterType _type;
+
+ public void Set(CounterType type)
+ {
+ _type = type;
+ }
+
+ public static void Run(ref ResetCounterCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.ResetCounter(command._type);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs
new file mode 100644
index 00000000..c7076c0e
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/UpdateCountersCommand.cs
@@ -0,0 +1,12 @@
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
+{
+ struct UpdateCountersCommand : IGALCommand, IGALCommand<UpdateCountersCommand>
+ {
+ public CommandType CommandType => CommandType.UpdateCounters;
+
+ public static void Run(ref UpdateCountersCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.UpdateCounters();
+ }
+ }
+}