2018-04-08 20:17:35 +01:00
|
|
|
using static Ryujinx.Graphics.Gal.Shader.ShaderDecodeHelper;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.Shader
|
|
|
|
{
|
|
|
|
static partial class ShaderDecode
|
|
|
|
{
|
|
|
|
public static void Ld_A(ShaderIrBlock Block, long OpCode)
|
|
|
|
{
|
|
|
|
ShaderIrNode[] Opers = GetOperAbuf20(OpCode);
|
|
|
|
|
|
|
|
int Index = 0;
|
|
|
|
|
|
|
|
foreach (ShaderIrNode OperA in Opers)
|
|
|
|
{
|
|
|
|
ShaderIrOperGpr OperD = GetOperGpr0(OpCode);
|
|
|
|
|
|
|
|
OperD.Index += Index++;
|
|
|
|
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrAsg(OperD, OperA), OpCode));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void St_A(ShaderIrBlock Block, long OpCode)
|
|
|
|
{
|
|
|
|
ShaderIrNode[] Opers = GetOperAbuf20(OpCode);
|
|
|
|
|
|
|
|
int Index = 0;
|
|
|
|
|
|
|
|
foreach (ShaderIrNode OperA in Opers)
|
|
|
|
{
|
|
|
|
ShaderIrOperGpr OperD = GetOperGpr0(OpCode);
|
|
|
|
|
|
|
|
OperD.Index += Index++;
|
|
|
|
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrAsg(OperA, OperD), OpCode));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-10 20:50:32 +01:00
|
|
|
public static void Texq(ShaderIrBlock Block, long OpCode)
|
|
|
|
{
|
|
|
|
ShaderIrNode OperD = GetOperGpr0(OpCode);
|
|
|
|
ShaderIrNode OperA = GetOperGpr8(OpCode);
|
|
|
|
|
|
|
|
ShaderTexqInfo Info = (ShaderTexqInfo)((OpCode >> 22) & 0x1f);
|
|
|
|
|
|
|
|
ShaderIrMetaTexq Meta0 = new ShaderIrMetaTexq(Info, 0);
|
|
|
|
ShaderIrMetaTexq Meta1 = new ShaderIrMetaTexq(Info, 1);
|
|
|
|
|
|
|
|
ShaderIrNode OperC = GetOperImm13_36(OpCode);
|
|
|
|
|
|
|
|
ShaderIrOp Op0 = new ShaderIrOp(ShaderIrInst.Texq, OperA, null, OperC, Meta0);
|
|
|
|
ShaderIrOp Op1 = new ShaderIrOp(ShaderIrInst.Texq, OperA, null, OperC, Meta1);
|
|
|
|
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrAsg(OperD, Op0), OpCode));
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrAsg(OperA, Op1), OpCode)); //Is this right?
|
|
|
|
}
|
|
|
|
|
2018-04-08 20:17:35 +01:00
|
|
|
public static void Texs(ShaderIrBlock Block, long OpCode)
|
2018-04-10 20:50:32 +01:00
|
|
|
{
|
|
|
|
EmitTex(Block, OpCode, ShaderIrInst.Texs);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void Tlds(ShaderIrBlock Block, long OpCode)
|
|
|
|
{
|
|
|
|
EmitTex(Block, OpCode, ShaderIrInst.Txlf);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void EmitTex(ShaderIrBlock Block, long OpCode, ShaderIrInst Inst)
|
2018-04-08 20:17:35 +01:00
|
|
|
{
|
|
|
|
//TODO: Support other formats.
|
2018-04-10 20:50:32 +01:00
|
|
|
ShaderIrNode OperA = GetOperGpr8 (OpCode);
|
|
|
|
ShaderIrNode OperB = GetOperGpr20 (OpCode);
|
|
|
|
ShaderIrNode OperC = GetOperImm13_36(OpCode);
|
2018-04-08 20:17:35 +01:00
|
|
|
|
|
|
|
for (int Ch = 0; Ch < 4; Ch++)
|
|
|
|
{
|
2018-04-10 20:50:32 +01:00
|
|
|
ShaderIrOperGpr Dst = (Ch >> 1) != 0
|
|
|
|
? GetOperGpr28(OpCode)
|
|
|
|
: GetOperGpr0 (OpCode);
|
2018-04-08 20:17:35 +01:00
|
|
|
|
2018-04-10 20:50:32 +01:00
|
|
|
Dst.Index += Ch & 1;
|
2018-04-08 20:17:35 +01:00
|
|
|
|
2018-04-10 20:50:32 +01:00
|
|
|
ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch);
|
2018-04-08 20:17:35 +01:00
|
|
|
|
2018-04-10 20:50:32 +01:00
|
|
|
ShaderIrOp Op = new ShaderIrOp(Inst, OperA, OperB, OperC, Meta);
|
|
|
|
|
|
|
|
Block.AddNode(GetPredNode(new ShaderIrAsg(Dst, Op), OpCode));
|
|
|
|
}
|
2018-04-08 20:17:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|