mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-30 20:43:05 +00:00
cc298c676a
* 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
63 lines
2.1 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|
|
}
|