2018-05-17 14:25:42 -04:00
|
|
|
using System;
|
|
|
|
|
2018-04-08 15:17:35 -04:00
|
|
|
namespace Ryujinx.Graphics.Gal.Shader
|
|
|
|
{
|
|
|
|
static partial class ShaderDecode
|
|
|
|
{
|
2018-09-18 00:30:35 -04:00
|
|
|
public static void Bra(ShaderIrBlock Block, long OpCode, int Position)
|
2018-05-17 14:25:42 -04:00
|
|
|
{
|
|
|
|
if ((OpCode & 0x20) != 0)
|
|
|
|
{
|
|
|
|
//This reads the target offset from the constant buffer.
|
|
|
|
//Almost impossible to support with GLSL.
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2018-09-18 00:30:35 -04:00
|
|
|
ShaderIrOperImm Imm = new ShaderIrOperImm(Position + OpCode.Branch());
|
2018-05-17 14:25:42 -04:00
|
|
|
|
2018-09-08 13:51:50 -04:00
|
|
|
Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Bra, Imm)));
|
2018-05-17 14:25:42 -04:00
|
|
|
}
|
|
|
|
|
2018-09-18 00:30:35 -04:00
|
|
|
public static void Exit(ShaderIrBlock Block, long OpCode, int Position)
|
2018-04-08 15:17:35 -04:00
|
|
|
{
|
2018-06-27 22:55:08 -04:00
|
|
|
int CCode = (int)OpCode & 0x1f;
|
|
|
|
|
|
|
|
//TODO: Figure out what the other condition codes mean...
|
|
|
|
if (CCode == 0xf)
|
|
|
|
{
|
2018-09-08 13:51:50 -04:00
|
|
|
Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Exit)));
|
2018-06-27 22:55:08 -04:00
|
|
|
}
|
2018-04-08 15:17:35 -04:00
|
|
|
}
|
|
|
|
|
2018-09-18 00:30:35 -04:00
|
|
|
public static void Kil(ShaderIrBlock Block, long OpCode, int Position)
|
2018-04-08 15:17:35 -04:00
|
|
|
{
|
2018-09-08 13:51:50 -04:00
|
|
|
Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Kil)));
|
2018-04-08 15:17:35 -04:00
|
|
|
}
|
2018-08-31 12:14:04 -04:00
|
|
|
|
2018-09-18 00:30:35 -04:00
|
|
|
public static void Ssy(ShaderIrBlock Block, long OpCode, int Position)
|
2018-08-31 12:14:04 -04:00
|
|
|
{
|
|
|
|
if ((OpCode & 0x20) != 0)
|
|
|
|
{
|
|
|
|
//This reads the target offset from the constant buffer.
|
|
|
|
//Almost impossible to support with GLSL.
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2018-09-18 00:30:35 -04:00
|
|
|
ShaderIrOperImm Imm = new ShaderIrOperImm(Position + OpCode.Branch());
|
2018-08-31 12:14:04 -04:00
|
|
|
|
|
|
|
Block.AddNode(new ShaderIrOp(ShaderIrInst.Ssy, Imm));
|
|
|
|
}
|
|
|
|
|
2018-09-18 00:30:35 -04:00
|
|
|
public static void Sync(ShaderIrBlock Block, long OpCode, int Position)
|
2018-08-31 12:14:04 -04:00
|
|
|
{
|
|
|
|
//TODO: Implement Sync condition codes
|
2018-09-08 13:51:50 -04:00
|
|
|
Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Sync)));
|
2018-08-31 12:14:04 -04:00
|
|
|
}
|
2018-04-08 15:17:35 -04:00
|
|
|
}
|
|
|
|
}
|