2018-05-17 19:25:42 +01:00
|
|
|
|
using Ryujinx.Graphics.Gal;
|
|
|
|
|
using Ryujinx.Graphics.Gal.Shader;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
2018-06-11 01:46:42 +01:00
|
|
|
|
namespace Ryujinx.ShaderTools
|
2018-05-17 19:25:42 +01:00
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
2018-12-18 00:32:12 +00:00
|
|
|
|
private static readonly int MaxUboSize = 65536;
|
|
|
|
|
|
2018-05-17 19:25:42 +01:00
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length == 2)
|
|
|
|
|
{
|
2019-02-28 01:12:24 +00:00
|
|
|
|
GlslDecompiler Decompiler = new GlslDecompiler(MaxUboSize, true);
|
2018-05-17 19:25:42 +01:00
|
|
|
|
|
|
|
|
|
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 02:43:31 +01:00
|
|
|
|
using (FileStream FS = new FileStream(args[1], FileMode.Open, FileAccess.Read))
|
2018-05-17 19:25:42 +01:00
|
|
|
|
{
|
2018-05-23 02:43:31 +01:00
|
|
|
|
Memory Mem = new Memory(FS);
|
2018-05-17 19:25:42 +01:00
|
|
|
|
|
2018-05-23 02:43:31 +01:00
|
|
|
|
GlslProgram Program = Decompiler.Decompile(Mem, 0, ShaderType);
|
2018-05-17 19:25:42 +01:00
|
|
|
|
|
2018-05-23 02:43:31 +01:00
|
|
|
|
Console.WriteLine(Program.Code);
|
|
|
|
|
}
|
2018-05-17 19:25:42 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-06-11 01:46:42 +01:00
|
|
|
|
Console.WriteLine("Usage: Ryujinx.ShaderTools [v|tc|te|g|f] shader.bin");
|
2018-05-17 19:25:42 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|