2018-05-17 19:25:42 +01:00
|
|
|
using System;
|
|
|
|
|
2018-04-08 20:17:35 +01:00
|
|
|
namespace Ryujinx.Graphics.Gal.Shader
|
|
|
|
{
|
|
|
|
static partial class ShaderDecode
|
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
public static void Bra(ShaderIrBlock block, long opCode, int position)
|
2018-05-17 19:25:42 +01:00
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
if ((opCode & 0x20) != 0)
|
2018-05-17 19:25:42 +01:00
|
|
|
{
|
|
|
|
//This reads the target offset from the constant buffer.
|
|
|
|
//Almost impossible to support with GLSL.
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
ShaderIrOperImm imm = new ShaderIrOperImm(position + opCode.Branch());
|
2018-05-17 19:25:42 +01:00
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
block.AddNode(opCode.PredNode(new ShaderIrOp(ShaderIrInst.Bra, imm)));
|
2018-05-17 19:25:42 +01:00
|
|
|
}
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
public static void Exit(ShaderIrBlock block, long opCode, int position)
|
2018-04-08 20:17:35 +01:00
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
int cCode = (int)opCode & 0x1f;
|
2018-06-28 03:55:08 +01:00
|
|
|
|
|
|
|
//TODO: Figure out what the other condition codes mean...
|
2019-03-04 01:45:25 +00:00
|
|
|
if (cCode == 0xf)
|
2018-06-28 03:55:08 +01:00
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
block.AddNode(opCode.PredNode(new ShaderIrOp(ShaderIrInst.Exit)));
|
2018-06-28 03:55:08 +01:00
|
|
|
}
|
2018-04-08 20:17:35 +01:00
|
|
|
}
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
public static void Kil(ShaderIrBlock block, long opCode, int position)
|
2018-04-08 20:17:35 +01:00
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
block.AddNode(opCode.PredNode(new ShaderIrOp(ShaderIrInst.Kil)));
|
2018-04-08 20:17:35 +01:00
|
|
|
}
|
2018-08-31 17:14:04 +01:00
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
public static void Ssy(ShaderIrBlock block, long opCode, int position)
|
2018-08-31 17:14:04 +01:00
|
|
|
{
|
2019-03-04 01:45:25 +00:00
|
|
|
if ((opCode & 0x20) != 0)
|
2018-08-31 17:14:04 +01:00
|
|
|
{
|
|
|
|
//This reads the target offset from the constant buffer.
|
|
|
|
//Almost impossible to support with GLSL.
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
ShaderIrOperImm imm = new ShaderIrOperImm(position + opCode.Branch());
|
2018-08-31 17:14:04 +01:00
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
block.AddNode(new ShaderIrOp(ShaderIrInst.Ssy, imm));
|
2018-08-31 17:14:04 +01:00
|
|
|
}
|
|
|
|
|
2019-03-04 01:45:25 +00:00
|
|
|
public static void Sync(ShaderIrBlock block, long opCode, int position)
|
2018-08-31 17:14:04 +01:00
|
|
|
{
|
|
|
|
//TODO: Implement Sync condition codes
|
2019-03-04 01:45:25 +00:00
|
|
|
block.AddNode(opCode.PredNode(new ShaderIrOp(ShaderIrInst.Sync)));
|
2018-08-31 17:14:04 +01:00
|
|
|
}
|
2018-04-08 20:17:35 +01:00
|
|
|
}
|
|
|
|
}
|