SetTextureAndSamplerCommand.cs 1.1 KB

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