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