Initial work
This commit is contained in:
parent
f617fb542a
commit
1876b346fe
518 changed files with 15170 additions and 12486 deletions
|
@ -1,26 +0,0 @@
|
|||
using Ryujinx.Graphics.Gal;
|
||||
using System.IO;
|
||||
|
||||
namespace Ryujinx.ShaderTools
|
||||
{
|
||||
class Memory : IGalMemory
|
||||
{
|
||||
private Stream BaseStream;
|
||||
|
||||
private BinaryReader Reader;
|
||||
|
||||
public Memory(Stream BaseStream)
|
||||
{
|
||||
this.BaseStream = BaseStream;
|
||||
|
||||
Reader = new BinaryReader(BaseStream);
|
||||
}
|
||||
|
||||
public int ReadInt32(long Position)
|
||||
{
|
||||
BaseStream.Seek(Position, SeekOrigin.Begin);
|
||||
|
||||
return Reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
using Ryujinx.Graphics.Gal;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
using Ryujinx.Graphics.Shader.Translation;
|
||||
using Ryujinx.Graphics.Shader.Translation;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
|
@ -10,33 +8,26 @@ namespace Ryujinx.ShaderTools
|
|||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length == 2)
|
||||
if (args.Length == 1 || args.Length == 2)
|
||||
{
|
||||
GalShaderType type = GalShaderType.Vertex;
|
||||
TranslationFlags flags = TranslationFlags.None;
|
||||
|
||||
switch (args[0].ToLower())
|
||||
if (args.Length == 2 && args[0] == "--compute")
|
||||
{
|
||||
case "v": type = GalShaderType.Vertex; break;
|
||||
case "tc": type = GalShaderType.TessControl; break;
|
||||
case "te": type = GalShaderType.TessEvaluation; break;
|
||||
case "g": type = GalShaderType.Geometry; break;
|
||||
case "f": type = GalShaderType.Fragment; break;
|
||||
flags |= TranslationFlags.Compute;
|
||||
}
|
||||
|
||||
using (FileStream fs = new FileStream(args[1], FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
Memory mem = new Memory(fs);
|
||||
byte[] data = File.ReadAllBytes(args[args.Length - 1]);
|
||||
|
||||
ShaderConfig config = new ShaderConfig(type, 65536);
|
||||
TranslationConfig translationConfig = new TranslationConfig(0x10000, 0, flags);
|
||||
|
||||
string code = Translator.Translate(mem, 0, config).Code;
|
||||
string code = Translator.Translate(data, translationConfig).Code;
|
||||
|
||||
Console.WriteLine(code);
|
||||
}
|
||||
Console.WriteLine(code);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Usage: Ryujinx.ShaderTools [v|tc|te|g|f] shader.bin");
|
||||
Console.WriteLine("Usage: Ryujinx.ShaderTools [--compute] shader.bin");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ryujinx.Graphics.Shader\Ryujinx.Graphics.Shader.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
|
||||
|
@ -17,8 +21,4 @@
|
|||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ryujinx.Graphics\Ryujinx.Graphics.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue