diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2021-08-11 17:27:00 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-11 22:27:00 +0200 |
| commit | ed754af8d5046d2fd7218c742521e38ab17cbcfe (patch) | |
| tree | d47eda40349a7b4b3fc34d9db9ddeea8f2d0676a /Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs | |
| parent | 10d649e6d3ad3e4af32d2b41e718bb0a2924da67 (diff) | |
Make sure attributes used on subsequent shader stages are initialized (#2538)
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs b/Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs new file mode 100644 index 00000000..f96a8ce1 --- /dev/null +++ b/Ryujinx.Graphics.Gpu/Shader/ShaderDumpPaths.cs @@ -0,0 +1,49 @@ +using Ryujinx.Graphics.Shader; + +namespace Ryujinx.Graphics.Gpu.Shader +{ + /// <summary> + /// Paths where shader code was dumped on disk. + /// </summary> + struct ShaderDumpPaths + { + /// <summary> + /// Path where the full shader code with header was dumped, or null if not dumped. + /// </summary> + public string FullPath { get; } + + /// <summary> + /// Path where the shader code without header was dumped, or null if not dumped. + /// </summary> + public string CodePath { get; } + + /// <summary> + /// True if the shader was dumped, false otherwise. + /// </summary> + public bool HasPath => FullPath != null && CodePath != null; + + /// <summary> + /// Creates a new shader dumps path structure. + /// </summary> + /// <param name="fullPath">Path where the full shader code with header was dumped, or null if not dumped</param> + /// <param name="codePath">Path where the shader code without header was dumped, or null if not dumped</param> + public ShaderDumpPaths(string fullPath, string codePath) + { + FullPath = fullPath; + CodePath = codePath; + } + + /// <summary> + /// Prepends the shader paths on the program source, as a comment. + /// </summary> + /// <param name="program">Program to prepend into</param> + public void Prepend(ShaderProgram program) + { + if (HasPath) + { + program.Prepend("// " + CodePath); + program.Prepend("// " + FullPath); + } + } + } +}
\ No newline at end of file |
