Merge shader branch, adding support for GLSL decompilation, a macro
interpreter, and a rewrite of the GPU code.
This commit is contained in:
parent
7acd0e0122
commit
b9aa3966c0
77 changed files with 5301 additions and 766 deletions
41
Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
Normal file
41
Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
namespace Ryujinx.Graphics.Gal.Shader
|
||||
{
|
||||
static class ShaderDecoder
|
||||
{
|
||||
public static ShaderIrBlock DecodeBasicBlock(int[] Code, int Offset, GalShaderType ShaderType)
|
||||
{
|
||||
ShaderIrBlock Block = new ShaderIrBlock();
|
||||
|
||||
while (Offset + 2 <= Code.Length)
|
||||
{
|
||||
uint Word0 = (uint)Code[Offset++];
|
||||
uint Word1 = (uint)Code[Offset++];
|
||||
|
||||
long OpCode = Word0 | (long)Word1 << 32;
|
||||
|
||||
ShaderDecodeFunc Decode = ShaderOpCodeTable.GetDecoder(OpCode);
|
||||
|
||||
if (Decode == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Decode(Block, OpCode);
|
||||
|
||||
if (Block.GetLastNode() is ShaderIrOp Op && IsFlowChange(Op.Inst))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Block.RunOptimizationPasses(ShaderType);
|
||||
|
||||
return Block;
|
||||
}
|
||||
|
||||
private static bool IsFlowChange(ShaderIrInst Inst)
|
||||
{
|
||||
return Inst == ShaderIrInst.Exit;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue