2018-05-17 20:25:42 +02:00
|
|
|
|
using Ryujinx.Graphics.Gal;
|
|
|
|
|
using Ryujinx.Graphics.Gal.Shader;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
2018-06-11 02:46:42 +02:00
|
|
|
|
namespace Ryujinx.ShaderTools
|
2018-05-17 20:25:42 +02:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-23 03:43:31 +02:00
|
|
|
|
using (FileStream FS = new FileStream(args[1], FileMode.Open, FileAccess.Read))
|
2018-05-17 20:25:42 +02:00
|
|
|
|
{
|
2018-05-23 03:43:31 +02:00
|
|
|
|
Memory Mem = new Memory(FS);
|
2018-05-17 20:25:42 +02:00
|
|
|
|
|
2018-05-23 03:43:31 +02:00
|
|
|
|
GlslProgram Program = Decompiler.Decompile(Mem, 0, ShaderType);
|
2018-05-17 20:25:42 +02:00
|
|
|
|
|
2018-05-23 03:43:31 +02:00
|
|
|
|
Console.WriteLine(Program.Code);
|
|
|
|
|
}
|
2018-05-17 20:25:42 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-06-11 02:46:42 +02:00
|
|
|
|
Console.WriteLine("Usage: Ryujinx.ShaderTools [v|tc|te|g|f] shader.bin");
|
2018-05-17 20:25:42 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|