Ryujinx/Ryujinx.ShaderTools/Program.cs
ReinUsesLisp cc298c676a SPIR-V Intermediate Shading Language support
* Enable from Ryujinx.conf

* Adapt to use OpenTK.NetStandard

* Implement usage of UBOs for GLSL and SPIR-V

* Fix a NVidia related issue

* Use constant from UniformBinding
2018-06-23 14:48:53 -03:00

63 lines
2.1 KiB
C#

using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Gal.Shader;
using System;
using System.IO;
using System.Text;
namespace Ryujinx.ShaderTools
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 4)
{
GalShaderType ShaderType = GalShaderType.Vertex;
switch (args[1].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;
}
using (FileStream Output = new FileStream(args[3], FileMode.Create))
using (FileStream FS = new FileStream(args[2], FileMode.Open, FileAccess.Read))
{
Memory Mem = new Memory(FS);
switch (args[0].ToLower())
{
case "glsl":
{
GlslDecompiler GlslDecompiler = new GlslDecompiler();
GlslProgram Program = GlslDecompiler.Decompile(Mem, 0, ShaderType);
Output.Write(System.Text.Encoding.UTF8.GetBytes(Program.Code));
break;
}
case "spirv":
{
SpirvDecompiler SpirvDecompiler = new SpirvDecompiler();
SpirvProgram Program = SpirvDecompiler.Decompile(Mem, 0, ShaderType);
Output.Write(Program.Bytecode);
break;
}
}
}
}
else
{
Console.WriteLine("Usage: Ryujinx.ShaderTools [spirv|glsl] [v|tc|te|g|f] shader.bin output.bin");
}
}
}
}