[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:
@ -27,9 +27,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
public AstAssignment(IAstNode destination, IAstNode source)
|
||||
{
|
||||
Destination = destination;
|
||||
Source = source;
|
||||
Source = source;
|
||||
|
||||
AddDef(destination, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
}
|
||||
}
|
||||
|
||||
private LinkedList<IAstNode> _nodes;
|
||||
private readonly LinkedList<IAstNode> _nodes;
|
||||
|
||||
public IAstNode First => _nodes.First?.Value;
|
||||
public IAstNode Last => _nodes.Last?.Value;
|
||||
@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
public AstBlock(AstBlockType type, IAstNode condition = null)
|
||||
{
|
||||
Type = type;
|
||||
Type = type;
|
||||
Condition = condition;
|
||||
|
||||
_nodes = new LinkedList<IAstNode>();
|
||||
@ -114,4 +114,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Else,
|
||||
ElseIf,
|
||||
Main,
|
||||
While
|
||||
While,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,4 +65,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Comment = comment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,9 +49,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
public static AstOperand Local(AggregateType type)
|
||||
{
|
||||
AstOperand local = new AstOperand(OperandType.LocalVariable);
|
||||
|
||||
local.VarType = type;
|
||||
AstOperand local = new(OperandType.LocalVariable)
|
||||
{
|
||||
VarType = type,
|
||||
};
|
||||
|
||||
return local;
|
||||
}
|
||||
@ -71,4 +72,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return node.LLNode.Previous?.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,4 +8,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
public LinkedListNode<IAstNode> LLNode { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Value = operand.Value;
|
||||
}
|
||||
|
||||
public AstOperand(OperandType type, int value = 0) : this()
|
||||
public AstOperand(OperandType type, int value = 0) : this()
|
||||
{
|
||||
Type = type;
|
||||
Type = type;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
public int Index { get; }
|
||||
|
||||
private IAstNode[] _sources;
|
||||
private readonly IAstNode[] _sources;
|
||||
|
||||
public int SourcesCount => _sources.Length;
|
||||
|
||||
@ -77,12 +77,18 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
switch (componentsCount)
|
||||
{
|
||||
case 2: type |= AggregateType.Vector2; break;
|
||||
case 3: type |= AggregateType.Vector3; break;
|
||||
case 4: type |= AggregateType.Vector4; break;
|
||||
case 2:
|
||||
type |= AggregateType.Vector2;
|
||||
break;
|
||||
case 3:
|
||||
type |= AggregateType.Vector3;
|
||||
break;
|
||||
case 4:
|
||||
type |= AggregateType.Vector4;
|
||||
break;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
// (this makes comparison with the disassembly easier).
|
||||
if (!context.Config.Options.Flags.HasFlag(TranslationFlags.DebugMode))
|
||||
{
|
||||
AstBlockVisitor visitor = new AstBlockVisitor(mainBlock);
|
||||
AstBlockVisitor visitor = new(mainBlock);
|
||||
|
||||
foreach (IAstNode node in visitor.Visit())
|
||||
{
|
||||
@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
private static bool IsWorthPropagating(IAstNode source)
|
||||
{
|
||||
if (!(source is AstOperation srcOp))
|
||||
if (source is not AstOperation srcOp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -87,7 +87,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
private static void RemoveEmptyBlocks(AstBlock mainBlock)
|
||||
{
|
||||
Queue<AstBlock> pending = new Queue<AstBlock>();
|
||||
Queue<AstBlock> pending = new();
|
||||
|
||||
pending.Enqueue(mainBlock);
|
||||
|
||||
@ -152,4 +152,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,4 +28,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Handle = handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,6 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
enum BufferLayout
|
||||
{
|
||||
Std140,
|
||||
Std430
|
||||
Std430,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using static Ryujinx.Graphics.Shader.StructuredIr.AstHelper;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
@ -110,16 +109,16 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
if (lLevel > rLevel)
|
||||
{
|
||||
block = lBlock;
|
||||
block = lBlock;
|
||||
blockLvl = lLevel;
|
||||
other = rBlock;
|
||||
other = rBlock;
|
||||
otherLvl = rLevel;
|
||||
}
|
||||
else /* if (rLevel > lLevel) */
|
||||
{
|
||||
block = rBlock;
|
||||
block = rBlock;
|
||||
blockLvl = rLevel;
|
||||
other = lBlock;
|
||||
other = lBlock;
|
||||
otherLvl = lLevel;
|
||||
}
|
||||
|
||||
@ -144,7 +143,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
AstBlock[] path = BackwardsPath(block, ParentBlock(stmt.Label));
|
||||
|
||||
AstBlock loopFirstStmt = path[path.Length - 1];
|
||||
AstBlock loopFirstStmt = path[^1];
|
||||
|
||||
if (loopFirstStmt.Type == AstBlockType.Else)
|
||||
{
|
||||
@ -194,7 +193,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
loopBlock.AddAfter(child, stmt.Goto);
|
||||
|
||||
block = loopBlock;
|
||||
block = loopBlock;
|
||||
gLevel = loopLevel;
|
||||
}
|
||||
}
|
||||
@ -252,7 +251,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
for (int index = path.Length - 1; index >= 0; index--)
|
||||
{
|
||||
AstBlock child = path[index];
|
||||
AstBlock last = child;
|
||||
AstBlock last = child;
|
||||
|
||||
if (child.Type == AstBlockType.If)
|
||||
{
|
||||
@ -265,7 +264,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
else if (child.Type == AstBlockType.Else)
|
||||
{
|
||||
// Modify the matching if condition to force the else to be entered by the goto.
|
||||
if (!(Previous(child) is AstBlock ifBlock) || ifBlock.Type != AstBlockType.If)
|
||||
if (Previous(child) is not AstBlock ifBlock || ifBlock.Type != AstBlockType.If)
|
||||
{
|
||||
throw new InvalidOperationException("Found an else without a matching if.");
|
||||
}
|
||||
@ -332,7 +331,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
AstBlock block = ParentBlock(stmt.Goto);
|
||||
|
||||
AstBlock newBlock = new AstBlock(AstBlockType.If, stmt.Condition);
|
||||
AstBlock newBlock = new(AstBlockType.If, stmt.Condition);
|
||||
|
||||
block.AddAfter(stmt.Goto, newBlock);
|
||||
|
||||
@ -340,11 +339,11 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
}
|
||||
|
||||
private static AstBlock Enclose(
|
||||
AstBlock block,
|
||||
AstBlock block,
|
||||
AstBlockType type,
|
||||
IAstNode cond,
|
||||
IAstNode first,
|
||||
IAstNode last = null)
|
||||
IAstNode cond,
|
||||
IAstNode first,
|
||||
IAstNode last = null)
|
||||
{
|
||||
if (first == last)
|
||||
{
|
||||
@ -367,7 +366,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return first as AstBlock;
|
||||
}
|
||||
|
||||
AstBlock newBlock = new AstBlock(type, cond);
|
||||
AstBlock newBlock = new(type, cond);
|
||||
|
||||
block.AddBefore(first, newBlock);
|
||||
|
||||
@ -387,7 +386,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
private static bool BlockMatches(IAstNode node, AstBlockType type, IAstNode cond)
|
||||
{
|
||||
if (!(node is AstBlock block))
|
||||
if (node is not AstBlock block)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -399,7 +398,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
if (lCond is AstOperation lCondOp && lCondOp.Inst == Instruction.LogicalNot)
|
||||
{
|
||||
if (!(rCond is AstOperation rCondOp) || rCondOp.Inst != lCondOp.Inst)
|
||||
if (rCond is not AstOperation rCondOp || rCondOp.Inst != lCondOp.Inst)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -418,7 +417,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return block.Parent;
|
||||
}
|
||||
|
||||
while (!(node is AstBlock))
|
||||
while (node is not AstBlock)
|
||||
{
|
||||
node = node.Parent;
|
||||
}
|
||||
@ -430,7 +429,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
AstBlock block = bottom;
|
||||
|
||||
List<AstBlock> path = new List<AstBlock>();
|
||||
List<AstBlock> path = new();
|
||||
|
||||
while (block != top)
|
||||
{
|
||||
@ -456,4 +455,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
class GotoStatement
|
||||
{
|
||||
public AstOperation Goto { get; }
|
||||
public AstOperation Goto { get; }
|
||||
public AstAssignment Label { get; }
|
||||
|
||||
public IAstNode Condition => Label.Destination;
|
||||
@ -15,9 +15,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
public GotoStatement(AstOperation branch, AstAssignment label, bool isLoop)
|
||||
{
|
||||
Goto = branch;
|
||||
Label = label;
|
||||
Goto = branch;
|
||||
Label = label;
|
||||
IsLoop = isLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,11 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
MultiplyHighS32 = 1 << 2,
|
||||
MultiplyHighU32 = 1 << 3,
|
||||
Shuffle = 1 << 4,
|
||||
ShuffleDown = 1 << 5,
|
||||
ShuffleUp = 1 << 6,
|
||||
ShuffleXor = 1 << 7,
|
||||
SwizzleAdd = 1 << 10,
|
||||
FSI = 1 << 11
|
||||
Shuffle = 1 << 4,
|
||||
ShuffleDown = 1 << 5,
|
||||
ShuffleUp = 1 << 6,
|
||||
ShuffleXor = 1 << 7,
|
||||
SwizzleAdd = 1 << 10,
|
||||
FSI = 1 << 11,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,4 +8,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
LinkedListNode<IAstNode> LLNode { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,13 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
}
|
||||
}
|
||||
|
||||
private static InstInfo[] _infoTbl;
|
||||
private static readonly InstInfo[] _infoTbl;
|
||||
|
||||
static InstructionInfo()
|
||||
{
|
||||
_infoTbl = new InstInfo[(int)Instruction.Count];
|
||||
|
||||
#pragma warning disable IDE0055 // Disable formatting
|
||||
// Inst Destination type Source 1 type Source 2 type Source 3 type Source 4 type
|
||||
Add(Instruction.AtomicAdd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32);
|
||||
Add(Instruction.AtomicAnd, AggregateType.U32, AggregateType.S32, AggregateType.S32, AggregateType.U32);
|
||||
@ -130,6 +131,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Add(Instruction.VoteAll, AggregateType.Bool, AggregateType.Bool);
|
||||
Add(Instruction.VoteAllEqual, AggregateType.Bool, AggregateType.Bool);
|
||||
Add(Instruction.VoteAny, AggregateType.Bool, AggregateType.Bool);
|
||||
#pragma warning restore IDE0055v
|
||||
}
|
||||
|
||||
private static void Add(Instruction inst, AggregateType destType, params AggregateType[] srcTypes)
|
||||
@ -201,4 +203,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return _infoTbl[(int)(inst & Instruction.Mask)].SrcTypes.Length == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,4 +41,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return $"{StorageKind}.{IoVariable}.{Location}.{Component}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
ArrayLength = arrayLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
OperandType.Argument => AggregateType.S32,
|
||||
OperandType.Constant => AggregateType.S32,
|
||||
OperandType.Undefined => AggregateType.S32,
|
||||
_ => throw new ArgumentException($"Invalid operand type \"{type}\".")
|
||||
_ => throw new ArgumentException($"Invalid operand type \"{type}\"."),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
BasicBlock srcBlock = phi.GetBlock(index);
|
||||
|
||||
Operation copyOp = new Operation(Instruction.Copy, phi.Dest, src);
|
||||
Operation copyOp = new(Instruction.Copy, phi.Dest, src);
|
||||
|
||||
srcBlock.Append(copyOp);
|
||||
}
|
||||
@ -42,4 +42,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,4 +48,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ using Ryujinx.Graphics.Shader.Translation;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
struct StructureField
|
||||
readonly struct StructureField
|
||||
{
|
||||
public AggregateType Type { get; }
|
||||
public string Name { get; }
|
||||
|
@ -39,4 +39,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
: InArguments[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
public static StructuredProgramInfo MakeStructuredProgram(IReadOnlyList<Function> functions, ShaderConfig config)
|
||||
{
|
||||
StructuredProgramContext context = new StructuredProgramContext(config);
|
||||
StructuredProgramContext context = new(config);
|
||||
|
||||
for (int funcIndex = 0; funcIndex < functions.Count; funcIndex++)
|
||||
{
|
||||
@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
AggregateType returnType = function.ReturnsValue ? AggregateType.S32 : AggregateType.Void;
|
||||
|
||||
AggregateType[] inArguments = new AggregateType[function.InArgumentsCount];
|
||||
AggregateType[] inArguments = new AggregateType[function.InArgumentsCount];
|
||||
AggregateType[] outArguments = new AggregateType[function.OutArgumentsCount];
|
||||
|
||||
for (int i = 0; i < inArguments.Length; i++)
|
||||
@ -79,7 +79,6 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
IoVariable ioVariable = (IoVariable)operation.GetSource(0).Value;
|
||||
bool isOutput = storageKind.IsOutput();
|
||||
bool perPatch = storageKind.IsPerPatch();
|
||||
int location = 0;
|
||||
int component = 0;
|
||||
|
||||
@ -169,9 +168,15 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
switch (componentsCount)
|
||||
{
|
||||
case 2: destType |= AggregateType.Vector2; break;
|
||||
case 3: destType |= AggregateType.Vector3; break;
|
||||
case 4: destType |= AggregateType.Vector4; break;
|
||||
case 2:
|
||||
destType |= AggregateType.Vector2;
|
||||
break;
|
||||
case 3:
|
||||
destType |= AggregateType.Vector3;
|
||||
break;
|
||||
case 4:
|
||||
destType |= AggregateType.Vector4;
|
||||
break;
|
||||
}
|
||||
|
||||
AstOperand destVec = context.NewTemp(destType);
|
||||
@ -181,7 +186,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
for (int i = 0; i < operation.DestsCount; i++)
|
||||
{
|
||||
AstOperand dest = context.GetOperand(operation.GetDest(i));
|
||||
AstOperand index = new AstOperand(OperandType.Constant, i);
|
||||
AstOperand index = new(OperandType.Constant, i);
|
||||
|
||||
dest.VarType = destElemType;
|
||||
|
||||
@ -202,7 +207,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
}
|
||||
|
||||
bool isCondSel = inst == Instruction.ConditionalSelect;
|
||||
bool isCopy = inst == Instruction.Copy;
|
||||
bool isCopy = inst == Instruction.Copy;
|
||||
|
||||
if (isCondSel || isCopy)
|
||||
{
|
||||
@ -304,9 +309,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
private static AggregateType GetVarTypeFromUses(Operand dest)
|
||||
{
|
||||
HashSet<Operand> visited = new HashSet<Operand>();
|
||||
HashSet<Operand> visited = new();
|
||||
|
||||
Queue<Operand> pending = new Queue<Operand>();
|
||||
Queue<Operand> pending = new();
|
||||
|
||||
bool Enqueue(Operand operand)
|
||||
{
|
||||
@ -385,7 +390,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
{
|
||||
Instruction.ImageLoad or
|
||||
Instruction.TextureSample => true,
|
||||
_ => false
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -396,7 +401,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Instruction.Branch or
|
||||
Instruction.BranchIfFalse or
|
||||
Instruction.BranchIfTrue => true,
|
||||
_ => false
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -408,7 +413,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Instruction.BitwiseExclusiveOr or
|
||||
Instruction.BitwiseNot or
|
||||
Instruction.BitwiseOr => true,
|
||||
_ => false
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -420,8 +425,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
Instruction.BitwiseExclusiveOr => Instruction.LogicalExclusiveOr,
|
||||
Instruction.BitwiseNot => Instruction.LogicalNot,
|
||||
Instruction.BitwiseOr => Instruction.LogicalOr,
|
||||
_ => throw new ArgumentException($"Unexpected instruction \"{inst}\".")
|
||||
_ => throw new ArgumentException($"Unexpected instruction \"{inst}\"."),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using Ryujinx.Graphics.Shader.Translation;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using static Ryujinx.Graphics.Shader.StructuredIr.AstHelper;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
@ -165,7 +164,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
// this is not valid as the loop condition would be evaluated,
|
||||
// and it could erroneously jump back to the start of the loop.
|
||||
bool inRange =
|
||||
block.Branch.Index < _currEndIndex ||
|
||||
block.Branch.Index < _currEndIndex ||
|
||||
(block.Branch.Index == _currEndIndex && block.Branch.Index < _loopEndIndex);
|
||||
|
||||
bool isLoop = block.Branch.Index <= block.Index;
|
||||
@ -184,11 +183,11 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
AddNode(Assign(gotoTempAsg.Destination, cond));
|
||||
|
||||
AstOperation branch = new AstOperation(branchOp.Inst);
|
||||
AstOperation branch = new(branchOp.Inst);
|
||||
|
||||
AddNode(branch);
|
||||
|
||||
GotoStatement gotoStmt = new GotoStatement(branch, gotoTempAsg, isLoop);
|
||||
GotoStatement gotoStmt = new(branch, gotoTempAsg, isLoop);
|
||||
|
||||
_gotos.Add(gotoStmt);
|
||||
}
|
||||
@ -236,13 +235,13 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
|
||||
private void NewBlock(AstBlockType type, IAstNode cond, int endIndex)
|
||||
{
|
||||
AstBlock childBlock = new AstBlock(type, cond);
|
||||
AstBlock childBlock = new(type, cond);
|
||||
|
||||
AddNode(childBlock);
|
||||
|
||||
_blockStack.Push((_currBlock, _currEndIndex, _loopEndIndex));
|
||||
|
||||
_currBlock = childBlock;
|
||||
_currBlock = childBlock;
|
||||
_currEndIndex = endIndex;
|
||||
|
||||
if (type == AstBlockType.DoWhile)
|
||||
@ -316,7 +315,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
new AstOperand(OperandType.Constant, binding),
|
||||
new AstOperand(OperandType.Constant, 0),
|
||||
new AstOperand(OperandType.Constant, vecIndex),
|
||||
new AstOperand(OperandType.Constant, elemIndex)
|
||||
new AstOperand(OperandType.Constant, elemIndex),
|
||||
};
|
||||
|
||||
return new AstOperation(Instruction.Load, StorageKind.ConstantBuffer, false, sources, sources.Length);
|
||||
@ -349,4 +348,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
return astOperand;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,4 +33,4 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
||||
IoDefinitions = new HashSet<IoDefinition>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user