TextureGetDataCommand.cs 922 B

1234567891011121314151617181920212223242526
  1. using Ryujinx.Graphics.GAL.Multithreading.Model;
  2. using Ryujinx.Graphics.GAL.Multithreading.Resources;
  3. using System;
  4. namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Texture
  5. {
  6. struct TextureGetDataCommand : IGALCommand
  7. {
  8. public CommandType CommandType => CommandType.TextureGetData;
  9. private TableRef<ThreadedTexture> _texture;
  10. private TableRef<ResultBox<PinnedSpan<byte>>> _result;
  11. public void Set(TableRef<ThreadedTexture> texture, TableRef<ResultBox<PinnedSpan<byte>>> result)
  12. {
  13. _texture = texture;
  14. _result = result;
  15. }
  16. public static void Run(ref TextureGetDataCommand command, ThreadedRenderer threaded, IRenderer renderer)
  17. {
  18. ReadOnlySpan<byte> result = command._texture.Get(threaded).Base.GetData();
  19. command._result.Get(threaded).Result = new PinnedSpan<byte>(result);
  20. }
  21. }
  22. }