aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-06-28 08:59:13 +0200
committerGitHub <noreply@github.com>2023-06-28 08:59:13 +0200
commit9becbd7d728fc2002c176dfd9d1d1aae86f86b12 (patch)
tree4aa3e608f438e706856ec8482c5053c13611caa4 /src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs
parente055217292e034e46ebadd2e839b301b996d7064 (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/Optimizations/Optimizer.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs
index 8d2669c0..e7805027 100644
--- a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs
+++ b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/Optimizer.cs
@@ -60,7 +60,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
bool isUnused = IsUnused(node.Value);
- if (!(node.Value is Operation operation) || isUnused)
+ if (node.Value is not Operation operation || isUnused)
{
if (node.Value is PhiNode phi && !isUnused)
{
@@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
modified = true;
}
else if ((operation.Inst == Instruction.PackHalf2x16 && PropagatePack(operation)) ||
- (operation.Inst == Instruction.ShuffleXor && MatchDdxOrDdy(operation)))
+ (operation.Inst == Instruction.ShuffleXor && MatchDdxOrDdy(operation)))
{
if (DestHasNoUses(operation))
{
@@ -124,7 +124,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
// the destination operand.
Operand dest = copyOp.Dest;
- Operand src = copyOp.GetSource(0);
+ Operand src = copyOp.GetSource(0);
INode[] uses = dest.UseOps.ToArray();
@@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
foreach (INode useNode in uses)
{
- if (!(useNode is Operation operation) || operation.Inst != Instruction.UnpackHalf2x16)
+ if (useNode is not Operation operation || operation.Inst != Instruction.UnpackHalf2x16)
{
continue;
}
@@ -248,12 +248,12 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
foreach (INode use in uses)
{
- if (!(use is Operation test))
+ if (use is not Operation test)
{
continue;
}
- if (!(use is Operation useOp) || useOp.Inst != Instruction.SwizzleAdd)
+ if (use is not Operation useOp || useOp.Inst != Instruction.SwizzleAdd)
{
continue;
}
@@ -323,7 +323,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
Operand rhs = operation.GetSource(1);
// Check LHS of the the main multiplication operation. We expect an input being multiplied by gl_FragCoord.w.
- if (!(lhs.AsgOp is Operation attrMulOp) || attrMulOp.Inst != (Instruction.FP32 | Instruction.Multiply))
+ if (lhs.AsgOp is not Operation attrMulOp || attrMulOp.Inst != (Instruction.FP32 | Instruction.Multiply))
{
return;
}
@@ -338,7 +338,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
}
// RHS of the main multiplication should be a reciprocal operation (1.0 / x).
- if (!(rhs.AsgOp is Operation reciprocalOp) || reciprocalOp.Inst != (Instruction.FP32 | Instruction.Divide))
+ if (rhs.AsgOp is not Operation reciprocalOp || reciprocalOp.Inst != (Instruction.FP32 | Instruction.Divide))
{
return;
}
@@ -368,7 +368,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
// from all the use lists on the operands that this node uses.
block.Operations.Remove(llNode);
- Queue<INode> nodes = new Queue<INode>();
+ Queue<INode> nodes = new();
nodes.Enqueue(llNode.Value);
@@ -457,4 +457,4 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
return true;
}
}
-} \ No newline at end of file
+}