SetRenderTargetsCommand.cs 927 B

123456789101112131415161718192021222324
  1. using Ryujinx.Graphics.GAL.Multithreading.Model;
  2. using Ryujinx.Graphics.GAL.Multithreading.Resources;
  3. using System.Linq;
  4. namespace Ryujinx.Graphics.GAL.Multithreading.Commands
  5. {
  6. struct SetRenderTargetsCommand : IGALCommand
  7. {
  8. public CommandType CommandType => CommandType.SetRenderTargets;
  9. private TableRef<ITexture[]> _colors;
  10. private TableRef<ITexture> _depthStencil;
  11. public void Set(TableRef<ITexture[]> colors, TableRef<ITexture> depthStencil)
  12. {
  13. _colors = colors;
  14. _depthStencil = depthStencil;
  15. }
  16. public static void Run(ref SetRenderTargetsCommand command, ThreadedRenderer threaded, IRenderer renderer)
  17. {
  18. renderer.Pipeline.SetRenderTargets(command._colors.Get(threaded).Select(color => ((ThreadedTexture)color)?.Base).ToArray(), command._depthStencil.GetAs<ThreadedTexture>(threaded)?.Base);
  19. }
  20. }
  21. }