aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.GAL/Multithreading/Commands
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-04-07 18:25:55 -0300
committerGitHub <noreply@github.com>2024-04-07 18:25:55 -0300
commit3e6e0e4afaa3c3ffb118cb17b61feb16966a7eeb (patch)
treea4652499c089b0853e39c382cad82a9db4d6ad08 /src/Ryujinx.Graphics.GAL/Multithreading/Commands
parent808803d97a0c06809bf000687c252f960048fcf0 (diff)
Add support for large sampler arrays on Vulkan (#6489)
* Add support for large sampler arrays on Vulkan * Shader cache version bump * Format whitespace * Move DescriptorSetManager to PipelineLayoutCacheEntry to allow different pool sizes per layout * Handle array textures with different types on the same buffer * Somewhat better caching system * Avoid useless buffer data modification checks * Move redundant bindings update checking to the backend * Fix an issue where texture arrays would get the same bindings across stages on Vulkan * Backport some fixes from part 2 * Fix typo * PR feedback * Format whitespace * Add some missing XML docs
Diffstat (limited to 'src/Ryujinx.Graphics.GAL/Multithreading/Commands')
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetFormatsCommand.cs26
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetImagesCommand.cs27
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateImageArrayCommand.cs25
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureArrayCommand.cs25
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageArrayCommand.cs26
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureArrayCommand.cs26
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetSamplersCommand.cs27
-rw-r--r--src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetTexturesCommand.cs27
8 files changed, 209 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetFormatsCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetFormatsCommand.cs
new file mode 100644
index 00000000..8e3ba88a
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetFormatsCommand.cs
@@ -0,0 +1,26 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.ImageArray
+{
+ struct ImageArraySetFormatsCommand : IGALCommand, IGALCommand<ImageArraySetFormatsCommand>
+ {
+ public readonly CommandType CommandType => CommandType.ImageArraySetFormats;
+ private TableRef<ThreadedImageArray> _imageArray;
+ private int _index;
+ private TableRef<Format[]> _imageFormats;
+
+ public void Set(TableRef<ThreadedImageArray> imageArray, int index, TableRef<Format[]> imageFormats)
+ {
+ _imageArray = imageArray;
+ _index = index;
+ _imageFormats = imageFormats;
+ }
+
+ public static void Run(ref ImageArraySetFormatsCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedImageArray imageArray = command._imageArray.Get(threaded);
+ imageArray.Base.SetFormats(command._index, command._imageFormats.Get(threaded));
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetImagesCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetImagesCommand.cs
new file mode 100644
index 00000000..cc28d585
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/ImageArray/ImageArraySetImagesCommand.cs
@@ -0,0 +1,27 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using System.Linq;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.ImageArray
+{
+ struct ImageArraySetImagesCommand : IGALCommand, IGALCommand<ImageArraySetImagesCommand>
+ {
+ public readonly CommandType CommandType => CommandType.ImageArraySetImages;
+ private TableRef<ThreadedImageArray> _imageArray;
+ private int _index;
+ private TableRef<ITexture[]> _images;
+
+ public void Set(TableRef<ThreadedImageArray> imageArray, int index, TableRef<ITexture[]> images)
+ {
+ _imageArray = imageArray;
+ _index = index;
+ _images = images;
+ }
+
+ public static void Run(ref ImageArraySetImagesCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedImageArray imageArray = command._imageArray.Get(threaded);
+ imageArray.Base.SetImages(command._index, command._images.Get(threaded).Select(texture => ((ThreadedTexture)texture)?.Base).ToArray());
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateImageArrayCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateImageArrayCommand.cs
new file mode 100644
index 00000000..1c3fb812
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateImageArrayCommand.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 CreateImageArrayCommand : IGALCommand, IGALCommand<CreateImageArrayCommand>
+ {
+ public readonly CommandType CommandType => CommandType.CreateImageArray;
+ private TableRef<ThreadedImageArray> _imageArray;
+ private int _size;
+ private bool _isBuffer;
+
+ public void Set(TableRef<ThreadedImageArray> imageArray, int size, bool isBuffer)
+ {
+ _imageArray = imageArray;
+ _size = size;
+ _isBuffer = isBuffer;
+ }
+
+ public static void Run(ref CreateImageArrayCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._imageArray.Get(threaded).Base = renderer.CreateImageArray(command._size, command._isBuffer);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureArrayCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureArrayCommand.cs
new file mode 100644
index 00000000..9bd891e6
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateTextureArrayCommand.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 CreateTextureArrayCommand : IGALCommand, IGALCommand<CreateTextureArrayCommand>
+ {
+ public readonly CommandType CommandType => CommandType.CreateTextureArray;
+ private TableRef<ThreadedTextureArray> _textureArray;
+ private int _size;
+ private bool _isBuffer;
+
+ public void Set(TableRef<ThreadedTextureArray> textureArray, int size, bool isBuffer)
+ {
+ _textureArray = textureArray;
+ _size = size;
+ _isBuffer = isBuffer;
+ }
+
+ public static void Run(ref CreateTextureArrayCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ command._textureArray.Get(threaded).Base = renderer.CreateTextureArray(command._size, command._isBuffer);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageArrayCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageArrayCommand.cs
new file mode 100644
index 00000000..b8d3c7ac
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetImageArrayCommand.cs
@@ -0,0 +1,26 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using Ryujinx.Graphics.Shader;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands
+{
+ struct SetImageArrayCommand : IGALCommand, IGALCommand<SetImageArrayCommand>
+ {
+ public readonly CommandType CommandType => CommandType.SetImageArray;
+ private ShaderStage _stage;
+ private int _binding;
+ private TableRef<IImageArray> _array;
+
+ public void Set(ShaderStage stage, int binding, TableRef<IImageArray> array)
+ {
+ _stage = stage;
+ _binding = binding;
+ _array = array;
+ }
+
+ public static void Run(ref SetImageArrayCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.Pipeline.SetImageArray(command._stage, command._binding, command._array.GetAs<ThreadedImageArray>(threaded)?.Base);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureArrayCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureArrayCommand.cs
new file mode 100644
index 00000000..45e28aa6
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/SetTextureArrayCommand.cs
@@ -0,0 +1,26 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using Ryujinx.Graphics.Shader;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands
+{
+ struct SetTextureArrayCommand : IGALCommand, IGALCommand<SetTextureArrayCommand>
+ {
+ public readonly CommandType CommandType => CommandType.SetTextureArray;
+ private ShaderStage _stage;
+ private int _binding;
+ private TableRef<ITextureArray> _array;
+
+ public void Set(ShaderStage stage, int binding, TableRef<ITextureArray> array)
+ {
+ _stage = stage;
+ _binding = binding;
+ _array = array;
+ }
+
+ public static void Run(ref SetTextureArrayCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ renderer.Pipeline.SetTextureArray(command._stage, command._binding, command._array.GetAs<ThreadedTextureArray>(threaded)?.Base);
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetSamplersCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetSamplersCommand.cs
new file mode 100644
index 00000000..204ee32d
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetSamplersCommand.cs
@@ -0,0 +1,27 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using System.Linq;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.TextureArray
+{
+ struct TextureArraySetSamplersCommand : IGALCommand, IGALCommand<TextureArraySetSamplersCommand>
+ {
+ public readonly CommandType CommandType => CommandType.TextureArraySetSamplers;
+ private TableRef<ThreadedTextureArray> _textureArray;
+ private int _index;
+ private TableRef<ISampler[]> _samplers;
+
+ public void Set(TableRef<ThreadedTextureArray> textureArray, int index, TableRef<ISampler[]> samplers)
+ {
+ _textureArray = textureArray;
+ _index = index;
+ _samplers = samplers;
+ }
+
+ public static void Run(ref TextureArraySetSamplersCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTextureArray textureArray = command._textureArray.Get(threaded);
+ textureArray.Base.SetSamplers(command._index, command._samplers.Get(threaded).Select(sampler => ((ThreadedSampler)sampler)?.Base).ToArray());
+ }
+ }
+}
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetTexturesCommand.cs b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetTexturesCommand.cs
new file mode 100644
index 00000000..cc94d1b6
--- /dev/null
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/Commands/TextureAndSamplerArray/TextureArraySetTexturesCommand.cs
@@ -0,0 +1,27 @@
+using Ryujinx.Graphics.GAL.Multithreading.Model;
+using Ryujinx.Graphics.GAL.Multithreading.Resources;
+using System.Linq;
+
+namespace Ryujinx.Graphics.GAL.Multithreading.Commands.TextureArray
+{
+ struct TextureArraySetTexturesCommand : IGALCommand, IGALCommand<TextureArraySetTexturesCommand>
+ {
+ public readonly CommandType CommandType => CommandType.TextureArraySetTextures;
+ private TableRef<ThreadedTextureArray> _textureArray;
+ private int _index;
+ private TableRef<ITexture[]> _textures;
+
+ public void Set(TableRef<ThreadedTextureArray> textureArray, int index, TableRef<ITexture[]> textures)
+ {
+ _textureArray = textureArray;
+ _index = index;
+ _textures = textures;
+ }
+
+ public static void Run(ref TextureArraySetTexturesCommand command, ThreadedRenderer threaded, IRenderer renderer)
+ {
+ ThreadedTextureArray textureArray = command._textureArray.Get(threaded);
+ textureArray.Base.SetTextures(command._index, command._textures.Get(threaded).Select(texture => ((ThreadedTexture)texture)?.Base).ToArray());
+ }
+ }
+}