TransformPasses.cs
 1  using Ryujinx.Graphics.Shader.IntermediateRepresentation;
 2  using System.Collections.Generic;
 3  
 4  namespace Ryujinx.Graphics.Shader.Translation.Transforms
 5  {
 6      static class TransformPasses
 7      {
 8          public static void RunPass(TransformContext context)
 9          {
10              RunPass<DrawParametersReplace>(context);
11              RunPass<ForcePreciseEnable>(context);
12              RunPass<VectorComponentSelect>(context);
13              RunPass<TexturePass>(context);
14              RunPass<SharedStoreSmallIntCas>(context);
15              RunPass<SharedAtomicSignedCas>(context);
16              RunPass<ShufflePass>(context);
17              RunPass<VertexToCompute>(context);
18              RunPass<GeometryToCompute>(context);
19          }
20  
21          private static void RunPass<T>(TransformContext context) where T : ITransformPass
22          {
23              if (!T.IsEnabled(context.GpuAccessor, context.Stage, context.TargetLanguage, context.UsedFeatures))
24              {
25                  return;
26              }
27  
28              for (int blkIndex = 0; blkIndex < context.Blocks.Length; blkIndex++)
29              {
30                  BasicBlock block = context.Blocks[blkIndex];
31  
32                  for (LinkedListNode<INode> node = block.Operations.First; node != null; node = node.Next)
33                  {
34                      if (node.Value is not Operation)
35                      {
36                          continue;
37                      }
38  
39                      node = T.RunPass(context, node);
40                  }
41              }
42          }
43      }
44  }