TransformPasses.cs 1.5 KB

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