diff options
author | TSRBerry <20988865+TSRBerry@users.noreply.github.com> | 2023-06-28 08:59:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 08:59:13 +0200 |
commit | 9becbd7d728fc2002c176dfd9d1d1aae86f86b12 (patch) | |
tree | 4aa3e608f438e706856ec8482c5053c13611caa4 /src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs | |
parent | e055217292e034e46ebadd2e839b301b996d7064 (diff) |
[Ryujinx.Graphics.Shader] Address dotnet-format issues (#5373)1.1.929
* dotnet format style --severity info
Some changes were manually reverted.
* Restore a few unused methods and variables
* Silence dotnet format IDE0060 warnings
* Silence dotnet format IDE0052 warnings
* Silence dotnet format IDE0059 warnings
* Address or silence dotnet format CA1069 warnings
* Address or silence dotnet format CA2211 warnings
* Address review comments
* Fix formatting for switch expressions
* Address most dotnet format whitespace warnings
* Apply dotnet format whitespace formatting
A few of them have been manually reverted and the corresponding warning was silenced
* Format if-blocks correctly
* Run dotnet format whitespace after rebase
* Run dotnet format style after rebase
* Run dotnet format whitespace after rebase
* Run dotnet format style after rebase
* Run dotnet format after rebase and remove unused usings
- analyzers
- style
- whitespace
* Disable 'prefer switch expression' rule
* Add comments to disabled warnings
* Fix naming rule violation, Convert shader properties to auto-property and convert values to const
* Simplify properties and array initialization, Use const when possible, Remove trailing commas
* Run dotnet format after rebase
* Address IDE0251 warnings
* Address a few disabled IDE0060 warnings
* Silence IDE0060 in .editorconfig
* Run dotnet format after rebase
* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"
This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.
* dotnet format whitespace after rebase
* First dotnet format pass
* Fix naming rule violations
* Add trailing commas
* Remove unused members and most unnecessary value assignments
* Remove more unnecessary assignments
* Remove NRE suppressor
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Shader/Translation/FunctionMatch.cs | 39 |
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) { |