diff options
author | gdkchan <gab.dark.100@gmail.com> | 2018-05-17 15:25:42 -0300 |
---|---|---|
committer | gdkchan <gab.dark.100@gmail.com> | 2018-05-17 15:25:42 -0300 |
commit | b19c4740823ed8fcebf62bf5741a7614a2ac0aa0 (patch) | |
tree | 8cdede3fdb90aa35ffe50c004559b80d4704bea3 /Ryushader/Program.cs | |
parent | 9b9ead94cd2f25a85468ecf91b7898bf34e10825 (diff) |
Added more shader instructions, including BFE, BRA (partial), FMNMX, ISCADD, SHL, LD_C, some shader related fixes, added support for texture component selection
Diffstat (limited to 'Ryushader/Program.cs')
-rw-r--r-- | Ryushader/Program.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Ryushader/Program.cs b/Ryushader/Program.cs new file mode 100644 index 00000000..21eb3d79 --- /dev/null +++ b/Ryushader/Program.cs @@ -0,0 +1,48 @@ +using Ryujinx.Graphics.Gal; +using Ryujinx.Graphics.Gal.Shader; +using System; +using System.IO; + +namespace Ryushader +{ + class Program + { + static void Main(string[] args) + { + if (args.Length == 2) + { + GlslDecompiler Decompiler = new GlslDecompiler(); + + GalShaderType ShaderType = GalShaderType.Vertex; + + switch (args[0].ToLower()) + { + case "v": ShaderType = GalShaderType.Vertex; break; + case "tc": ShaderType = GalShaderType.TessControl; break; + case "te": ShaderType = GalShaderType.TessEvaluation; break; + case "g": ShaderType = GalShaderType.Geometry; break; + case "f": ShaderType = GalShaderType.Fragment; break; + } + + byte[] Data = File.ReadAllBytes(args[1]); + + int[] Code = new int[Data.Length / 4]; + + for (int Offset = 0; Offset < Data.Length; Offset += 4) + { + int Value = BitConverter.ToInt32(Data, Offset); + + Code[Offset >> 2] = Value; + } + + GlslProgram Program = Decompiler.Decompile(Code, ShaderType); + + Console.WriteLine(Program.Code); + } + else + { + Console.WriteLine("Usage: Ryushader [v|tc|te|g|f] shader.bin"); + } + } + } +} |