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