[Ryujinx.Graphics.Shader] Address dotnet-format issues (#5373)

* 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
This commit is contained in:
TSRBerry 2023-06-28 08:59:13 +02:00 committed by GitHub
parent e055217292
commit 9becbd7d72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
162 changed files with 1611 additions and 1627 deletions

View file

@ -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;
}
}
}
}