/ src / Ryujinx.Graphics.GAL / Multithreading / Commands / Buffer / BufferGetDataCommand.cs
BufferGetDataCommand.cs
 1  using Ryujinx.Graphics.GAL.Multithreading.Model;
 2  
 3  namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Buffer
 4  {
 5      struct BufferGetDataCommand : IGALCommand, IGALCommand<BufferGetDataCommand>
 6      {
 7          public readonly CommandType CommandType => CommandType.BufferGetData;
 8          private BufferHandle _buffer;
 9          private int _offset;
10          private int _size;
11          private TableRef<ResultBox<PinnedSpan<byte>>> _result;
12  
13          public void Set(BufferHandle buffer, int offset, int size, TableRef<ResultBox<PinnedSpan<byte>>> result)
14          {
15              _buffer = buffer;
16              _offset = offset;
17              _size = size;
18              _result = result;
19          }
20  
21          public static void Run(ref BufferGetDataCommand command, ThreadedRenderer threaded, IRenderer renderer)
22          {
23              PinnedSpan<byte> result = renderer.GetBufferData(threaded.Buffers.MapBuffer(command._buffer), command._offset, command._size);
24  
25              command._result.Get(threaded).Result = result;
26          }
27      }
28  }