aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs b/src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs
index 073e120a..714a9d68 100644
--- a/src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs
+++ b/src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs
@@ -7,11 +7,11 @@ namespace Ryujinx.Graphics.Shader.Translation
{
static class FunctionMatch
{
- private static IPatternTreeNode[] _fsiGetAddressTree = PatternTrees.GetFsiGetAddress();
- private static IPatternTreeNode[] _fsiGetAddressV2Tree = PatternTrees.GetFsiGetAddressV2();
- private static IPatternTreeNode[] _fsiIsLastWarpThreadPatternTree = PatternTrees.GetFsiIsLastWarpThread();
- private static IPatternTreeNode[] _fsiBeginPatternTree = PatternTrees.GetFsiBeginPattern();
- private static IPatternTreeNode[] _fsiEndPatternTree = PatternTrees.GetFsiEndPattern();
+ private static readonly IPatternTreeNode[] _fsiGetAddressTree = PatternTrees.GetFsiGetAddress();
+ private static readonly IPatternTreeNode[] _fsiGetAddressV2Tree = PatternTrees.GetFsiGetAddressV2();
+ private static readonly IPatternTreeNode[] _fsiIsLastWarpThreadPatternTree = PatternTrees.GetFsiIsLastWarpThread();
+ private static readonly IPatternTreeNode[] _fsiBeginPatternTree = PatternTrees.GetFsiBeginPattern();
+ private static readonly IPatternTreeNode[] _fsiEndPatternTree = PatternTrees.GetFsiEndPattern();
public static void RunPass(DecodedProgram program)
{
@@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Shader.Translation
private enum TreeNodeType : byte
{
Op,
- Label
+ Label,
}
private class TreeNode
@@ -150,9 +150,9 @@ namespace Ryujinx.Graphics.Shader.Translation
private static TreeNode[] BuildTree(Block[] blocks)
{
- List<TreeNode> nodes = new List<TreeNode>();
+ List<TreeNode> nodes = new();
- Dictionary<ulong, TreeNode> labels = new Dictionary<ulong, TreeNode>();
+ Dictionary<ulong, TreeNode> labels = new();
TreeNodeUse[] predDefs = new TreeNodeUse[RegisterConsts.PredsCount];
TreeNodeUse[] gprDefs = new TreeNodeUse[RegisterConsts.GprsCount];
@@ -223,7 +223,7 @@ namespace Ryujinx.Graphics.Shader.Translation
if (block.Predecessors.Count > 1)
{
- TreeNode label = new TreeNode(order++);
+ TreeNode label = new(order++);
nodes.Add(label);
labels.Add(block.Address, label);
}
@@ -232,7 +232,7 @@ namespace Ryujinx.Graphics.Shader.Translation
{
InstOp op = block.OpCodes[opIndex];
- TreeNode node = new TreeNode(op, IsOrderDependant(op.Name) ? order : (byte)0);
+ TreeNode node = new(op, IsOrderDependant(op.Name) ? order : (byte)0);
// Add uses.
@@ -288,7 +288,7 @@ namespace Ryujinx.Graphics.Shader.Translation
InstProps.SPd => 30,
InstProps.TPd => 51,
InstProps.VPd => 45,
- _ => throw new InvalidOperationException($"Table has unknown predicate destination {pdType}.")
+ _ => throw new InvalidOperationException($"Table has unknown predicate destination {pdType}."),
};
byte predIndex = (byte)((op.RawOpCode >> bit) & 7);
@@ -350,7 +350,7 @@ namespace Ryujinx.Graphics.Shader.Translation
public IPatternTreeNode Node { get; }
public int Index { get; }
public bool Inverted { get; }
- public PatternTreeNodeUse Inv => new PatternTreeNodeUse(Index, !Inverted, Node);
+ public PatternTreeNodeUse Inv => new(Index, !Inverted, Node);
private PatternTreeNodeUse(int index, bool inverted, IPatternTreeNode node)
{
@@ -373,7 +373,7 @@ namespace Ryujinx.Graphics.Shader.Translation
public TreeNodeType Type { get; }
public byte Order { get; }
public bool IsImm { get; }
- public PatternTreeNodeUse Out => new PatternTreeNodeUse(0, this);
+ public PatternTreeNodeUse Out => new(0, this);
public PatternTreeNode(InstName name, Func<T, bool> match, TreeNodeType type = TreeNodeType.Op, byte order = 0, bool isImm = false)
{
@@ -435,7 +435,7 @@ namespace Ryujinx.Graphics.Shader.Translation
}
DecodedFunction callTarget = program.GetFunctionByAddress(callOp.GetAbsoluteAddress());
- TreeNode[] callTargetTree = null;
+ TreeNode[] callTargetTree;
if (callTarget == null || !Matches(_fsiIsLastWarpThreadPatternTree, callTargetTree = BuildTree(callTarget.Blocks)))
{
@@ -548,7 +548,7 @@ namespace Ryujinx.Graphics.Shader.Translation
.Use(PT)
.Use(orderingTicketValue).Out),
Iadd(x: true, 0, 405).Use(PT).Use(RZ),
- Ret().Use(PT)
+ Ret().Use(PT),
};
}
@@ -576,7 +576,7 @@ namespace Ryujinx.Graphics.Shader.Translation
.Use(PT)
.Use(orderingTicketValue).Out).Out),
Iadd(x: true, 0, 405).Use(PT).Use(RZ),
- Ret().Use(PT)
+ Ret().Use(PT),
};
}
@@ -603,7 +603,7 @@ namespace Ryujinx.Graphics.Shader.Translation
.Use(threadKillValue).OutAt(1))
.Use(RZ).Out).OutAt(1)).Out)
.Use(laneIdValue),
- Ret().Use(PT)
+ Ret().Use(PT),
};
}
@@ -638,7 +638,7 @@ namespace Ryujinx.Graphics.Shader.Translation
.Use(PT)
.Use(addressLowValue).Out).Inv)
.Use(label.Out),
- Ret().Use(PT)
+ Ret().Use(PT),
};
}
@@ -684,7 +684,7 @@ namespace Ryujinx.Graphics.Shader.Translation
.Use(incrementValue)
.Use(popcResult)
.Use(RZ).Out).Out),
- Ret().Use(PT)
+ Ret().Use(PT),
};
}
@@ -806,7 +806,6 @@ namespace Ryujinx.Graphics.Shader.Translation
private static PatternTreeNodeUse PT => PTOrRZ();
private static PatternTreeNodeUse RZ => PTOrRZ();
- private static PatternTreeNodeUse Undef => new PatternTreeNodeUse(0, null);
private static PatternTreeNodeUse CallArg(int index)
{