DrawTextureCommand.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. using Ryujinx.Graphics.GAL.Multithreading.Model;
  2. using Ryujinx.Graphics.GAL.Multithreading.Resources;
  3. namespace Ryujinx.Graphics.GAL.Multithreading.Commands
  4. {
  5. struct DrawTextureCommand : IGALCommand, IGALCommand<DrawTextureCommand>
  6. {
  7. public CommandType CommandType => CommandType.DrawTexture;
  8. private TableRef<ITexture> _texture;
  9. private TableRef<ISampler> _sampler;
  10. private Extents2DF _srcRegion;
  11. private Extents2DF _dstRegion;
  12. public void Set(TableRef<ITexture> texture, TableRef<ISampler> sampler, Extents2DF srcRegion, Extents2DF dstRegion)
  13. {
  14. _texture = texture;
  15. _sampler = sampler;
  16. _srcRegion = srcRegion;
  17. _dstRegion = dstRegion;
  18. }
  19. public static void Run(ref DrawTextureCommand command, ThreadedRenderer threaded, IRenderer renderer)
  20. {
  21. renderer.Pipeline.DrawTexture(
  22. command._texture.GetAs<ThreadedTexture>(threaded)?.Base,
  23. command._sampler.GetAs<ThreadedSampler>(threaded)?.Base,
  24. command._srcRegion,
  25. command._dstRegion);
  26. }
  27. }
  28. }