/ src / Ryujinx.Graphics.GAL / Multithreading / Resources / ThreadedTextureArray.cs
ThreadedTextureArray.cs
 1  using Ryujinx.Graphics.GAL.Multithreading.Commands.TextureArray;
 2  using Ryujinx.Graphics.GAL.Multithreading.Model;
 3  using System.Linq;
 4  
 5  namespace Ryujinx.Graphics.GAL.Multithreading.Resources
 6  {
 7      /// <summary>
 8      /// Threaded representation of a texture and sampler array.
 9      /// </summary>
10      class ThreadedTextureArray : ITextureArray
11      {
12          private readonly ThreadedRenderer _renderer;
13          public ITextureArray Base;
14  
15          public ThreadedTextureArray(ThreadedRenderer renderer)
16          {
17              _renderer = renderer;
18          }
19  
20          private TableRef<T> Ref<T>(T reference)
21          {
22              return new TableRef<T>(_renderer, reference);
23          }
24  
25          public void Dispose()
26          {
27              _renderer.New<TextureArrayDisposeCommand>().Set(Ref(this));
28              _renderer.QueueCommand();
29          }
30  
31          public void SetSamplers(int index, ISampler[] samplers)
32          {
33              _renderer.New<TextureArraySetSamplersCommand>().Set(Ref(this), index, Ref(samplers.ToArray()));
34              _renderer.QueueCommand();
35          }
36  
37          public void SetTextures(int index, ITexture[] textures)
38          {
39              _renderer.New<TextureArraySetTexturesCommand>().Set(Ref(this), index, Ref(textures.ToArray()));
40              _renderer.QueueCommand();
41          }
42      }
43  }