/ src / Ryujinx.Graphics.Gpu / Shader / ShaderDumpPaths.cs
ShaderDumpPaths.cs
 1  using Ryujinx.Graphics.Shader;
 2  
 3  namespace Ryujinx.Graphics.Gpu.Shader
 4  {
 5      /// <summary>
 6      /// Paths where shader code was dumped on disk.
 7      /// </summary>
 8      readonly struct ShaderDumpPaths
 9      {
10          /// <summary>
11          /// Path where the full shader code with header was dumped, or null if not dumped.
12          /// </summary>
13          public string FullPath { get; }
14  
15          /// <summary>
16          /// Path where the shader code without header was dumped, or null if not dumped.
17          /// </summary>
18          public string CodePath { get; }
19  
20          /// <summary>
21          /// True if the shader was dumped, false otherwise.
22          /// </summary>
23          public bool HasPath => FullPath != null && CodePath != null;
24  
25          /// <summary>
26          /// Creates a new shader dumps path structure.
27          /// </summary>
28          /// <param name="fullPath">Path where the full shader code with header was dumped, or null if not dumped</param>
29          /// <param name="codePath">Path where the shader code without header was dumped, or null if not dumped</param>
30          public ShaderDumpPaths(string fullPath, string codePath)
31          {
32              FullPath = fullPath;
33              CodePath = codePath;
34          }
35  
36          /// <summary>
37          /// Prepends the shader paths on the program source, as a comment.
38          /// </summary>
39          /// <param name="program">Program to prepend into</param>
40          public void Prepend(ShaderProgram program)
41          {
42              if (HasPath)
43              {
44                  program.Prepend("// " + CodePath);
45                  program.Prepend("// " + FullPath);
46              }
47          }
48      }
49  }