0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 20:05:45 +00:00
ryujinx-fork/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs
gdkchan c8c86a3854
Fix for current framebuffer issues (#78)
[GPU] Fix some of the current framebuffer issues
2018-04-13 15:12:58 -03:00

48 lines
No EOL
1.2 KiB
C#

namespace Ryujinx.Graphics.Gal.Shader
{
static class ShaderDecoder
{
public static ShaderIrBlock DecodeBasicBlock(int[] Code, int Offset)
{
ShaderIrBlock Block = new ShaderIrBlock();
while (Offset + 2 <= Code.Length)
{
//Ignore scheduling instructions, which are
//written every 32 bytes.
if ((Offset & 7) == 0)
{
Offset += 2;
continue;
}
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;
}
}
return Block;
}
private static bool IsFlowChange(ShaderIrInst Inst)
{
return Inst == ShaderIrInst.Exit;
}
}
}