diff options
Diffstat (limited to 'Ryujinx.Graphics.GAL/Multithreading/Commands')
4 files changed, 17 insertions, 8 deletions
diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs index d3a255e7..031c6153 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Buffer/BufferGetDataCommand.cs @@ -21,9 +21,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Buffer public static void Run(ref BufferGetDataCommand command, ThreadedRenderer threaded, IRenderer renderer) { - ReadOnlySpan<byte> result = renderer.GetBufferData(threaded.Buffers.MapBuffer(command._buffer), command._offset, command._size); + PinnedSpan<byte> result = renderer.GetBufferData(threaded.Buffers.MapBuffer(command._buffer), command._offset, command._size); - command._result.Get(threaded).Result = new PinnedSpan<byte>(result); + command._result.Get(threaded).Result = result; } } } diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs index 4f01dea2..b36d8bbe 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Renderer/CreateBufferCommand.cs @@ -5,16 +5,25 @@ public CommandType CommandType => CommandType.CreateBuffer; private BufferHandle _threadedHandle; private int _size; + private BufferHandle _storageHint; - public void Set(BufferHandle threadedHandle, int size) + 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) { - threaded.Buffers.AssignBuffer(command._threadedHandle, renderer.CreateBuffer(command._size)); + 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/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs index 1f519ccd..91320d45 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataCommand.cs @@ -18,9 +18,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture public static void Run(ref TextureGetDataCommand command, ThreadedRenderer threaded, IRenderer renderer) { - ReadOnlySpan<byte> result = command._texture.Get(threaded).Base.GetData(); + PinnedSpan<byte> result = command._texture.Get(threaded).Base.GetData(); - command._result.Get(threaded).Result = new PinnedSpan<byte>(result); + command._result.Get(threaded).Result = result; } } } diff --git a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs index 5ac05971..ec06cc4d 100644 --- a/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs +++ b/Ryujinx.Graphics.GAL/Multithreading/Commands/Texture/TextureGetDataSliceCommand.cs @@ -22,9 +22,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture public static void Run(ref TextureGetDataSliceCommand command, ThreadedRenderer threaded, IRenderer renderer) { - ReadOnlySpan<byte> result = command._texture.Get(threaded).Base.GetData(command._layer, command._level); + PinnedSpan<byte> result = command._texture.Get(threaded).Base.GetData(command._layer, command._level); - command._result.Get(threaded).Result = new PinnedSpan<byte>(result); + command._result.Get(threaded).Result = result; } } } |