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