aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.ShaderTools/Program.cs
blob: e763e2c1c12daf25c794ecad287a1a5a3799a95a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Shader.Translation;
using System;
using System.IO;

namespace Ryujinx.ShaderTools
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length == 2)
            {
                GalShaderType type = GalShaderType.Vertex;

                switch (args[0].ToLower())
                {
                    case "v":  type = GalShaderType.Vertex;         break;
                    case "tc": type = GalShaderType.TessControl;    break;
                    case "te": type = GalShaderType.TessEvaluation; break;
                    case "g":  type = GalShaderType.Geometry;       break;
                    case "f":  type = GalShaderType.Fragment;       break;
                }

                using (FileStream fs = new FileStream(args[1], FileMode.Open, FileAccess.Read))
                {
                    Memory mem = new Memory(fs);

                    ShaderConfig config = new ShaderConfig(type, 65536);

                    string code = Translator.Translate(mem, 0, config).Code;

                    Console.WriteLine(code);
                }
            }
            else
            {
                Console.WriteLine("Usage: Ryujinx.ShaderTools [v|tc|te|g|f] shader.bin");
            }
        }
    }
}