TextureSetDataSliceRegionCommand.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  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 TextureSetDataSliceRegionCommand : IGALCommand
  7. {
  8. public CommandType CommandType => CommandType.TextureSetDataSliceRegion;
  9. private TableRef<ThreadedTexture> _texture;
  10. private TableRef<byte[]> _data;
  11. private int _layer;
  12. private int _level;
  13. private Rectangle<int> _region;
  14. public void Set(TableRef<ThreadedTexture> texture, TableRef<byte[]> data, int layer, int level, Rectangle<int> region)
  15. {
  16. _texture = texture;
  17. _data = data;
  18. _layer = layer;
  19. _level = level;
  20. _region = region;
  21. }
  22. public static void Run(ref TextureSetDataSliceRegionCommand command, ThreadedRenderer threaded, IRenderer renderer)
  23. {
  24. ThreadedTexture texture = command._texture.Get(threaded);
  25. texture.Base.SetData(new ReadOnlySpan<byte>(command._data.Get(threaded)), command._layer, command._level, command._region);
  26. }
  27. }
  28. }