Add per-source type memory change tracking, simplified state change tracking, other fixes

This commit is contained in:
gdk 2019-10-26 14:50:52 -03:00 committed by Thog
parent 1b7d955195
commit 8cba252b23
40 changed files with 494 additions and 668 deletions

View file

@ -6,6 +6,5 @@ namespace Ryujinx.Graphics.Shader.Decoders
Green = 1 << 1,
Blue = 1 << 2,
Alpha = 1 << 3
}
}

View file

@ -2,6 +2,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
{
enum SystemRegister
{
ThreadId = 0x20,
ThreadIdX = 0x21,
ThreadIdY = 0x22,
ThreadIdZ = 0x23,

View file

@ -27,6 +27,20 @@ namespace Ryujinx.Graphics.Shader.Instructions
switch (sysReg)
{
case SystemRegister.ThreadId:
{
Operand tidX = Attribute(AttributeConsts.ThreadIdX);
Operand tidY = Attribute(AttributeConsts.ThreadIdY);
Operand tidZ = Attribute(AttributeConsts.ThreadIdZ);
tidY = context.ShiftLeft(tidY, Const(16));
tidZ = context.ShiftLeft(tidZ, Const(26));
src = context.BitwiseOr(tidX, context.BitwiseOr(tidY, tidZ));
break;
}
case SystemRegister.ThreadIdX: src = Attribute(AttributeConsts.ThreadIdX); break;
case SystemRegister.ThreadIdY: src = Attribute(AttributeConsts.ThreadIdY); break;
case SystemRegister.ThreadIdZ: src = Attribute(AttributeConsts.ThreadIdZ); break;

View file

@ -59,6 +59,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
Add(Instruction.ExponentB2, VariableType.Scalar, VariableType.Scalar);
Add(Instruction.Floor, VariableType.F32, VariableType.F32);
Add(Instruction.FusedMultiplyAdd, VariableType.F32, VariableType.F32, VariableType.F32, VariableType.F32);
Add(Instruction.ImageLoad, VariableType.F32);
Add(Instruction.ImageStore, VariableType.None);
Add(Instruction.IsNan, VariableType.Bool, VariableType.F32);
Add(Instruction.LoadAttribute, VariableType.F32, VariableType.S32, VariableType.S32);
Add(Instruction.LoadConstant, VariableType.F32, VariableType.S32, VariableType.S32);
@ -105,7 +107,11 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
public static VariableType GetSrcVarType(Instruction inst, int index)
{
if (inst == Instruction.TextureSample)
// TODO: Return correct type depending on source index,
// that can improve the decompiler output.
if (inst == Instruction.TextureSample ||
inst == Instruction.ImageLoad ||
inst == Instruction.ImageStore)
{
return VariableType.F32;
}