mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-27 15:39:14 +00:00
@@ -167,6 +167,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
operation.TurnIntoCopy(Cbuf(cbufSlot, cbufOffset));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Instruction.Maximum:
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
return functionId;
|
||||
}
|
||||
|
||||
public bool TryGetFunctionId(Operation baseOp, bool isMultiTarget, IReadOnlyList<uint> targetCbs, out int functionId)
|
||||
public bool TryGetFunctionId(Operation baseOp, bool isMultiTarget, List<uint> targetCbs, out int functionId)
|
||||
{
|
||||
foreach (Entry entry in _entries)
|
||||
{
|
||||
@@ -281,19 +281,19 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
private static bool IsGlobalMemory(StorageKind storageKind)
|
||||
{
|
||||
return storageKind == StorageKind.GlobalMemory ||
|
||||
storageKind == StorageKind.GlobalMemoryS8 ||
|
||||
storageKind == StorageKind.GlobalMemoryS16 ||
|
||||
storageKind == StorageKind.GlobalMemoryU8 ||
|
||||
storageKind == StorageKind.GlobalMemoryU16;
|
||||
return storageKind is StorageKind.GlobalMemory or
|
||||
StorageKind.GlobalMemoryS8 or
|
||||
StorageKind.GlobalMemoryS16 or
|
||||
StorageKind.GlobalMemoryU8 or
|
||||
StorageKind.GlobalMemoryU16;
|
||||
}
|
||||
|
||||
private static bool IsSmallInt(StorageKind storageKind)
|
||||
{
|
||||
return storageKind == StorageKind.GlobalMemoryS8 ||
|
||||
storageKind == StorageKind.GlobalMemoryS16 ||
|
||||
storageKind == StorageKind.GlobalMemoryU8 ||
|
||||
storageKind == StorageKind.GlobalMemoryU16;
|
||||
return storageKind is StorageKind.GlobalMemoryS8 or
|
||||
StorageKind.GlobalMemoryS16 or
|
||||
StorageKind.GlobalMemoryU8 or
|
||||
StorageKind.GlobalMemoryU16;
|
||||
}
|
||||
|
||||
private static LinkedListNode<INode> ReplaceGlobalMemoryWithStorage(
|
||||
@@ -865,6 +865,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
return context.IMaximumS32(memValue, value);
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
case Instruction.AtomicMaxU32:
|
||||
resultValue = context.AtomicMaxU32(StorageKind.StorageBuffer, binding, Const(0), wordOffset, value);
|
||||
@@ -881,6 +882,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
return context.IMinimumS32(memValue, value);
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
case Instruction.AtomicMinU32:
|
||||
resultValue = context.AtomicMinU32(StorageKind.StorageBuffer, binding, Const(0), wordOffset, value);
|
||||
@@ -1100,7 +1102,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
{
|
||||
baseOffset = null;
|
||||
|
||||
if (operation.Inst == Instruction.Load || operation.Inst == Instruction.Store)
|
||||
if (operation.Inst is Instruction.Load or Instruction.Store)
|
||||
{
|
||||
if (operation.StorageKind == StorageKind.SharedMemory)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
{
|
||||
TryEliminateBinaryOpCommutative(operation, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Instruction.BitwiseOr:
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
return x == y || x.Type == OperandType.Constant || x.Type == OperandType.ConstantBuffer;
|
||||
}
|
||||
|
||||
private static bool AreAllSourcesEqual(INode node, INode otherNode)
|
||||
private static bool AreAllSourcesEqual(Operation node, Operation otherNode)
|
||||
{
|
||||
if (node.SourcesCount != otherNode.SourcesCount)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
private static bool IsConditionalBranch(Instruction inst)
|
||||
{
|
||||
return inst == Instruction.BranchIfFalse || inst == Instruction.BranchIfTrue;
|
||||
return inst is Instruction.BranchIfFalse or Instruction.BranchIfTrue;
|
||||
}
|
||||
|
||||
private static bool IsSameCondition(Operand currentCondition, Operand queryCondition)
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
{
|
||||
for (LinkedListNode<INode> node = block.Operations.First; node != null; node = node.Next)
|
||||
{
|
||||
if (!(node.Value is Operation operation))
|
||||
if (node.Value is not Operation operation)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -56,14 +56,14 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
Operand src1 = operation.GetSource(0);
|
||||
Operand src2 = operation.GetSource(1);
|
||||
|
||||
if (!(src2.AsgOp is Operation addOp) || addOp.Inst != Instruction.Add)
|
||||
if (src2.AsgOp is not Operation addOp || addOp.Inst != Instruction.Add)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Operand lowTimesLowResult = GetCopySource(addOp.GetSource(0));
|
||||
|
||||
if (!(lowTimesLowResult.AsgOp is Operation lowTimesLowOp))
|
||||
if (lowTimesLowResult.AsgOp is not Operation lowTimesLowOp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
Operand lowTimesHighResult = GetCopySource(GetShifted16Source(addOp.GetSource(1), Instruction.ShiftLeft));
|
||||
|
||||
if (!(lowTimesHighResult.AsgOp is Operation lowTimesHighOp))
|
||||
if (lowTimesHighResult.AsgOp is not Operation lowTimesHighOp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(src1.AsgOp is Operation highTimesHighOp))
|
||||
if (src1.AsgOp is not Operation highTimesHighOp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
Operand lowTimesLowResult = GetCopySource(src2);
|
||||
|
||||
if (!(lowTimesLowResult.AsgOp is Operation lowTimesLowOp))
|
||||
if (lowTimesLowResult.AsgOp is not Operation lowTimesLowOp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
Operand highTimesLowResult = src1;
|
||||
|
||||
if (!(highTimesLowResult.AsgOp is Operation highTimesLowOp))
|
||||
if (highTimesLowResult.AsgOp is not Operation highTimesLowOp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
if (operation.Inst == Instruction.Add)
|
||||
{
|
||||
if (!(operation.GetSource(0).AsgOp is Operation mulOp))
|
||||
if (operation.GetSource(0).AsgOp is not Operation mulOp)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
mulResult = GetCopySource(mulResult);
|
||||
|
||||
if (!(mulResult.AsgOp is Operation mulOp) || mulOp.Inst != Instruction.Multiply)
|
||||
if (mulResult.AsgOp is not Operation mulOp || mulOp.Inst != Instruction.Multiply)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
Operand mulResult = operation.GetSource(0);
|
||||
|
||||
if (!(mulResult.AsgOp is Operation mulOp) || mulOp.Inst != Instruction.Multiply)
|
||||
if (mulResult.AsgOp is not Operation mulOp || mulOp.Inst != Instruction.Multiply)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
Operand mulResult = operation.GetSource(0);
|
||||
|
||||
if (!(mulResult.AsgOp is Operation mulOp) || mulOp.Inst != Instruction.Multiply)
|
||||
if (mulResult.AsgOp is not Operation mulOp || mulOp.Inst != Instruction.Multiply)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
private static Operand GetMasked16Source(Operand value)
|
||||
{
|
||||
if (!(value.AsgOp is Operation maskOp))
|
||||
if (value.AsgOp is not Operation maskOp)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
||||
|
||||
private static Operand GetShifted16Source(Operand value, Instruction shiftInst)
|
||||
{
|
||||
if (!(value.AsgOp is Operation shiftOp))
|
||||
if (value.AsgOp is not Operation shiftOp)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user