2018-05-17 18:25:42 +00:00
|
|
|
using System;
|
|
|
|
|
2018-04-08 19:17:35 +00:00
|
|
|
using static Ryujinx.Graphics.Gal.Shader.ShaderDecodeHelper;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.Shader
|
|
|
|
{
|
|
|
|
static partial class ShaderDecode
|
|
|
|
{
|
2018-08-31 16:14:04 +00:00
|
|
|
public static void Bra(ShaderIrBlock Block, long OpCode, long Position)
|
2018-05-17 18:25:42 +00:00
|
|
|
{
|
|
|
|
if ((OpCode & 0x20) != 0)
|
|
|
|
{
|
|
|
|
//This reads the target offset from the constant buffer.
|
|
|
|
//Almost impossible to support with GLSL.
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2018-05-29 23:37:10 +00:00
|
|
|
int Target = ((int)(OpCode >> 20) << 8) >> 8;
|
2018-05-17 18:25:42 +00:00
|
|
|
|
2018-05-29 23:37:10 +00:00
|
|
|
ShaderIrOperImm Imm = new ShaderIrOperImm(Target);
|
2018-05-17 18:25:42 +00:00
|
|
|
|
2018-05-29 23:37:10 +00:00
|
|
|
Block.AddNode(GetPredNode(new ShaderIrOp(ShaderIrInst.Bra, Imm), OpCode));
|
2018-05-17 18:25:42 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 16:14:04 +00:00
|
|
|
public static void Exit(ShaderIrBlock Block, long OpCode, long Position)
|
2018-04-08 19:17:35 +00:00
|
|
|
{
|
2018-06-28 02:55:08 +00:00
|
|
|
int CCode = (int)OpCode & 0x1f;
|
|
|
|
|
|
|
|
//TODO: Figure out what the other condition codes mean...
|
|
|
|
if (CCode == 0xf)
|
|
|
|
{
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrOp(ShaderIrInst.Exit), OpCode));
|
|
|
|
}
|
|
|
|
|
2018-04-08 19:17:35 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 16:14:04 +00:00
|
|
|
public static void Kil(ShaderIrBlock Block, long OpCode, long Position)
|
2018-04-08 19:17:35 +00:00
|
|
|
{
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrOp(ShaderIrInst.Kil), OpCode));
|
|
|
|
}
|
2018-08-31 16:14:04 +00:00
|
|
|
|
|
|
|
public static void Ssy(ShaderIrBlock Block, long OpCode, long Position)
|
|
|
|
{
|
|
|
|
if ((OpCode & 0x20) != 0)
|
|
|
|
{
|
|
|
|
//This reads the target offset from the constant buffer.
|
|
|
|
//Almost impossible to support with GLSL.
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
int Offset = ((int)(OpCode >> 20) << 8) >> 8;
|
|
|
|
|
|
|
|
int Target = (int)(Position + Offset);
|
|
|
|
|
|
|
|
ShaderIrOperImm Imm = new ShaderIrOperImm(Target);
|
|
|
|
|
|
|
|
Block.AddNode(new ShaderIrOp(ShaderIrInst.Ssy, Imm));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Sync(ShaderIrBlock Block, long OpCode, long Position)
|
|
|
|
{
|
|
|
|
//TODO: Implement Sync condition codes
|
|
|
|
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrOp(ShaderIrInst.Sync), OpCode));
|
|
|
|
}
|
2018-04-08 19:17:35 +00:00
|
|
|
}
|
|
|
|
}
|