aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.GAL/Multithreading/Commands/Texture')
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs28
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs30
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs32
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs30
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs26
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs21
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs25
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs29
-rw-r--r--Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs23
9 files changed, 244 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs
new file mode 100644
index 00000000..112c1fd1
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToCommand.cs
@@ -0,0 +1,28 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureCopyToCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureCopyTo;
+ private TableRef<ThreadedTexture> _texture;
+ private TableRef<ThreadedTexture> _destination;
+ private int _firstLayer;
+ private int _firstLevel;
+
+ public void Set(TableRef<ThreadedTexture> texture, TableRef<ThreadedTexture> destination, int firstLayer, int firstLevel)
+ {
+ _texture = texture;
+ _destination = destination;
+ _firstLayer = firstLayer;
+ _firstLevel = firstLevel;
+ }
+
+ public static void Run(ref TextureCopyToCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTexture source = command._texture.Get(threaded);
+ source.Base.CopyTo(command._destination.Get(threaded).Base, command._firstLayer, command._firstLevel);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs
new file mode 100644
index 00000000..11843361
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToScaledCommand.cs
@@ -0,0 +1,30 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureCopyToScaledCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureCopyToScaled;
+ private TableRef<ThreadedTexture> _texture;
+ private TableRef<ThreadedTexture> _destination;
+ private Extents2D _srcRegion;
+ private Extents2D _dstRegion;
+ private bool _linearFilter;
+
+ public void Set(TableRef<ThreadedTexture> texture, TableRef<ThreadedTexture> destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter)
+ {
+ _texture = texture;
+ _destination = destination;
+ _srcRegion = srcRegion;
+ _dstRegion = dstRegion;
+ _linearFilter = linearFilter;
+ }
+
+ public static void Run(ref TextureCopyToScaledCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTexture source = command._texture.Get(threaded);
+ source.Base.CopyTo(command._destination.Get(threaded).Base, command._srcRegion, command._dstRegion, command._linearFilter);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs
new file mode 100644
index 00000000..363edb00
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCopyToSliceCommand.cs
@@ -0,0 +1,32 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureCopyToSliceCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureCopyToSlice;
+ private TableRef<ThreadedTexture> _texture;
+ private TableRef<ThreadedTexture> _destination;
+ private int _srcLayer;
+ private int _dstLayer;
+ private int _srcLevel;
+ private int _dstLevel;
+
+ public void Set(TableRef<ThreadedTexture> texture, TableRef<ThreadedTexture> destination, int srcLayer, int dstLayer, int srcLevel, int dstLevel)
+ {
+ _texture = texture;
+ _destination = destination;
+ _srcLayer = srcLayer;
+ _dstLayer = dstLayer;
+ _srcLevel = srcLevel;
+ _dstLevel = dstLevel;
+ }
+
+ public static void Run(ref TextureCopyToSliceCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTexture source = command._texture.Get(threaded);
+ source.Base.CopyTo(command._destination.Get(threaded).Base, command._srcLayer, command._dstLayer, command._srcLevel, command._dstLevel);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs
new file mode 100644
index 00000000..7c385407
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureCreateViewCommand.cs
@@ -0,0 +1,30 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureCreateViewCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureCreateView;
+ private TableRef<ThreadedTexture> _texture;
+ private TableRef<ThreadedTexture> _destination;
+ private TextureCreateInfo _info;
+ private int _firstLayer;
+ private int _firstLevel;
+
+ public void Set(TableRef<ThreadedTexture> texture, TableRef<ThreadedTexture> destination, TextureCreateInfo info, int firstLayer, int firstLevel)
+ {
+ _texture = texture;
+ _destination = destination;
+ _info = info;
+ _firstLayer = firstLayer;
+ _firstLevel = firstLevel;
+ }
+
+ public static void Run(ref TextureCreateViewCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTexture source = command._texture.Get(threaded);
+ command._destination.Get(threaded).Base = source.Base.CreateView(command._info, command._firstLayer, command._firstLevel);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs
new file mode 100644
index 00000000..9e7d0c64
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs
@@ -0,0 +1,26 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using System;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureGetDataCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureGetData;
+ private TableRef<ThreadedTexture> _texture;
+ private TableRef<ResultBox<PinnedSpan<byte>>> _result;
+
+ public void Set(TableRef<ThreadedTexture> texture, TableRef<ResultBox<PinnedSpan<byte>>> result)
+ {
+ _texture = texture;
+ _result = result;
+ }
+
+ public static void Run(ref TextureGetDataCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ReadOnlySpan<byte> result = command._texture.Get(threaded).Base.GetData();
+
+ command._result.Get(threaded).Result = new PinnedSpan<byte>(result);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs
new file mode 100644
index 00000000..591b2214
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureReleaseCommand.cs
@@ -0,0 +1,21 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureReleaseCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureRelease;
+ private TableRef<ThreadedTexture> _texture;
+
+ public void Set(TableRef<ThreadedTexture> texture)
+ {
+ _texture = texture;
+ }
+
+ public static void Run(ref TextureReleaseCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._texture.Get(threaded).Base.Release();
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs
new file mode 100644
index 00000000..a8a6d274
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataCommand.cs
@@ -0,0 +1,25 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using System;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureSetDataCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureSetData;
+ private TableRef<ThreadedTexture> _texture;
+ private TableRef<byte[]> _data;
+
+ public void Set(TableRef<ThreadedTexture> texture, TableRef<byte[]> data)
+ {
+ _texture = texture;
+ _data = data;
+ }
+
+ public static void Run(ref TextureSetDataCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTexture texture = command._texture.Get(threaded);
+ texture.Base.SetData(new ReadOnlySpan<byte>(command._data.Get(threaded)));
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs
new file mode 100644
index 00000000..0179ff11
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetDataSliceCommand.cs
@@ -0,0 +1,29 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using System;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureSetDataSliceCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureSetDataSlice;
+ private TableRef<ThreadedTexture> _texture;
+ private TableRef<byte[]> _data;
+ private int _layer;
+ private int _level;
+
+ public void Set(TableRef<ThreadedTexture> texture, TableRef<byte[]> data, int layer, int level)
+ {
+ _texture = texture;
+ _data = data;
+ _layer = layer;
+ _level = level;
+ }
+
+ public static void Run(ref TextureSetDataSliceCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTexture texture = command._texture.Get(threaded);
+ texture.Base.SetData(new ReadOnlySpan<byte>(command._data.Get(threaded)), command._layer, command._level);
+ }
+ }
+}
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs
new file mode 100644
index 00000000..f86a9c44
--- /dev/null
+++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureSetStorageCommand.cs
@@ -0,0 +1,23 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
+{
+ struct TextureSetStorageCommand : IGALCommand
+ {
+ public CommandType CommandType => CommandType.TextureSetStorage;
+ private TableRef<ThreadedTexture> _texture;
+ private BufferRange _storage;
+
+ public void Set(TableRef<ThreadedTexture> texture, BufferRange storage)
+ {
+ _texture = texture;
+ _storage = storage;
+ }
+
+ public static void Run(ref TextureSetStorageCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._texture.Get(threaded).Base.SetStorage(threaded.Buffers.MapBufferRange(command._storage));
+ }
+ }
+}