diff --git a/Directory.Packages.props b/Directory.Packages.props
index c2ac358ed..f1d7cac61 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -42,7 +42,7 @@
-
+
diff --git a/src/ARMeilleure/CodeGen/Arm64/Arm64Optimizer.cs b/src/ARMeilleure/CodeGen/Arm64/Arm64Optimizer.cs
index 00ffd1958..979b471ac 100644
--- a/src/ARMeilleure/CodeGen/Arm64/Arm64Optimizer.cs
+++ b/src/ARMeilleure/CodeGen/Arm64/Arm64Optimizer.cs
@@ -13,13 +13,13 @@ namespace ARMeilleure.CodeGen.Arm64
public static void RunPass(ControlFlowGraph cfg)
{
- var constants = new Dictionary();
+ Dictionary constants = new Dictionary();
Operand GetConstantCopy(BasicBlock block, Operation operation, Operand source)
{
// If the constant has many uses, we also force a new constant mov to be added, in order
// to avoid overflow of the counts field (that is limited to 16 bits).
- if (!constants.TryGetValue(source.Value, out var constant) || constant.UsesCount > MaxConstantUses)
+ if (!constants.TryGetValue(source.Value, out Operand constant) || constant.UsesCount > MaxConstantUses)
{
constant = Local(source.Type);
diff --git a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs
index 41684faf2..47902ddc8 100644
--- a/src/ARMeilleure/CodeGen/Arm64/Assembler.cs
+++ b/src/ARMeilleure/CodeGen/Arm64/Assembler.cs
@@ -123,7 +123,7 @@ namespace ARMeilleure.CodeGen.Arm64
public void Cset(Operand rd, ArmCondition condition)
{
- var zr = Factory.Register(ZrRegister, RegisterType.Integer, rd.Type);
+ Operand zr = Factory.Register(ZrRegister, RegisterType.Integer, rd.Type);
Csinc(rd, zr, zr, (ArmCondition)((int)condition ^ 1));
}
diff --git a/src/ARMeilleure/CodeGen/Arm64/CodeGenContext.cs b/src/ARMeilleure/CodeGen/Arm64/CodeGenContext.cs
index 89b1e9e6b..ed271d24e 100644
--- a/src/ARMeilleure/CodeGen/Arm64/CodeGenContext.cs
+++ b/src/ARMeilleure/CodeGen/Arm64/CodeGenContext.cs
@@ -91,7 +91,7 @@ namespace ARMeilleure.CodeGen.Arm64
long target = _stream.Position;
- if (_pendingBranches.TryGetValue(block, out var list))
+ if (_pendingBranches.TryGetValue(block, out List<(ArmCondition Condition, long BranchPos)> list))
{
foreach ((ArmCondition condition, long branchPos) in list)
{
@@ -119,7 +119,7 @@ namespace ARMeilleure.CodeGen.Arm64
}
else
{
- if (!_pendingBranches.TryGetValue(target, out var list))
+ if (!_pendingBranches.TryGetValue(target, out List<(ArmCondition Condition, long BranchPos)> list))
{
list = new List<(ArmCondition, long)>();
_pendingBranches.Add(target, list);
diff --git a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs
index 2df86671a..6c422a5bb 100644
--- a/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs
+++ b/src/ARMeilleure/CodeGen/Arm64/CodeGenerator.cs
@@ -322,7 +322,7 @@ namespace ARMeilleure.CodeGen.Arm64
Debug.Assert(comp.Kind == OperandKind.Constant);
- var cond = ((Comparison)comp.AsInt32()).ToArmCondition();
+ ArmCondition cond = ((Comparison)comp.AsInt32()).ToArmCondition();
GenerateCompareCommon(context, operation);
@@ -354,7 +354,7 @@ namespace ARMeilleure.CodeGen.Arm64
Debug.Assert(dest.Type == OperandType.I32);
Debug.Assert(comp.Kind == OperandKind.Constant);
- var cond = ((Comparison)comp.AsInt32()).ToArmCondition();
+ ArmCondition cond = ((Comparison)comp.AsInt32()).ToArmCondition();
GenerateCompareCommon(context, operation);
diff --git a/src/ARMeilleure/CodeGen/Arm64/PreAllocator.cs b/src/ARMeilleure/CodeGen/Arm64/PreAllocator.cs
index f66bb66e6..e8193a9ab 100644
--- a/src/ARMeilleure/CodeGen/Arm64/PreAllocator.cs
+++ b/src/ARMeilleure/CodeGen/Arm64/PreAllocator.cs
@@ -847,7 +847,7 @@ namespace ARMeilleure.CodeGen.Arm64
Debug.Assert(comp.Kind == OperandKind.Constant);
- var compType = (Comparison)comp.AsInt32();
+ Comparison compType = (Comparison)comp.AsInt32();
return compType == Comparison.Equal || compType == Comparison.NotEqual;
}
diff --git a/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs b/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs
index 16feeb914..fa0b8aa24 100644
--- a/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs
+++ b/src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs
@@ -115,7 +115,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
{
NumberLocals(cfg, regMasks.RegistersCount);
- var context = new AllocationContext(stackAlloc, regMasks, _intervals.Count);
+ AllocationContext context = new AllocationContext(stackAlloc, regMasks, _intervals.Count);
BuildIntervals(cfg, context);
diff --git a/src/ARMeilleure/CodeGen/RegisterAllocators/LiveIntervalList.cs b/src/ARMeilleure/CodeGen/RegisterAllocators/LiveIntervalList.cs
index 84b892f42..b31d8fa78 100644
--- a/src/ARMeilleure/CodeGen/RegisterAllocators/LiveIntervalList.cs
+++ b/src/ARMeilleure/CodeGen/RegisterAllocators/LiveIntervalList.cs
@@ -15,12 +15,12 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
{
if (_count + 1 > _capacity)
{
- var oldSpan = Span;
+ Span oldSpan = Span;
_capacity = Math.Max(4, _capacity * 2);
_items = Allocators.References.Allocate((uint)_capacity);
- var newSpan = Span;
+ Span newSpan = Span;
oldSpan.CopyTo(newSpan);
}
diff --git a/src/ARMeilleure/CodeGen/RegisterAllocators/UseList.cs b/src/ARMeilleure/CodeGen/RegisterAllocators/UseList.cs
index 806002f83..c78201785 100644
--- a/src/ARMeilleure/CodeGen/RegisterAllocators/UseList.cs
+++ b/src/ARMeilleure/CodeGen/RegisterAllocators/UseList.cs
@@ -16,12 +16,12 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
{
if (Count + 1 > _capacity)
{
- var oldSpan = Span;
+ Span oldSpan = Span;
_capacity = Math.Max(4, _capacity * 2);
_items = Allocators.Default.Allocate((uint)_capacity);
- var newSpan = Span;
+ Span newSpan = Span;
oldSpan.CopyTo(newSpan);
}
diff --git a/src/ARMeilleure/CodeGen/X86/Assembler.cs b/src/ARMeilleure/CodeGen/X86/Assembler.cs
index 96f4de049..74774a8cf 100644
--- a/src/ARMeilleure/CodeGen/X86/Assembler.cs
+++ b/src/ARMeilleure/CodeGen/X86/Assembler.cs
@@ -1,5 +1,6 @@
using ARMeilleure.CodeGen.Linking;
using ARMeilleure.IntermediateRepresentation;
+using Microsoft.IO;
using Ryujinx.Common.Memory;
using System;
using System.Collections.Generic;
@@ -1324,8 +1325,8 @@ namespace ARMeilleure.CodeGen.X86
public (byte[], RelocInfo) GetCode()
{
- var jumps = CollectionsMarshal.AsSpan(_jumps);
- var relocs = CollectionsMarshal.AsSpan(_relocs);
+ Span jumps = CollectionsMarshal.AsSpan(_jumps);
+ Span relocs = CollectionsMarshal.AsSpan(_relocs);
// Write jump relative offsets.
bool modified;
@@ -1410,13 +1411,13 @@ namespace ARMeilleure.CodeGen.X86
// Write the code, ignoring the dummy bytes after jumps, into a new stream.
_stream.Seek(0, SeekOrigin.Begin);
- using var codeStream = MemoryStreamManager.Shared.GetStream();
- var assembler = new Assembler(codeStream, HasRelocs);
+ using RecyclableMemoryStream codeStream = MemoryStreamManager.Shared.GetStream();
+ Assembler assembler = new Assembler(codeStream, HasRelocs);
bool hasRelocs = HasRelocs;
int relocIndex = 0;
int relocOffset = 0;
- var relocEntries = hasRelocs
+ RelocEntry[] relocEntries = hasRelocs
? new RelocEntry[relocs.Length]
: Array.Empty();
@@ -1469,8 +1470,8 @@ namespace ARMeilleure.CodeGen.X86
_stream.CopyTo(codeStream);
- var code = codeStream.ToArray();
- var relocInfo = new RelocInfo(relocEntries);
+ byte[] code = codeStream.ToArray();
+ RelocInfo relocInfo = new RelocInfo(relocEntries);
return (code, relocInfo);
}
diff --git a/src/ARMeilleure/CodeGen/X86/CodeGenerator.cs b/src/ARMeilleure/CodeGen/X86/CodeGenerator.cs
index 9e94a077f..ab8612133 100644
--- a/src/ARMeilleure/CodeGen/X86/CodeGenerator.cs
+++ b/src/ARMeilleure/CodeGen/X86/CodeGenerator.cs
@@ -623,7 +623,7 @@ namespace ARMeilleure.CodeGen.X86
Debug.Assert(comp.Kind == OperandKind.Constant);
- var cond = ((Comparison)comp.AsInt32()).ToX86Condition();
+ X86Condition cond = ((Comparison)comp.AsInt32()).ToX86Condition();
GenerateCompareCommon(context, operation);
@@ -661,7 +661,7 @@ namespace ARMeilleure.CodeGen.X86
Debug.Assert(dest.Type == OperandType.I32);
Debug.Assert(comp.Kind == OperandKind.Constant);
- var cond = ((Comparison)comp.AsInt32()).ToX86Condition();
+ X86Condition cond = ((Comparison)comp.AsInt32()).ToX86Condition();
GenerateCompareCommon(context, operation);
diff --git a/src/ARMeilleure/CodeGen/X86/HardwareCapabilities.cs b/src/ARMeilleure/CodeGen/X86/HardwareCapabilities.cs
index 4f6f1e87b..03a747071 100644
--- a/src/ARMeilleure/CodeGen/X86/HardwareCapabilities.cs
+++ b/src/ARMeilleure/CodeGen/X86/HardwareCapabilities.cs
@@ -53,7 +53,7 @@ namespace ARMeilleure.CodeGen.X86
memGetXcr0.Reprotect(0, (ulong)asmGetXcr0.Length, MemoryPermission.ReadAndExecute);
- var fGetXcr0 = Marshal.GetDelegateForFunctionPointer(memGetXcr0.Pointer);
+ GetXcr0 fGetXcr0 = Marshal.GetDelegateForFunctionPointer(memGetXcr0.Pointer);
return fGetXcr0();
}
diff --git a/src/ARMeilleure/CodeGen/X86/PreAllocator.cs b/src/ARMeilleure/CodeGen/X86/PreAllocator.cs
index 590c35c7b..ded3f866c 100644
--- a/src/ARMeilleure/CodeGen/X86/PreAllocator.cs
+++ b/src/ARMeilleure/CodeGen/X86/PreAllocator.cs
@@ -759,7 +759,7 @@ namespace ARMeilleure.CodeGen.X86
Debug.Assert(comp.Kind == OperandKind.Constant);
- var compType = (Comparison)comp.AsInt32();
+ Comparison compType = (Comparison)comp.AsInt32();
return compType == Comparison.Equal || compType == Comparison.NotEqual;
}
diff --git a/src/ARMeilleure/CodeGen/X86/X86Optimizer.cs b/src/ARMeilleure/CodeGen/X86/X86Optimizer.cs
index 690ca5043..8fcc41bc4 100644
--- a/src/ARMeilleure/CodeGen/X86/X86Optimizer.cs
+++ b/src/ARMeilleure/CodeGen/X86/X86Optimizer.cs
@@ -13,13 +13,13 @@ namespace ARMeilleure.CodeGen.X86
public static void RunPass(ControlFlowGraph cfg)
{
- var constants = new Dictionary();
+ Dictionary constants = new Dictionary();
Operand GetConstantCopy(BasicBlock block, Operation operation, Operand source)
{
// If the constant has many uses, we also force a new constant mov to be added, in order
// to avoid overflow of the counts field (that is limited to 16 bits).
- if (!constants.TryGetValue(source.Value, out var constant) || constant.UsesCount > MaxConstantUses)
+ if (!constants.TryGetValue(source.Value, out Operand constant) || constant.UsesCount > MaxConstantUses)
{
constant = Local(source.Type);
diff --git a/src/ARMeilleure/Common/BitMap.cs b/src/ARMeilleure/Common/BitMap.cs
index 94d47ea59..a7bc69238 100644
--- a/src/ARMeilleure/Common/BitMap.cs
+++ b/src/ARMeilleure/Common/BitMap.cs
@@ -129,13 +129,13 @@ namespace ARMeilleure.Common
if (count > _count)
{
- var oldMask = _masks;
- var oldSpan = new Span(_masks, _count);
+ long* oldMask = _masks;
+ Span oldSpan = new Span(_masks, _count);
_masks = _allocator.Allocate((uint)count);
_count = count;
- var newSpan = new Span(_masks, _count);
+ Span newSpan = new Span(_masks, _count);
oldSpan.CopyTo(newSpan);
newSpan[oldSpan.Length..].Clear();
diff --git a/src/ARMeilleure/Common/EntryTable.cs b/src/ARMeilleure/Common/EntryTable.cs
index e49a0989e..7b8c1e134 100644
--- a/src/ARMeilleure/Common/EntryTable.cs
+++ b/src/ARMeilleure/Common/EntryTable.cs
@@ -63,7 +63,7 @@ namespace ARMeilleure.Common
}
int index = _freeHint++;
- var page = GetPage(index);
+ Span page = GetPage(index);
_allocated.Set(index);
@@ -111,7 +111,7 @@ namespace ARMeilleure.Common
throw new ArgumentException("Entry at the specified index was not allocated", nameof(index));
}
- var page = GetPage(index);
+ Span page = GetPage(index);
return ref GetValue(page, index);
}
@@ -136,7 +136,7 @@ namespace ARMeilleure.Common
/// Page for the specified
private unsafe Span GetPage(int index)
{
- var pageIndex = (int)((uint)(index & ~(_pageCapacity - 1)) >> _pageLogCapacity);
+ int pageIndex = (int)((uint)(index & ~(_pageCapacity - 1)) >> _pageLogCapacity);
if (!_pages.TryGetValue(pageIndex, out nint page))
{
@@ -168,7 +168,7 @@ namespace ARMeilleure.Common
{
_allocated.Dispose();
- foreach (var page in _pages.Values)
+ foreach (IntPtr page in _pages.Values)
{
NativeAllocator.Instance.Free((void*)page);
}
diff --git a/src/ARMeilleure/Decoders/OpCode32SimdDupElem.cs b/src/ARMeilleure/Decoders/OpCode32SimdDupElem.cs
index b6cdff088..fbb14056d 100644
--- a/src/ARMeilleure/Decoders/OpCode32SimdDupElem.cs
+++ b/src/ARMeilleure/Decoders/OpCode32SimdDupElem.cs
@@ -9,7 +9,7 @@ namespace ARMeilleure.Decoders
public OpCode32SimdDupElem(InstDescriptor inst, ulong address, int opCode, bool isThumb) : base(inst, address, opCode, isThumb)
{
- var opc = (opCode >> 16) & 0xf;
+ int opc = (opCode >> 16) & 0xf;
if ((opc & 0b1) == 1)
{
diff --git a/src/ARMeilleure/Decoders/OpCode32SimdMovGpElem.cs b/src/ARMeilleure/Decoders/OpCode32SimdMovGpElem.cs
index f6fce7d99..3b9431da4 100644
--- a/src/ARMeilleure/Decoders/OpCode32SimdMovGpElem.cs
+++ b/src/ARMeilleure/Decoders/OpCode32SimdMovGpElem.cs
@@ -21,7 +21,7 @@ namespace ARMeilleure.Decoders
Op = (opCode >> 20) & 0x1;
U = ((opCode >> 23) & 1) != 0;
- var opc = (((opCode >> 23) & 1) << 4) | (((opCode >> 21) & 0x3) << 2) | ((opCode >> 5) & 0x3);
+ int opc = (((opCode >> 23) & 1) << 4) | (((opCode >> 21) & 0x3) << 2) | ((opCode >> 5) & 0x3);
if ((opc & 0b01000) == 0b01000)
{
diff --git a/src/ARMeilleure/Decoders/OpCodeAluImm.cs b/src/ARMeilleure/Decoders/OpCodeAluImm.cs
index 0d2f7202f..41a12e474 100644
--- a/src/ARMeilleure/Decoders/OpCodeAluImm.cs
+++ b/src/ARMeilleure/Decoders/OpCodeAluImm.cs
@@ -20,7 +20,7 @@ namespace ARMeilleure.Decoders
}
else if (DataOp == DataOp.Logical)
{
- var bm = DecoderHelper.DecodeBitMask(opCode, true);
+ DecoderHelper.BitMask bm = DecoderHelper.DecodeBitMask(opCode, true);
if (bm.IsUndefined)
{
diff --git a/src/ARMeilleure/Decoders/OpCodeBfm.cs b/src/ARMeilleure/Decoders/OpCodeBfm.cs
index d51efade2..969c782f8 100644
--- a/src/ARMeilleure/Decoders/OpCodeBfm.cs
+++ b/src/ARMeilleure/Decoders/OpCodeBfm.cs
@@ -11,7 +11,7 @@ namespace ARMeilleure.Decoders
public OpCodeBfm(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
{
- var bm = DecoderHelper.DecodeBitMask(opCode, false);
+ DecoderHelper.BitMask bm = DecoderHelper.DecodeBitMask(opCode, false);
if (bm.IsUndefined)
{
diff --git a/src/ARMeilleure/Decoders/Optimizations/TailCallRemover.cs b/src/ARMeilleure/Decoders/Optimizations/TailCallRemover.cs
index 9d988f0c9..361a7f0d0 100644
--- a/src/ARMeilleure/Decoders/Optimizations/TailCallRemover.cs
+++ b/src/ARMeilleure/Decoders/Optimizations/TailCallRemover.cs
@@ -69,7 +69,7 @@ namespace ARMeilleure.Decoders.Optimizations
}
}
- var newBlocks = new List(blocks.Count);
+ List newBlocks = new List(blocks.Count);
// Finally, rebuild decoded block list, ignoring blocks outside the contiguous range.
for (int i = 0; i < blocks.Count; i++)
diff --git a/src/ARMeilleure/Diagnostics/IRDumper.cs b/src/ARMeilleure/Diagnostics/IRDumper.cs
index 16833d085..9d6a708b6 100644
--- a/src/ARMeilleure/Diagnostics/IRDumper.cs
+++ b/src/ARMeilleure/Diagnostics/IRDumper.cs
@@ -141,7 +141,7 @@ namespace ARMeilleure.Diagnostics
break;
case OperandKind.Memory:
- var memOp = operand.GetMemory();
+ MemoryOperand memOp = operand.GetMemory();
_builder.Append('[');
@@ -285,7 +285,7 @@ namespace ARMeilleure.Diagnostics
public static string GetDump(ControlFlowGraph cfg)
{
- var dumper = new IRDumper(1);
+ IRDumper dumper = new IRDumper(1);
for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
{
diff --git a/src/ARMeilleure/Instructions/InstEmitAlu32.cs b/src/ARMeilleure/Instructions/InstEmitAlu32.cs
index 8eabe093e..2e659fd5f 100644
--- a/src/ARMeilleure/Instructions/InstEmitAlu32.cs
+++ b/src/ARMeilleure/Instructions/InstEmitAlu32.cs
@@ -415,7 +415,7 @@ namespace ARMeilleure.Instructions
{
IOpCode32AluBf op = (IOpCode32AluBf)context.CurrOp;
- var msb = op.Lsb + op.Msb; // For this instruction, the msb is actually a width.
+ int msb = op.Lsb + op.Msb; // For this instruction, the msb is actually a width.
Operand n = GetIntA32(context, op.Rn);
Operand res = context.ShiftRightSI(context.ShiftLeft(n, Const(31 - msb)), Const(31 - op.Msb));
@@ -547,7 +547,7 @@ namespace ARMeilleure.Instructions
{
IOpCode32AluBf op = (IOpCode32AluBf)context.CurrOp;
- var msb = op.Lsb + op.Msb; // For this instruction, the msb is actually a width.
+ int msb = op.Lsb + op.Msb; // For this instruction, the msb is actually a width.
Operand n = GetIntA32(context, op.Rn);
Operand res = context.ShiftRightUI(context.ShiftLeft(n, Const(31 - msb)), Const(31 - op.Msb));
diff --git a/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs b/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs
index a602ea49e..f67668da4 100644
--- a/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs
+++ b/src/ARMeilleure/Instructions/InstEmitFlowHelper.cs
@@ -1,4 +1,5 @@
using ARMeilleure.CodeGen.Linking;
+using ARMeilleure.Common;
using ARMeilleure.Decoders;
using ARMeilleure.IntermediateRepresentation;
using ARMeilleure.State;
@@ -193,7 +194,7 @@ namespace ARMeilleure.Instructions
Operand hostAddress;
- var table = context.FunctionTable;
+ IAddressTable table = context.FunctionTable;
// If address is mapped onto the function table, we can skip the table walk. Otherwise we fallback
// onto the dispatch stub.
@@ -218,7 +219,7 @@ namespace ARMeilleure.Instructions
for (int i = 0; i < table.Levels.Length; i++)
{
- var level = table.Levels[i];
+ AddressTableLevel level = table.Levels[i];
int clearBits = 64 - (level.Index + level.Length);
Operand index = context.ShiftLeft(
diff --git a/src/ARMeilleure/Instructions/InstEmitMemoryEx32.cs b/src/ARMeilleure/Instructions/InstEmitMemoryEx32.cs
index 150218827..ea9e33f26 100644
--- a/src/ARMeilleure/Instructions/InstEmitMemoryEx32.cs
+++ b/src/ARMeilleure/Instructions/InstEmitMemoryEx32.cs
@@ -143,8 +143,8 @@ namespace ARMeilleure.Instructions
Operand address = context.Copy(GetIntA32(context, op.Rn));
- var exclusive = (accType & AccessType.Exclusive) != 0;
- var ordered = (accType & AccessType.Ordered) != 0;
+ bool exclusive = (accType & AccessType.Exclusive) != 0;
+ bool ordered = (accType & AccessType.Ordered) != 0;
if ((accType & AccessType.Load) != 0)
{
diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs
index 1d68bce6b..6ec2b58f9 100644
--- a/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs
+++ b/src/ARMeilleure/Instructions/InstEmitSimdCmp32.cs
@@ -229,7 +229,7 @@ namespace ARMeilleure.Instructions
private static Operand ZerosOrOnes(ArmEmitterContext context, Operand fromBool, OperandType baseType)
{
- var ones = (baseType == OperandType.I64) ? Const(-1L) : Const(-1);
+ Operand ones = (baseType == OperandType.I64) ? Const(-1L) : Const(-1);
return context.ConditionalSelect(fromBool, ones, Const(baseType, 0L));
}
diff --git a/src/ARMeilleure/Instructions/InstEmitSimdCvt32.cs b/src/ARMeilleure/Instructions/InstEmitSimdCvt32.cs
index 216726df9..d3fafc856 100644
--- a/src/ARMeilleure/Instructions/InstEmitSimdCvt32.cs
+++ b/src/ARMeilleure/Instructions/InstEmitSimdCvt32.cs
@@ -118,15 +118,15 @@ namespace ARMeilleure.Instructions
{
OpCode32SimdCvtFFixed op = (OpCode32SimdCvtFFixed)context.CurrOp;
- var toFixed = op.Opc == 1;
+ bool toFixed = op.Opc == 1;
int fracBits = op.Fbits;
- var unsigned = op.U;
+ bool unsigned = op.U;
if (toFixed) // F32 to S32 or U32 (fixed)
{
EmitVectorUnaryOpF32(context, (op1) =>
{
- var scaledValue = context.Multiply(op1, ConstF(MathF.Pow(2f, fracBits)));
+ Operand scaledValue = context.Multiply(op1, ConstF(MathF.Pow(2f, fracBits)));
MethodInfo info = unsigned ? typeof(SoftFallback).GetMethod(nameof(SoftFallback.SatF32ToU32)) : typeof(SoftFallback).GetMethod(nameof(SoftFallback.SatF32ToS32));
return context.Call(info, scaledValue);
@@ -136,7 +136,7 @@ namespace ARMeilleure.Instructions
{
EmitVectorUnaryOpI32(context, (op1) =>
{
- var floatValue = unsigned ? context.ConvertToFPUI(OperandType.FP32, op1) : context.ConvertToFP(OperandType.FP32, op1);
+ Operand floatValue = unsigned ? context.ConvertToFPUI(OperandType.FP32, op1) : context.ConvertToFP(OperandType.FP32, op1);
return context.Multiply(floatValue, ConstF(1f / MathF.Pow(2f, fracBits)));
}, !unsigned);
diff --git a/src/ARMeilleure/Instructions/InstEmitSimdMemory32.cs b/src/ARMeilleure/Instructions/InstEmitSimdMemory32.cs
index 35c6dd328..3808ef929 100644
--- a/src/ARMeilleure/Instructions/InstEmitSimdMemory32.cs
+++ b/src/ARMeilleure/Instructions/InstEmitSimdMemory32.cs
@@ -87,7 +87,7 @@ namespace ARMeilleure.Instructions
{
if (op.Replicate)
{
- var regs = (count > 1) ? 1 : op.Increment;
+ int regs = (count > 1) ? 1 : op.Increment;
for (int reg = 0; reg < regs; reg++)
{
int dreg = reg + d;
diff --git a/src/ARMeilleure/Instructions/SoftFloat.cs b/src/ARMeilleure/Instructions/SoftFloat.cs
index 7895ca1dc..a2bb23be8 100644
--- a/src/ARMeilleure/Instructions/SoftFloat.cs
+++ b/src/ARMeilleure/Instructions/SoftFloat.cs
@@ -1538,7 +1538,7 @@ namespace ARMeilleure.Instructions
}
else if (MathF.Abs(value) < MathF.Pow(2f, -128))
{
- var overflowToInf = fpcr.GetRoundingMode() switch
+ bool overflowToInf = fpcr.GetRoundingMode() switch
{
FPRoundingMode.ToNearest => true,
FPRoundingMode.TowardsPlusInfinity => !sign,
@@ -3073,7 +3073,7 @@ namespace ARMeilleure.Instructions
}
else if (Math.Abs(value) < Math.Pow(2d, -1024))
{
- var overflowToInf = fpcr.GetRoundingMode() switch
+ bool overflowToInf = fpcr.GetRoundingMode() switch
{
FPRoundingMode.ToNearest => true,
FPRoundingMode.TowardsPlusInfinity => !sign,
diff --git a/src/ARMeilleure/IntermediateRepresentation/Operand.cs b/src/ARMeilleure/IntermediateRepresentation/Operand.cs
index 89aefacb1..495a9d04a 100644
--- a/src/ARMeilleure/IntermediateRepresentation/Operand.cs
+++ b/src/ARMeilleure/IntermediateRepresentation/Operand.cs
@@ -304,7 +304,7 @@ namespace ARMeilleure.IntermediateRepresentation
ushort newCount = checked((ushort)(count + 1));
ushort newCapacity = (ushort)Math.Min(capacity * 2, ushort.MaxValue);
- var oldSpan = new Span(data, count);
+ Span oldSpan = new Span(data, count);
capacity = newCapacity;
data = Allocators.References.Allocate(capacity);
@@ -338,7 +338,7 @@ namespace ARMeilleure.IntermediateRepresentation
throw new OverflowException();
}
- var oldSpan = new Span(data, (int)count);
+ Span oldSpan = new Span(data, (int)count);
capacity = newCapacity;
data = Allocators.References.Allocate(capacity);
@@ -352,7 +352,7 @@ namespace ARMeilleure.IntermediateRepresentation
private static void Remove(in T item, ref T* data, ref ushort count) where T : unmanaged
{
- var span = new Span(data, count);
+ Span span = new Span(data, count);
for (int i = 0; i < span.Length; i++)
{
@@ -372,7 +372,7 @@ namespace ARMeilleure.IntermediateRepresentation
private static void Remove(in T item, ref T* data, ref uint count) where T : unmanaged
{
- var span = new Span(data, (int)count);
+ Span span = new Span(data, (int)count);
for (int i = 0; i < span.Length; i++)
{
diff --git a/src/ARMeilleure/Signal/TestMethods.cs b/src/ARMeilleure/Signal/TestMethods.cs
index 9d11ab183..714bcc01b 100644
--- a/src/ARMeilleure/Signal/TestMethods.cs
+++ b/src/ARMeilleure/Signal/TestMethods.cs
@@ -22,7 +22,7 @@ namespace ARMeilleure.Signal
{
EmitterContext context = new();
- var result = WindowsPartialUnmapHandler.EmitRetryFromAccessViolation(context);
+ Operand result = WindowsPartialUnmapHandler.EmitRetryFromAccessViolation(context);
context.Return(result);
@@ -39,7 +39,7 @@ namespace ARMeilleure.Signal
{
EmitterContext context = new();
- var result = WindowsPartialUnmapHandler.EmitThreadLocalMapIntGetOrReserve(context, structPtr, context.LoadArgument(OperandType.I32, 0), context.LoadArgument(OperandType.I32, 1));
+ Operand result = WindowsPartialUnmapHandler.EmitThreadLocalMapIntGetOrReserve(context, structPtr, context.LoadArgument(OperandType.I32, 0), context.LoadArgument(OperandType.I32, 1));
context.Return(result);
diff --git a/src/ARMeilleure/Translation/Cache/JitUnwindWindows.cs b/src/ARMeilleure/Translation/Cache/JitUnwindWindows.cs
index 642794188..01b2aa8ed 100644
--- a/src/ARMeilleure/Translation/Cache/JitUnwindWindows.cs
+++ b/src/ARMeilleure/Translation/Cache/JitUnwindWindows.cs
@@ -100,13 +100,13 @@ namespace ARMeilleure.Translation.Cache
return null; // Not found.
}
- var unwindInfo = funcEntry.UnwindInfo;
+ CodeGen.Unwinding.UnwindInfo unwindInfo = funcEntry.UnwindInfo;
int codeIndex = 0;
for (int index = unwindInfo.PushEntries.Length - 1; index >= 0; index--)
{
- var entry = unwindInfo.PushEntries[index];
+ UnwindPushEntry entry = unwindInfo.PushEntries[index];
switch (entry.PseudoOp)
{
diff --git a/src/ARMeilleure/Translation/ControlFlowGraph.cs b/src/ARMeilleure/Translation/ControlFlowGraph.cs
index 45b092ec5..03ef6f461 100644
--- a/src/ARMeilleure/Translation/ControlFlowGraph.cs
+++ b/src/ARMeilleure/Translation/ControlFlowGraph.cs
@@ -47,8 +47,8 @@ namespace ARMeilleure.Translation
{
RemoveUnreachableBlocks(Blocks);
- var visited = new HashSet();
- var blockStack = new Stack();
+ HashSet visited = new HashSet();
+ Stack blockStack = new Stack();
Array.Resize(ref _postOrderBlocks, Blocks.Count);
Array.Resize(ref _postOrderMap, Blocks.Count);
@@ -88,8 +88,8 @@ namespace ARMeilleure.Translation
private void RemoveUnreachableBlocks(IntrusiveList blocks)
{
- var visited = new HashSet();
- var workQueue = new Queue();
+ HashSet visited = new HashSet();
+ Queue workQueue = new Queue();
visited.Add(Entry);
workQueue.Enqueue(Entry);
diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs
index 894e825cf..10f8f3043 100644
--- a/src/ARMeilleure/Translation/PTC/Ptc.cs
+++ b/src/ARMeilleure/Translation/PTC/Ptc.cs
@@ -9,6 +9,7 @@ using Ryujinx.Common.Logging;
using Ryujinx.Common.Memory;
using System;
using System.Buffers.Binary;
+using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@@ -562,7 +563,7 @@ namespace ARMeilleure.Translation.PTC
bool isEntryChanged = infoEntry.Hash != ComputeHash(translator.Memory, infoEntry.Address, infoEntry.GuestSize);
- if (isEntryChanged || (!infoEntry.HighCq && Profiler.ProfiledFuncs.TryGetValue(infoEntry.Address, out var value) && value.HighCq))
+ if (isEntryChanged || (!infoEntry.HighCq && Profiler.ProfiledFuncs.TryGetValue(infoEntry.Address, out PtcProfiler.FuncProfile value) && value.HighCq))
{
infoEntry.Stubbed = true;
infoEntry.CodeLength = 0;
@@ -749,8 +750,8 @@ namespace ARMeilleure.Translation.PTC
UnwindInfo unwindInfo,
bool highCq)
{
- var cFunc = new CompiledFunction(code, unwindInfo, RelocInfo.Empty);
- var gFunc = cFunc.MapWithPointer(out nint gFuncPointer);
+ CompiledFunction cFunc = new CompiledFunction(code, unwindInfo, RelocInfo.Empty);
+ GuestFunction gFunc = cFunc.MapWithPointer(out nint gFuncPointer);
return new TranslatedFunction(gFunc, gFuncPointer, callCounter, guestSize, highCq);
}
@@ -787,7 +788,7 @@ namespace ARMeilleure.Translation.PTC
public void MakeAndSaveTranslations(Translator translator)
{
- var profiledFuncsToTranslate = Profiler.GetProfiledFuncsToTranslate(translator.Functions);
+ ConcurrentQueue<(ulong address, PtcProfiler.FuncProfile funcProfile)> profiledFuncsToTranslate = Profiler.GetProfiledFuncsToTranslate(translator.Functions);
_translateCount = 0;
_translateTotalCount = profiledFuncsToTranslate.Count;
@@ -831,7 +832,7 @@ namespace ARMeilleure.Translation.PTC
void TranslateFuncs()
{
- while (profiledFuncsToTranslate.TryDequeue(out var item))
+ while (profiledFuncsToTranslate.TryDequeue(out (ulong address, PtcProfiler.FuncProfile funcProfile) item))
{
ulong address = item.address;
@@ -866,11 +867,11 @@ namespace ARMeilleure.Translation.PTC
Stopwatch sw = Stopwatch.StartNew();
- foreach (var thread in threads)
+ foreach (Thread thread in threads)
{
thread.Start();
}
- foreach (var thread in threads)
+ foreach (Thread thread in threads)
{
thread.Join();
}
@@ -944,7 +945,7 @@ namespace ARMeilleure.Translation.PTC
WriteCode(code.AsSpan());
// WriteReloc.
- using var relocInfoWriter = new BinaryWriter(_relocsStream, EncodingCache.UTF8NoBOM, true);
+ using BinaryWriter relocInfoWriter = new BinaryWriter(_relocsStream, EncodingCache.UTF8NoBOM, true);
foreach (RelocEntry entry in relocInfo.Entries)
{
@@ -954,7 +955,7 @@ namespace ARMeilleure.Translation.PTC
}
// WriteUnwindInfo.
- using var unwindInfoWriter = new BinaryWriter(_unwindInfosStream, EncodingCache.UTF8NoBOM, true);
+ using BinaryWriter unwindInfoWriter = new BinaryWriter(_unwindInfosStream, EncodingCache.UTF8NoBOM, true);
unwindInfoWriter.Write(unwindInfo.PushEntries.Length);
diff --git a/src/ARMeilleure/Translation/PTC/PtcProfiler.cs b/src/ARMeilleure/Translation/PTC/PtcProfiler.cs
index bdb9abd05..250ef70bb 100644
--- a/src/ARMeilleure/Translation/PTC/PtcProfiler.cs
+++ b/src/ARMeilleure/Translation/PTC/PtcProfiler.cs
@@ -111,9 +111,9 @@ namespace ARMeilleure.Translation.PTC
public ConcurrentQueue<(ulong address, FuncProfile funcProfile)> GetProfiledFuncsToTranslate(TranslatorCache funcs)
{
- var profiledFuncsToTranslate = new ConcurrentQueue<(ulong address, FuncProfile funcProfile)>();
+ ConcurrentQueue<(ulong address, FuncProfile funcProfile)> profiledFuncsToTranslate = new ConcurrentQueue<(ulong address, FuncProfile funcProfile)>();
- foreach (var profiledFunc in ProfiledFuncs)
+ foreach (KeyValuePair profiledFunc in ProfiledFuncs)
{
if (!funcs.ContainsKey(profiledFunc.Key))
{
diff --git a/src/ARMeilleure/Translation/SsaConstruction.cs b/src/ARMeilleure/Translation/SsaConstruction.cs
index cddcfcd4f..3819340c6 100644
--- a/src/ARMeilleure/Translation/SsaConstruction.cs
+++ b/src/ARMeilleure/Translation/SsaConstruction.cs
@@ -44,10 +44,10 @@ namespace ARMeilleure.Translation
public static void Construct(ControlFlowGraph cfg)
{
- var globalDefs = new DefMap[cfg.Blocks.Count];
- var localDefs = new Operand[cfg.LocalsCount + RegisterConsts.TotalCount];
+ DefMap[] globalDefs = new DefMap[cfg.Blocks.Count];
+ Operand[] localDefs = new Operand[cfg.LocalsCount + RegisterConsts.TotalCount];
- var dfPhiBlocks = new Queue();
+ Queue dfPhiBlocks = new Queue();
for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
{
diff --git a/src/ARMeilleure/Translation/Translator.cs b/src/ARMeilleure/Translation/Translator.cs
index 162368782..8e1a437db 100644
--- a/src/ARMeilleure/Translation/Translator.cs
+++ b/src/ARMeilleure/Translation/Translator.cs
@@ -222,7 +222,7 @@ namespace ARMeilleure.Translation
internal TranslatedFunction Translate(ulong address, ExecutionMode mode, bool highCq, bool singleStep = false)
{
- var context = new ArmEmitterContext(
+ ArmEmitterContext context = new ArmEmitterContext(
Memory,
CountTable,
FunctionTable,
@@ -259,10 +259,10 @@ namespace ARMeilleure.Translation
Logger.EndPass(PassName.RegisterUsage);
- var retType = OperandType.I64;
- var argTypes = new OperandType[] { OperandType.I64 };
+ OperandType retType = OperandType.I64;
+ OperandType[] argTypes = new OperandType[] { OperandType.I64 };
- var options = highCq ? CompilerOptions.HighCq : CompilerOptions.None;
+ CompilerOptions options = highCq ? CompilerOptions.HighCq : CompilerOptions.None;
if (context.HasPtc && !singleStep)
{
@@ -521,7 +521,7 @@ namespace ARMeilleure.Translation
List functions = Functions.AsList();
- foreach (var func in functions)
+ foreach (TranslatedFunction func in functions)
{
JitCache.Unmap(func.FuncPointer);
@@ -530,7 +530,7 @@ namespace ARMeilleure.Translation
Functions.Clear();
- while (_oldFuncs.TryDequeue(out var kv))
+ while (_oldFuncs.TryDequeue(out KeyValuePair kv))
{
JitCache.Unmap(kv.Value.FuncPointer);
@@ -551,7 +551,7 @@ namespace ARMeilleure.Translation
{
while (Queue.Count > 0 && Queue.TryDequeue(out RejitRequest request))
{
- if (Functions.TryGetValue(request.Address, out var func) && func.CallCounter != null)
+ if (Functions.TryGetValue(request.Address, out TranslatedFunction func) && func.CallCounter != null)
{
Volatile.Write(ref func.CallCounter.Value, 0);
}
diff --git a/src/ARMeilleure/Translation/TranslatorStubs.cs b/src/ARMeilleure/Translation/TranslatorStubs.cs
index bd9aed8d4..e48349963 100644
--- a/src/ARMeilleure/Translation/TranslatorStubs.cs
+++ b/src/ARMeilleure/Translation/TranslatorStubs.cs
@@ -142,7 +142,7 @@ namespace ARMeilleure.Translation
/// Generated
private nint GenerateDispatchStub()
{
- var context = new EmitterContext();
+ EmitterContext context = new EmitterContext();
Operand lblFallback = Label();
Operand lblEnd = Label();
@@ -161,7 +161,7 @@ namespace ARMeilleure.Translation
for (int i = 0; i < _functionTable.Levels.Length; i++)
{
- ref var level = ref _functionTable.Levels[i];
+ ref AddressTableLevel level = ref _functionTable.Levels[i];
// level.Mask is not used directly because it is more often bigger than 32-bits, so it will not
// be encoded as an immediate on x86's bitwise and operation.
@@ -185,11 +185,11 @@ namespace ARMeilleure.Translation
hostAddress = context.Call(typeof(NativeInterface).GetMethod(nameof(NativeInterface.GetFunctionAddress)), guestAddress);
context.Tailcall(hostAddress, nativeContext);
- var cfg = context.GetControlFlowGraph();
- var retType = OperandType.I64;
- var argTypes = new[] { OperandType.I64 };
+ ControlFlowGraph cfg = context.GetControlFlowGraph();
+ OperandType retType = OperandType.I64;
+ OperandType[] argTypes = new[] { OperandType.I64 };
- var func = Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map();
+ GuestFunction func = Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map();
return Marshal.GetFunctionPointerForDelegate(func);
}
@@ -200,7 +200,7 @@ namespace ARMeilleure.Translation
/// Generated
private nint GenerateSlowDispatchStub()
{
- var context = new EmitterContext();
+ EmitterContext context = new EmitterContext();
// Load the target guest address from the native context.
Operand nativeContext = context.LoadArgument(OperandType.I64, 0);
@@ -210,11 +210,11 @@ namespace ARMeilleure.Translation
Operand hostAddress = context.Call(typeof(NativeInterface).GetMethod(nameof(NativeInterface.GetFunctionAddress)), guestAddress);
context.Tailcall(hostAddress, nativeContext);
- var cfg = context.GetControlFlowGraph();
- var retType = OperandType.I64;
- var argTypes = new[] { OperandType.I64 };
+ ControlFlowGraph cfg = context.GetControlFlowGraph();
+ OperandType retType = OperandType.I64;
+ OperandType[] argTypes = new[] { OperandType.I64 };
- var func = Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map();
+ GuestFunction func = Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map();
return Marshal.GetFunctionPointerForDelegate(func);
}
@@ -251,7 +251,7 @@ namespace ARMeilleure.Translation
/// function
private DispatcherFunction GenerateDispatchLoop()
{
- var context = new EmitterContext();
+ EmitterContext context = new EmitterContext();
Operand beginLbl = Label();
Operand endLbl = Label();
@@ -279,9 +279,9 @@ namespace ARMeilleure.Translation
context.Return();
- var cfg = context.GetControlFlowGraph();
- var retType = OperandType.None;
- var argTypes = new[] { OperandType.I64, OperandType.I64 };
+ ControlFlowGraph cfg = context.GetControlFlowGraph();
+ OperandType retType = OperandType.None;
+ OperandType[] argTypes = new[] { OperandType.I64, OperandType.I64 };
return Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map();
}
@@ -292,7 +292,7 @@ namespace ARMeilleure.Translation
/// function
private WrapperFunction GenerateContextWrapper()
{
- var context = new EmitterContext();
+ EmitterContext context = new EmitterContext();
Operand nativeContext = context.LoadArgument(OperandType.I64, 0);
Operand guestMethod = context.LoadArgument(OperandType.I64, 1);
@@ -303,9 +303,9 @@ namespace ARMeilleure.Translation
context.Return(returnValue);
- var cfg = context.GetControlFlowGraph();
- var retType = OperandType.I64;
- var argTypes = new[] { OperandType.I64, OperandType.I64 };
+ ControlFlowGraph cfg = context.GetControlFlowGraph();
+ OperandType retType = OperandType.I64;
+ OperandType[] argTypes = new[] { OperandType.I64, OperandType.I64 };
return Compiler.Compile(cfg, argTypes, retType, CompilerOptions.HighCq, RuntimeInformation.ProcessArchitecture).Map();
}
diff --git a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs
index acd1582ec..2d04073d7 100644
--- a/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs
+++ b/src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceDriver.cs
@@ -37,7 +37,7 @@ namespace Ryujinx.Audio.Backends.SDL2
SDL2Driver.Instance.Initialize();
- int res = SDL_GetDefaultAudioInfo(nint.Zero, out var spec, 0);
+ int res = SDL_GetDefaultAudioInfo(nint.Zero, out SDL_AudioSpec spec, 0);
if (res != 0)
{
diff --git a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoOutStreamContext.cs b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoOutStreamContext.cs
index b1823a074..072e49d8c 100644
--- a/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoOutStreamContext.cs
+++ b/src/Ryujinx.Audio.Backends.SoundIo/Native/SoundIoOutStreamContext.cs
@@ -38,7 +38,7 @@ namespace Ryujinx.Audio.Backends.SoundIo.Native
get => Marshal.PtrToStringAnsi(GetOutContext().Name);
set
{
- var context = GetOutContext();
+ SoundIoOutStream context = GetOutContext();
if (_nameStored != nint.Zero && context.Name == _nameStored)
{
@@ -129,8 +129,8 @@ namespace Ryujinx.Audio.Backends.SoundIo.Native
unsafe
{
- var frameCountPtr = &nativeFrameCount;
- var arenasPtr = &arenas;
+ int* frameCountPtr = &nativeFrameCount;
+ IntPtr* arenasPtr = &arenas;
CheckError(soundio_outstream_begin_write(_context, (nint)arenasPtr, (nint)frameCountPtr));
frameCount = *frameCountPtr;
diff --git a/src/Ryujinx.Audio/Renderer/Utils/FileHardwareDevice.cs b/src/Ryujinx.Audio/Renderer/Utils/FileHardwareDevice.cs
index bc2313ccf..008a067f1 100644
--- a/src/Ryujinx.Audio/Renderer/Utils/FileHardwareDevice.cs
+++ b/src/Ryujinx.Audio/Renderer/Utils/FileHardwareDevice.cs
@@ -27,7 +27,7 @@ namespace Ryujinx.Audio.Renderer.Utils
private void UpdateHeader()
{
- var writer = new BinaryWriter(_stream);
+ BinaryWriter writer = new(_stream);
long currentPos = writer.Seek(0, SeekOrigin.Current);
diff --git a/src/Ryujinx.Common/AsyncWorkQueue.cs b/src/Ryujinx.Common/AsyncWorkQueue.cs
index abb5867b0..e3f91c891 100644
--- a/src/Ryujinx.Common/AsyncWorkQueue.cs
+++ b/src/Ryujinx.Common/AsyncWorkQueue.cs
@@ -34,7 +34,7 @@ namespace Ryujinx.Common
{
try
{
- foreach (var item in _queue.GetConsumingEnumerable(_cts.Token))
+ foreach (T item in _queue.GetConsumingEnumerable(_cts.Token))
{
_workerAction(item);
}
diff --git a/src/Ryujinx.Common/Configuration/DirtyHack.cs b/src/Ryujinx.Common/Configuration/DirtyHack.cs
index 9ab9a26a5..3959c0a99 100644
--- a/src/Ryujinx.Common/Configuration/DirtyHack.cs
+++ b/src/Ryujinx.Common/Configuration/DirtyHack.cs
@@ -23,8 +23,9 @@ namespace Ryujinx.Common.Configuration
public static EnabledDirtyHack Unpack(ulong packedHack)
{
- var unpackedFields = packedHack.UnpackBitFields(PackedFormat);
- if (unpackedFields is not [var hack, var value])
+ uint[] unpackedFields = packedHack.UnpackBitFields(PackedFormat);
+ // ReSharper disable once PatternAlwaysMatches
+ if (unpackedFields is not [uint hack, uint value])
throw new Exception("The unpack operation on the integer resulted in an invalid unpacked result.");
return new EnabledDirtyHack((DirtyHack)hack, (int)value);
@@ -53,7 +54,7 @@ namespace Ryujinx.Common.Configuration
public static implicit operator DirtyHacks(EnabledDirtyHack[] hacks) => new(hacks);
public static implicit operator DirtyHacks(ulong[] packedHacks) => new(packedHacks);
- public new int this[DirtyHack hack] => TryGetValue(hack, out var value) ? value : -1;
+ public new int this[DirtyHack hack] => TryGetValue(hack, out int value) ? value : -1;
public bool IsEnabled(DirtyHack hack) => ContainsKey(hack);
}
diff --git a/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs b/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs
index 79b5d743b..df2b82aa6 100644
--- a/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs
+++ b/src/Ryujinx.Common/Extensions/SequenceReaderExtensions.cs
@@ -1,6 +1,7 @@
using System;
using System.Buffers;
using System.Diagnostics;
+using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -16,15 +17,15 @@ namespace Ryujinx.Common.Extensions
/// The path and name of the file to create and dump to
public static void DumpToFile(this ref SequenceReader reader, string fileFullName)
{
- var initialConsumed = reader.Consumed;
+ long initialConsumed = reader.Consumed;
reader.Rewind(initialConsumed);
- using (var fileStream = System.IO.File.Create(fileFullName, 4096, System.IO.FileOptions.None))
+ using (FileStream fileStream = System.IO.File.Create(fileFullName, 4096, System.IO.FileOptions.None))
{
while (reader.End == false)
{
- var span = reader.CurrentSpan;
+ ReadOnlySpan span = reader.CurrentSpan;
fileStream.Write(span);
reader.Advance(span.Length);
}
diff --git a/src/Ryujinx.Common/Helpers/FileAssociationHelper.cs b/src/Ryujinx.Common/Helpers/FileAssociationHelper.cs
index 476aee228..7ed5e869a 100644
--- a/src/Ryujinx.Common/Helpers/FileAssociationHelper.cs
+++ b/src/Ryujinx.Common/Helpers/FileAssociationHelper.cs
@@ -101,7 +101,7 @@ namespace Ryujinx.Common.Helper
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(@$"Software\Classes\{ext}");
- var openCmd = key?.OpenSubKey(@"shell\open\command");
+ RegistryKey openCmd = key?.OpenSubKey(@"shell\open\command");
if (openCmd is null)
{
@@ -143,7 +143,7 @@ namespace Ryujinx.Common.Helper
}
else
{
- using var key = Registry.CurrentUser.CreateSubKey(keyString);
+ using RegistryKey key = Registry.CurrentUser.CreateSubKey(keyString);
if (key is null)
{
@@ -151,7 +151,7 @@ namespace Ryujinx.Common.Helper
}
Logger.Debug?.Print(LogClass.Application, $"Adding type association {ext}");
- using var openCmd = key.CreateSubKey(@"shell\open\command");
+ using RegistryKey openCmd = key.CreateSubKey(@"shell\open\command");
openCmd.SetValue(string.Empty, $"\"{Environment.ProcessPath}\" \"%1\"");
Logger.Debug?.Print(LogClass.Application, $"Added type association {ext}");
diff --git a/src/Ryujinx.Common/Helpers/LinuxHelper.cs b/src/Ryujinx.Common/Helpers/LinuxHelper.cs
index 2adfd20f8..e342b2151 100644
--- a/src/Ryujinx.Common/Helpers/LinuxHelper.cs
+++ b/src/Ryujinx.Common/Helpers/LinuxHelper.cs
@@ -24,7 +24,7 @@ namespace Ryujinx.Common.Helper
return null;
}
- foreach (var searchPath in pathVar.Split(":", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries))
+ foreach (string searchPath in pathVar.Split(":", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries))
{
string binaryPath = Path.Combine(searchPath, binary);
diff --git a/src/Ryujinx.Common/Helpers/OpenHelper.cs b/src/Ryujinx.Common/Helpers/OpenHelper.cs
index 6a54b69f3..402e6bcc1 100644
--- a/src/Ryujinx.Common/Helpers/OpenHelper.cs
+++ b/src/Ryujinx.Common/Helpers/OpenHelper.cs
@@ -60,7 +60,7 @@ namespace Ryujinx.Common.Helper
{
ObjectiveC.NSString nsStringPath = new(path);
ObjectiveC.Object nsUrl = new("NSURL");
- var urlPtr = nsUrl.GetFromMessage("fileURLWithPath:", nsStringPath);
+ ObjectiveC.Object urlPtr = nsUrl.GetFromMessage("fileURLWithPath:", nsStringPath);
ObjectiveC.Object nsArray = new("NSArray");
ObjectiveC.Object urlArray = nsArray.GetFromMessage("arrayWithObject:", urlPtr);
@@ -99,7 +99,7 @@ namespace Ryujinx.Common.Helper
{
ObjectiveC.NSString nsStringPath = new(url);
ObjectiveC.Object nsUrl = new("NSURL");
- var urlPtr = nsUrl.GetFromMessage("URLWithString:", nsStringPath);
+ ObjectiveC.Object urlPtr = nsUrl.GetFromMessage("URLWithString:", nsStringPath);
ObjectiveC.Object nsWorkspace = new("NSWorkspace");
ObjectiveC.Object sharedWorkspace = nsWorkspace.GetFromMessage("sharedWorkspace");
diff --git a/src/Ryujinx.Common/Logging/Formatters/DynamicObjectFormatter.cs b/src/Ryujinx.Common/Logging/Formatters/DynamicObjectFormatter.cs
index b1cc0eae3..a7b4da40f 100644
--- a/src/Ryujinx.Common/Logging/Formatters/DynamicObjectFormatter.cs
+++ b/src/Ryujinx.Common/Logging/Formatters/DynamicObjectFormatter.cs
@@ -41,7 +41,7 @@ namespace Ryujinx.Common.Logging.Formatters
sb.Append('{');
- foreach (var prop in props)
+ foreach (PropertyInfo prop in props)
{
sb.Append(prop.Name);
sb.Append(": ");
@@ -52,7 +52,7 @@ namespace Ryujinx.Common.Logging.Formatters
if (array is not null)
{
- foreach (var item in array)
+ foreach (object? item in array)
{
sb.Append(item);
sb.Append(", ");
diff --git a/src/Ryujinx.Common/Logging/Logger.cs b/src/Ryujinx.Common/Logging/Logger.cs
index 6ea6b7ac3..0ac96c7d3 100644
--- a/src/Ryujinx.Common/Logging/Logger.cs
+++ b/src/Ryujinx.Common/Logging/Logger.cs
@@ -193,7 +193,7 @@ namespace Ryujinx.Common.Logging
_stdErrAdapter.Dispose();
- foreach (var target in _logTargets)
+ foreach (ILogTarget target in _logTargets)
{
target.Dispose();
}
@@ -203,9 +203,9 @@ namespace Ryujinx.Common.Logging
public static IReadOnlyCollection GetEnabledLevels()
{
- var logs = new[] { Debug, Info, Warning, Error, Guest, AccessLog, Stub, Trace };
+ Log?[] logs = new[] { Debug, Info, Warning, Error, Guest, AccessLog, Stub, Trace };
List levels = new(logs.Length);
- foreach (var log in logs)
+ foreach (Log? log in logs)
{
if (log.HasValue)
levels.Add(log.Value.Level);
diff --git a/src/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs b/src/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs
index c5bf23cdb..88b324a36 100644
--- a/src/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs
+++ b/src/Ryujinx.Common/Logging/Targets/JsonLogTarget.cs
@@ -26,7 +26,7 @@ namespace Ryujinx.Common.Logging.Targets
public void Log(object sender, LogEventArgs e)
{
- var logEventArgsJson = LogEventArgsJson.FromLogEventArgs(e);
+ LogEventArgsJson logEventArgsJson = LogEventArgsJson.FromLogEventArgs(e);
JsonHelper.SerializeToStream(_stream, logEventArgsJson, LogEventJsonSerializerContext.Default.LogEventArgsJson);
}
diff --git a/src/Ryujinx.Common/Utilities/EmbeddedResources.cs b/src/Ryujinx.Common/Utilities/EmbeddedResources.cs
index 7530c012a..107b4b584 100644
--- a/src/Ryujinx.Common/Utilities/EmbeddedResources.cs
+++ b/src/Ryujinx.Common/Utilities/EmbeddedResources.cs
@@ -19,21 +19,21 @@ namespace Ryujinx.Common
public static byte[] Read(string filename)
{
- var (assembly, path) = ResolveManifestPath(filename);
+ (Assembly assembly, string path) = ResolveManifestPath(filename);
return Read(assembly, path);
}
public static Task ReadAsync(string filename)
{
- var (assembly, path) = ResolveManifestPath(filename);
+ (Assembly assembly, string path) = ResolveManifestPath(filename);
return ReadAsync(assembly, path);
}
public static byte[] Read(Assembly assembly, string filename)
{
- using var stream = GetStream(assembly, filename);
+ using Stream stream = GetStream(assembly, filename);
if (stream == null)
{
return null;
@@ -44,14 +44,14 @@ namespace Ryujinx.Common
public static MemoryOwner ReadFileToRentedMemory(string filename)
{
- var (assembly, path) = ResolveManifestPath(filename);
+ (Assembly assembly, string path) = ResolveManifestPath(filename);
return ReadFileToRentedMemory(assembly, path);
}
public static MemoryOwner ReadFileToRentedMemory(Assembly assembly, string filename)
{
- using var stream = GetStream(assembly, filename);
+ using Stream stream = GetStream(assembly, filename);
return stream is null
? null
@@ -60,7 +60,7 @@ namespace Ryujinx.Common
public async static Task ReadAsync(Assembly assembly, string filename)
{
- using var stream = GetStream(assembly, filename);
+ using Stream stream = GetStream(assembly, filename);
if (stream == null)
{
return null;
@@ -71,55 +71,55 @@ namespace Ryujinx.Common
public static string ReadAllText(string filename)
{
- var (assembly, path) = ResolveManifestPath(filename);
+ (Assembly assembly, string path) = ResolveManifestPath(filename);
return ReadAllText(assembly, path);
}
public static Task ReadAllTextAsync(string filename)
{
- var (assembly, path) = ResolveManifestPath(filename);
+ (Assembly assembly, string path) = ResolveManifestPath(filename);
return ReadAllTextAsync(assembly, path);
}
public static string ReadAllText(Assembly assembly, string filename)
{
- using var stream = GetStream(assembly, filename);
+ using Stream stream = GetStream(assembly, filename);
if (stream == null)
{
return null;
}
- using var reader = new StreamReader(stream);
+ using StreamReader reader = new StreamReader(stream);
return reader.ReadToEnd();
}
public async static Task ReadAllTextAsync(Assembly assembly, string filename)
{
- using var stream = GetStream(assembly, filename);
+ using Stream stream = GetStream(assembly, filename);
if (stream == null)
{
return null;
}
- using var reader = new StreamReader(stream);
+ using StreamReader reader = new StreamReader(stream);
return await reader.ReadToEndAsync();
}
public static Stream GetStream(string filename)
{
- var (assembly, path) = ResolveManifestPath(filename);
+ (Assembly assembly, string path) = ResolveManifestPath(filename);
return GetStream(assembly, path);
}
public static Stream GetStream(Assembly assembly, string filename)
{
- var @namespace = assembly.GetName().Name;
- var manifestUri = @namespace + "." + filename.Replace('/', '.');
+ string @namespace = assembly.GetName().Name;
+ string manifestUri = @namespace + "." + filename.Replace('/', '.');
- var stream = assembly.GetManifestResourceStream(manifestUri);
+ Stream stream = assembly.GetManifestResourceStream(manifestUri);
return stream;
}
@@ -133,11 +133,11 @@ namespace Ryujinx.Common
private static (Assembly, string) ResolveManifestPath(string filename)
{
- var segments = filename.Split('/', 2, StringSplitOptions.RemoveEmptyEntries);
+ string[] segments = filename.Split('/', 2, StringSplitOptions.RemoveEmptyEntries);
if (segments.Length >= 2)
{
- foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
+ foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (assembly.GetName().Name == segments[0])
{
diff --git a/src/Ryujinx.Common/Utilities/FileSystemUtils.cs b/src/Ryujinx.Common/Utilities/FileSystemUtils.cs
index a57fa8a78..58bc80147 100644
--- a/src/Ryujinx.Common/Utilities/FileSystemUtils.cs
+++ b/src/Ryujinx.Common/Utilities/FileSystemUtils.cs
@@ -9,7 +9,7 @@ namespace Ryujinx.Common.Utilities
public static void CopyDirectory(string sourceDir, string destinationDir, bool recursive)
{
// Get information about the source directory
- var dir = new DirectoryInfo(sourceDir);
+ DirectoryInfo dir = new DirectoryInfo(sourceDir);
// Check if the source directory exists
if (!dir.Exists)
@@ -49,7 +49,7 @@ namespace Ryujinx.Common.Utilities
public static string SanitizeFileName(string fileName)
{
- var reservedChars = new HashSet(Path.GetInvalidFileNameChars());
+ HashSet reservedChars = new HashSet(Path.GetInvalidFileNameChars());
return string.Concat(fileName.Select(c => reservedChars.Contains(c) ? '_' : c));
}
}
diff --git a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs
index 426cd46b7..6d5be656f 100644
--- a/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs
+++ b/src/Ryujinx.Common/Utilities/MessagePackObjectFormatter.cs
@@ -1,5 +1,6 @@
using MsgPack;
using System;
+using System.Collections.Generic;
using System.Text;
namespace Ryujinx.Common.Utilities
@@ -18,7 +19,7 @@ namespace Ryujinx.Common.Utilities
public static string Format(MessagePackObject obj)
{
- var builder = new IndentedStringBuilder();
+ IndentedStringBuilder builder = new IndentedStringBuilder();
FormatMsgPackObj(obj, builder);
@@ -41,7 +42,7 @@ namespace Ryujinx.Common.Utilities
}
else
{
- var literal = obj.ToObject();
+ object literal = obj.ToObject();
if (literal is String)
{
@@ -88,7 +89,7 @@ namespace Ryujinx.Common.Utilities
{
builder.Append("[ ");
- foreach (var b in arr)
+ foreach (byte b in arr)
{
builder.Append("0x");
builder.Append(ToHexChar(b >> 4));
@@ -111,7 +112,7 @@ namespace Ryujinx.Common.Utilities
builder.Append("0x");
}
- foreach (var b in arr)
+ foreach (byte b in arr)
{
builder.Append(ToHexChar(b >> 4));
builder.Append(ToHexChar(b & 0xF));
@@ -122,7 +123,7 @@ namespace Ryujinx.Common.Utilities
private static void FormatMsgPackMap(MessagePackObject obj, IndentedStringBuilder builder)
{
- var map = obj.AsDictionary();
+ MessagePackObjectDictionary map = obj.AsDictionary();
builder.Append('{');
@@ -130,7 +131,7 @@ namespace Ryujinx.Common.Utilities
builder.IncreaseIndent()
.AppendLine();
- foreach (var item in map)
+ foreach (KeyValuePair item in map)
{
FormatMsgPackObj(item.Key, builder);
@@ -154,11 +155,11 @@ namespace Ryujinx.Common.Utilities
private static void FormatMsgPackArray(MessagePackObject obj, IndentedStringBuilder builder)
{
- var arr = obj.AsList();
+ IList arr = obj.AsList();
builder.Append("[ ");
- foreach (var item in arr)
+ foreach (MessagePackObject item in arr)
{
FormatMsgPackObj(item, builder);
diff --git a/src/Ryujinx.Common/Utilities/Rainbow.cs b/src/Ryujinx.Common/Utilities/Rainbow.cs
index 2c2ea7bfd..3b49872c2 100644
--- a/src/Ryujinx.Common/Utilities/Rainbow.cs
+++ b/src/Ryujinx.Common/Utilities/Rainbow.cs
@@ -1,40 +1,62 @@
-using System;
+using Gommon;
+using System;
using System.Drawing;
+using System.Threading.Tasks;
namespace Ryujinx.Common.Utilities
{
- public class Rainbow
+ public static class Rainbow
{
+ public static bool CyclingEnabled { get; set; }
+
+ public static void Enable()
+ {
+ if (!CyclingEnabled)
+ {
+ CyclingEnabled = true;
+ Executor.ExecuteBackgroundAsync(async () =>
+ {
+ while (CyclingEnabled)
+ {
+ await Task.Delay(15);
+ Tick();
+ }
+ });
+ }
+ }
+
+ public static void Disable()
+ {
+ CyclingEnabled = false;
+ }
+
+
public static float Speed { get; set; } = 1;
public static Color Color { get; private set; } = Color.Blue;
- private static float _lastHue;
-
public static void Tick()
{
- float currentHue = Color.GetHue();
- float nextHue = currentHue;
-
- if (currentHue >= 360)
- nextHue = 0;
- else
- nextHue += Speed;
+ Color = HsbToRgb((Color.GetHue() + Speed) / 360);
- Color = HsbToRgb(
- nextHue / 360,
- 1,
- 1
- );
-
- _lastHue = currentHue;
-
- RainbowColorUpdated?.Invoke(Color.ToArgb());
+ UpdatedHandler.Call(Color.ToArgb());
}
- public static event Action RainbowColorUpdated;
+ public static void Reset()
+ {
+ Color = Color.Blue;
+ UpdatedHandler.Clear();
+ }
- private static Color HsbToRgb(float hue, float saturation, float brightness)
+ public static event Action Updated
+ {
+ add => UpdatedHandler.Add(value);
+ remove => UpdatedHandler.Remove(value);
+ }
+
+ internal static Event UpdatedHandler = new();
+
+ private static Color HsbToRgb(float hue, float saturation = 1, float brightness = 1)
{
int r = 0, g = 0, b = 0;
if (saturation == 0)
diff --git a/src/Ryujinx.Common/Utilities/StreamUtils.cs b/src/Ryujinx.Common/Utilities/StreamUtils.cs
index aeb6e0d52..60391a902 100644
--- a/src/Ryujinx.Common/Utilities/StreamUtils.cs
+++ b/src/Ryujinx.Common/Utilities/StreamUtils.cs
@@ -1,5 +1,6 @@
using Microsoft.IO;
using Ryujinx.Common.Memory;
+using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -27,7 +28,7 @@ namespace Ryujinx.Common.Utilities
MemoryOwner ownedMemory = MemoryOwner.Rent(checked((int)bytesExpected));
- var destSpan = ownedMemory.Span;
+ Span destSpan = ownedMemory.Span;
int totalBytesRead = 0;
diff --git a/src/Ryujinx.Common/Utilities/TypedStringEnumConverter.cs b/src/Ryujinx.Common/Utilities/TypedStringEnumConverter.cs
index 9d3944c15..d7eb3d556 100644
--- a/src/Ryujinx.Common/Utilities/TypedStringEnumConverter.cs
+++ b/src/Ryujinx.Common/Utilities/TypedStringEnumConverter.cs
@@ -18,7 +18,7 @@ namespace Ryujinx.Common.Utilities
{
public override TEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
- var enumValue = reader.GetString();
+ string? enumValue = reader.GetString();
if (Enum.TryParse(enumValue, out TEnum value))
{
diff --git a/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs b/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs
index 050e78d1e..e92b5fe60 100644
--- a/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs
+++ b/src/Ryujinx.Common/Utilities/XCIFileTrimmer.cs
@@ -46,7 +46,7 @@ namespace Ryujinx.Common.Utilities
{
if (Path.GetExtension(filename).Equals(".XCI", StringComparison.InvariantCultureIgnoreCase))
{
- var trimmer = new XCIFileTrimmer(filename, log);
+ XCIFileTrimmer trimmer = new XCIFileTrimmer(filename, log);
return trimmer.CanBeTrimmed;
}
@@ -57,7 +57,7 @@ namespace Ryujinx.Common.Utilities
{
if (Path.GetExtension(filename).Equals(".XCI", StringComparison.InvariantCultureIgnoreCase))
{
- var trimmer = new XCIFileTrimmer(filename, log);
+ XCIFileTrimmer trimmer = new XCIFileTrimmer(filename, log);
return trimmer.CanBeUntrimmed;
}
@@ -201,7 +201,7 @@ namespace Ryujinx.Common.Utilities
{
long maxReads = readSizeB / XCIFileTrimmer.BufferSize;
long read = 0;
- var buffer = new byte[BufferSize];
+ byte[] buffer = new byte[BufferSize];
while (true)
{
@@ -267,7 +267,7 @@ namespace Ryujinx.Common.Utilities
try
{
- var info = new FileInfo(Filename);
+ FileInfo info = new FileInfo(Filename);
if ((info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
try
@@ -288,7 +288,7 @@ namespace Ryujinx.Common.Utilities
return OperationOutcome.FileSizeChanged;
}
- var outfileStream = new FileStream(_filename, FileMode.Open, FileAccess.Write, FileShare.Write);
+ FileStream outfileStream = new FileStream(_filename, FileMode.Open, FileAccess.Write, FileShare.Write);
try
{
@@ -327,7 +327,7 @@ namespace Ryujinx.Common.Utilities
{
Log?.Write(LogType.Info, "Untrimming...");
- var info = new FileInfo(Filename);
+ FileInfo info = new FileInfo(Filename);
if ((info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
try
@@ -348,7 +348,7 @@ namespace Ryujinx.Common.Utilities
return OperationOutcome.FileSizeChanged;
}
- var outfileStream = new FileStream(_filename, FileMode.Append, FileAccess.Write, FileShare.Write);
+ FileStream outfileStream = new FileStream(_filename, FileMode.Append, FileAccess.Write, FileShare.Write);
long bytesToWriteB = UntrimmedFileSizeB - FileSizeB;
try
@@ -393,7 +393,7 @@ namespace Ryujinx.Common.Utilities
try
{
- var buffer = new byte[BufferSize];
+ byte[] buffer = new byte[BufferSize];
Array.Fill(buffer, XCIFileTrimmer.PaddingByte);
while (bytesLeftToWriteB > 0)
diff --git a/src/Ryujinx.Cpu/AddressTable.cs b/src/Ryujinx.Cpu/AddressTable.cs
index 038a2009c..4015e0801 100644
--- a/src/Ryujinx.Cpu/AddressTable.cs
+++ b/src/Ryujinx.Cpu/AddressTable.cs
@@ -49,7 +49,7 @@ namespace ARMeilleure.Common
public TableSparseBlock(ulong size, Action ensureMapped, PageInitDelegate pageInit)
{
- var block = new SparseMemoryBlock(size, pageInit, null);
+ SparseMemoryBlock block = new SparseMemoryBlock(size, pageInit, null);
_trackingEvent = (ulong address, ulong size, bool write) =>
{
@@ -146,7 +146,7 @@ namespace ARMeilleure.Common
Levels = levels;
Mask = 0;
- foreach (var level in Levels)
+ foreach (AddressTableLevel level in Levels)
{
Mask |= level.Mask;
}
@@ -363,7 +363,7 @@ namespace ARMeilleure.Common
/// The new sparse block that was added
private TableSparseBlock ReserveNewSparseBlock()
{
- var block = new TableSparseBlock(_sparseBlockSize, EnsureMapped, InitLeafPage);
+ TableSparseBlock block = new TableSparseBlock(_sparseBlockSize, EnsureMapped, InitLeafPage);
_sparseReserved.Add(block);
_sparseReservedOffset = 0;
@@ -381,7 +381,7 @@ namespace ARMeilleure.Common
/// Allocated block
private IntPtr Allocate(int length, T fill, bool leaf) where T : unmanaged
{
- var size = sizeof(T) * length;
+ int size = sizeof(T) * length;
AddressTablePage page;
@@ -413,10 +413,10 @@ namespace ARMeilleure.Common
}
else
{
- var address = (IntPtr)NativeAllocator.Instance.Allocate((uint)size);
+ IntPtr address = (IntPtr)NativeAllocator.Instance.Allocate((uint)size);
page = new AddressTablePage(false, address);
- var span = new Span((void*)page.Address, length);
+ Span span = new Span((void*)page.Address, length);
span.Fill(fill);
}
@@ -445,7 +445,7 @@ namespace ARMeilleure.Common
{
if (!_disposed)
{
- foreach (var page in _pages)
+ foreach (AddressTablePage page in _pages)
{
if (!page.IsSparse)
{
diff --git a/src/Ryujinx.Cpu/AppleHv/HvAddressSpace.cs b/src/Ryujinx.Cpu/AppleHv/HvAddressSpace.cs
index eb7c0ef08..662e50793 100644
--- a/src/Ryujinx.Cpu/AppleHv/HvAddressSpace.cs
+++ b/src/Ryujinx.Cpu/AppleHv/HvAddressSpace.cs
@@ -29,7 +29,7 @@ namespace Ryujinx.Cpu.AppleHv
public HvAddressSpace(MemoryBlock backingMemory, ulong asSize)
{
- (_asBase, var ipaAllocator) = HvVm.CreateAddressSpace(backingMemory);
+ (_asBase, HvIpaAllocator ipaAllocator) = HvVm.CreateAddressSpace(backingMemory);
_backingSize = backingMemory.Size;
_userRange = new HvAddressSpaceRange(ipaAllocator);
diff --git a/src/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocator.cs b/src/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocator.cs
index 86936c592..779579e6a 100644
--- a/src/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocator.cs
+++ b/src/Ryujinx.Cpu/AppleHv/HvMemoryBlockAllocator.cs
@@ -45,7 +45,7 @@ namespace Ryujinx.Cpu.AppleHv
public HvMemoryBlockAllocation Allocate(ulong size, ulong alignment)
{
- var allocation = Allocate(size, alignment, CreateBlock);
+ Allocation allocation = Allocate(size, alignment, CreateBlock);
return new HvMemoryBlockAllocation(this, allocation.Block, allocation.Offset, allocation.Size);
}
diff --git a/src/Ryujinx.Cpu/AppleHv/HvMemoryManager.cs b/src/Ryujinx.Cpu/AppleHv/HvMemoryManager.cs
index 74c39d6a8..28c78074d 100644
--- a/src/Ryujinx.Cpu/AppleHv/HvMemoryManager.cs
+++ b/src/Ryujinx.Cpu/AppleHv/HvMemoryManager.cs
@@ -233,13 +233,13 @@ namespace Ryujinx.Cpu.AppleHv
yield break;
}
- var guestRegions = GetPhysicalRegionsImpl(va, size);
+ IEnumerable guestRegions = GetPhysicalRegionsImpl(va, size);
if (guestRegions == null)
{
yield break;
}
- foreach (var guestRegion in guestRegions)
+ foreach (MemoryRange guestRegion in guestRegions)
{
nint pointer = _backingMemory.GetPointer(guestRegion.Address, guestRegion.Size);
yield return new HostMemoryRange((nuint)(ulong)pointer, guestRegion.Size);
@@ -254,7 +254,7 @@ namespace Ryujinx.Cpu.AppleHv
yield break;
}
- foreach (var physicalRegion in GetPhysicalRegionsImpl(va, size))
+ foreach (MemoryRange physicalRegion in GetPhysicalRegionsImpl(va, size))
{
yield return physicalRegion;
}
diff --git a/src/Ryujinx.Cpu/AppleHv/HvVcpu.cs b/src/Ryujinx.Cpu/AppleHv/HvVcpu.cs
index ee91c478b..c4eec31a6 100644
--- a/src/Ryujinx.Cpu/AppleHv/HvVcpu.cs
+++ b/src/Ryujinx.Cpu/AppleHv/HvVcpu.cs
@@ -41,7 +41,7 @@ namespace Ryujinx.Cpu.AppleHv
{
// Calculate our time delta in ticks based on the current clock frequency.
- int result = TimeApi.mach_timebase_info(out var timeBaseInfo);
+ int result = TimeApi.mach_timebase_info(out MachTimebaseInfo timeBaseInfo);
Debug.Assert(result == 0);
diff --git a/src/Ryujinx.Cpu/AppleHv/HvVm.cs b/src/Ryujinx.Cpu/AppleHv/HvVm.cs
index b4d45f36d..dc115f515 100644
--- a/src/Ryujinx.Cpu/AppleHv/HvVm.cs
+++ b/src/Ryujinx.Cpu/AppleHv/HvVm.cs
@@ -39,7 +39,7 @@ namespace Ryujinx.Cpu.AppleHv
baseAddress = ipaAllocator.Allocate(block.Size, AsIpaAlignment);
}
- var rwx = HvMemoryFlags.Read | HvMemoryFlags.Write | HvMemoryFlags.Exec;
+ HvMemoryFlags rwx = HvMemoryFlags.Read | HvMemoryFlags.Write | HvMemoryFlags.Exec;
HvApi.hv_vm_map((ulong)block.Pointer, baseAddress, block.Size, rwx).ThrowOnError();
diff --git a/src/Ryujinx.Cpu/Jit/HostTracked/AddressSpacePartition.cs b/src/Ryujinx.Cpu/Jit/HostTracked/AddressSpacePartition.cs
index f9743a0a1..9ee2d58e6 100644
--- a/src/Ryujinx.Cpu/Jit/HostTracked/AddressSpacePartition.cs
+++ b/src/Ryujinx.Cpu/Jit/HostTracked/AddressSpacePartition.cs
@@ -127,7 +127,7 @@ namespace Ryujinx.Cpu.Jit.HostTracked
Debug.Assert(leftSize > 0);
Debug.Assert(rightSize > 0);
- (var leftAllocation, PrivateAllocation) = PrivateAllocation.Split(leftSize);
+ (PrivateMemoryAllocation leftAllocation, PrivateAllocation) = PrivateAllocation.Split(leftSize);
PrivateMapping left = new(Address, leftSize, leftAllocation);
diff --git a/src/Ryujinx.Cpu/Jit/MemoryManager.cs b/src/Ryujinx.Cpu/Jit/MemoryManager.cs
index 076fb6ad8..2635a2c7d 100644
--- a/src/Ryujinx.Cpu/Jit/MemoryManager.cs
+++ b/src/Ryujinx.Cpu/Jit/MemoryManager.cs
@@ -253,13 +253,13 @@ namespace Ryujinx.Cpu.Jit
yield break;
}
- var guestRegions = GetPhysicalRegionsImpl(va, size);
+ IEnumerable guestRegions = GetPhysicalRegionsImpl(va, size);
if (guestRegions == null)
{
yield break;
}
- foreach (var guestRegion in guestRegions)
+ foreach (MemoryRange guestRegion in guestRegions)
{
nint pointer = _backingMemory.GetPointer(guestRegion.Address, guestRegion.Size);
yield return new HostMemoryRange((nuint)(ulong)pointer, guestRegion.Size);
@@ -274,7 +274,7 @@ namespace Ryujinx.Cpu.Jit
yield break;
}
- foreach (var physicalRegion in GetPhysicalRegionsImpl(va, size))
+ foreach (MemoryRange physicalRegion in GetPhysicalRegionsImpl(va, size))
{
yield return physicalRegion;
}
diff --git a/src/Ryujinx.Cpu/Jit/MemoryManagerHostMapped.cs b/src/Ryujinx.Cpu/Jit/MemoryManagerHostMapped.cs
index 0fe8b344f..146805982 100644
--- a/src/Ryujinx.Cpu/Jit/MemoryManagerHostMapped.cs
+++ b/src/Ryujinx.Cpu/Jit/MemoryManagerHostMapped.cs
@@ -340,7 +340,7 @@ namespace Ryujinx.Cpu.Jit
{
int pages = GetPagesCount(va, (uint)size, out va);
- var regions = new List();
+ List regions = new List();
ulong regionStart = GetPhysicalAddressChecked(va);
ulong regionSize = PageSize;
diff --git a/src/Ryujinx.Cpu/Jit/MemoryManagerHostTracked.cs b/src/Ryujinx.Cpu/Jit/MemoryManagerHostTracked.cs
index 499f991f2..d802f5046 100644
--- a/src/Ryujinx.Cpu/Jit/MemoryManagerHostTracked.cs
+++ b/src/Ryujinx.Cpu/Jit/MemoryManagerHostTracked.cs
@@ -240,7 +240,7 @@ namespace Ryujinx.Cpu.Jit
if (TryGetVirtualContiguous(va, data.Length, out MemoryBlock memoryBlock, out ulong offset))
{
- var target = memoryBlock.GetSpan(offset, data.Length);
+ Span target = memoryBlock.GetSpan(offset, data.Length);
bool changed = !data.SequenceEqual(target);
@@ -443,7 +443,7 @@ namespace Ryujinx.Cpu.Jit
return null;
}
- var regions = new List();
+ List regions = new List();
ulong endVa = va + size;
try
diff --git a/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitFlow.cs b/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitFlow.cs
index 48bdbb573..6a8c2abdd 100644
--- a/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitFlow.cs
+++ b/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitFlow.cs
@@ -205,7 +205,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
for (int i = 0; i < funcTable.Levels.Length; i++)
{
- var level = funcTable.Levels[i];
+ AddressTableLevel level = funcTable.Levels[i];
asm.Ubfx(indexReg, guestAddress, level.Index, level.Length);
asm.Lsl(indexReg, indexReg, Const(3));
diff --git a/src/Ryujinx.Cpu/LightningJit/Arm64/Target/Arm64/InstEmitSystem.cs b/src/Ryujinx.Cpu/LightningJit/Arm64/Target/Arm64/InstEmitSystem.cs
index bf9338400..98939839c 100644
--- a/src/Ryujinx.Cpu/LightningJit/Arm64/Target/Arm64/InstEmitSystem.cs
+++ b/src/Ryujinx.Cpu/LightningJit/Arm64/Target/Arm64/InstEmitSystem.cs
@@ -370,7 +370,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
for (int i = 0; i < funcTable.Levels.Length; i++)
{
- var level = funcTable.Levels[i];
+ AddressTableLevel level = funcTable.Levels[i];
asm.Ubfx(indexReg, guestAddress, level.Index, level.Length);
asm.Lsl(indexReg, indexReg, Const(3));
diff --git a/src/Ryujinx.Cpu/LightningJit/Cache/NoWxCache.cs b/src/Ryujinx.Cpu/LightningJit/Cache/NoWxCache.cs
index e9a342aba..a743710e9 100644
--- a/src/Ryujinx.Cpu/LightningJit/Cache/NoWxCache.cs
+++ b/src/Ryujinx.Cpu/LightningJit/Cache/NoWxCache.cs
@@ -190,7 +190,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
private bool TryGetThreadLocalFunction(ulong guestAddress, out nint funcPtr)
{
- if ((_threadLocalCache ??= new()).TryGetValue(guestAddress, out var entry))
+ if ((_threadLocalCache ??= new()).TryGetValue(guestAddress, out ThreadLocalCacheEntry entry))
{
if (entry.IncrementUseCount() >= MinCallsForPad)
{
diff --git a/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs b/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs
index 28539707f..340ae43d1 100644
--- a/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs
+++ b/src/Ryujinx.Cpu/LightningJit/CodeGen/Arm64/Assembler.cs
@@ -41,7 +41,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
{
int targetIndex = _code.Count;
- var state = _labels[label.AsInt32()];
+ LabelState state = _labels[label.AsInt32()];
state.TargetIndex = targetIndex;
state.HasTarget = true;
@@ -68,7 +68,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
{
int branchIndex = _code.Count;
- var state = _labels[label.AsInt32()];
+ LabelState state = _labels[label.AsInt32()];
state.BranchIndex = branchIndex;
state.HasBranch = true;
@@ -94,7 +94,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
{
int branchIndex = _code.Count;
- var state = _labels[label.AsInt32()];
+ LabelState state = _labels[label.AsInt32()];
state.BranchIndex = branchIndex;
state.HasBranch = true;
@@ -113,7 +113,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
{
int branchIndex = _code.Count;
- var state = _labels[label.AsInt32()];
+ LabelState state = _labels[label.AsInt32()];
state.BranchIndex = branchIndex;
state.HasBranch = true;
@@ -342,7 +342,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
public readonly void Cset(Operand rd, ArmCondition condition)
{
- var zr = new Operand(ZrRegister, RegisterType.Integer, rd.Type);
+ Operand zr = new Operand(ZrRegister, RegisterType.Integer, rd.Type);
Csinc(rd, zr, zr, (ArmCondition)((int)condition ^ 1));
}
diff --git a/src/Ryujinx.Cpu/LightningJit/Translator.cs b/src/Ryujinx.Cpu/LightningJit/Translator.cs
index 4c4011f11..22a38ca99 100644
--- a/src/Ryujinx.Cpu/LightningJit/Translator.cs
+++ b/src/Ryujinx.Cpu/LightningJit/Translator.cs
@@ -163,14 +163,14 @@ namespace Ryujinx.Cpu.LightningJit
{
List functions = Functions.AsList();
- foreach (var func in functions)
+ foreach (TranslatedFunction func in functions)
{
JitCache.Unmap(func.FuncPointer);
}
Functions.Clear();
- while (_oldFuncs.TryDequeue(out var kv))
+ while (_oldFuncs.TryDequeue(out KeyValuePair kv))
{
JitCache.Unmap(kv.Value.FuncPointer);
}
diff --git a/src/Ryujinx.Cpu/LightningJit/TranslatorStubs.cs b/src/Ryujinx.Cpu/LightningJit/TranslatorStubs.cs
index c5231e506..6ef653a37 100644
--- a/src/Ryujinx.Cpu/LightningJit/TranslatorStubs.cs
+++ b/src/Ryujinx.Cpu/LightningJit/TranslatorStubs.cs
@@ -174,7 +174,7 @@ namespace Ryujinx.Cpu.LightningJit
for (int i = 0; i < _functionTable.Levels.Length; i++)
{
- ref var level = ref _functionTable.Levels[i];
+ ref AddressTableLevel level = ref _functionTable.Levels[i];
asm.Mov(mask, level.Mask >> level.Index);
asm.And(index, mask, guestAddress, ArmShiftType.Lsr, level.Index);
diff --git a/src/Ryujinx.Cpu/PrivateMemoryAllocator.cs b/src/Ryujinx.Cpu/PrivateMemoryAllocator.cs
index 8db74f1e9..99528b576 100644
--- a/src/Ryujinx.Cpu/PrivateMemoryAllocator.cs
+++ b/src/Ryujinx.Cpu/PrivateMemoryAllocator.cs
@@ -48,7 +48,7 @@ namespace Ryujinx.Cpu
{
for (int i = 0; i < _freeRanges.Count; i++)
{
- var range = _freeRanges[i];
+ Range range = _freeRanges[i];
ulong alignedOffset = BitUtils.AlignUp(range.Offset, alignment);
ulong sizeDelta = alignedOffset - range.Offset;
@@ -84,7 +84,7 @@ namespace Ryujinx.Cpu
private void InsertFreeRange(ulong offset, ulong size)
{
- var range = new Range(offset, size);
+ Range range = new Range(offset, size);
int index = _freeRanges.BinarySearch(range);
if (index < 0)
{
@@ -97,7 +97,7 @@ namespace Ryujinx.Cpu
private void InsertFreeRangeComingled(ulong offset, ulong size)
{
ulong endOffset = offset + size;
- var range = new Range(offset, size);
+ Range range = new Range(offset, size);
int index = _freeRanges.BinarySearch(range);
if (index < 0)
{
@@ -149,7 +149,7 @@ namespace Ryujinx.Cpu
public PrivateMemoryAllocation Allocate(ulong size, ulong alignment)
{
- var allocation = Allocate(size, alignment, CreateBlock);
+ Allocation allocation = Allocate(size, alignment, CreateBlock);
return new PrivateMemoryAllocation(this, allocation.Block, allocation.Offset, allocation.Size);
}
@@ -200,7 +200,7 @@ namespace Ryujinx.Cpu
for (int i = 0; i < _blocks.Count; i++)
{
- var block = _blocks[i];
+ T block = _blocks[i];
if (block.Size >= size)
{
@@ -214,8 +214,8 @@ namespace Ryujinx.Cpu
ulong blockAlignedSize = BitUtils.AlignUp(size, _blockAlignment);
- var memory = new MemoryBlock(blockAlignedSize, _allocationFlags);
- var newBlock = createBlock(memory, blockAlignedSize);
+ MemoryBlock memory = new MemoryBlock(blockAlignedSize, _allocationFlags);
+ T newBlock = createBlock(memory, blockAlignedSize);
InsertBlock(newBlock);
diff --git a/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs b/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs
index 75a6d3bf8..299adfbbd 100644
--- a/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs
+++ b/src/Ryujinx.Cpu/Signal/NativeSignalHandler.cs
@@ -98,7 +98,7 @@ namespace Ryujinx.Cpu.Signal
_signalHandlerPtr = customSignalHandlerFactory(UnixSignalHandlerRegistration.GetSegfaultExceptionHandler().sa_handler, _signalHandlerPtr);
}
- var old = UnixSignalHandlerRegistration.RegisterExceptionHandler(_signalHandlerPtr);
+ UnixSignalHandlerRegistration.SigAction old = UnixSignalHandlerRegistration.RegisterExceptionHandler(_signalHandlerPtr);
config.UnixOldSigaction = (nuint)(ulong)old.sa_handler;
config.UnixOldSigaction3Arg = old.sa_flags & 4;
diff --git a/src/Ryujinx.Graphics.Device/DeviceState.cs b/src/Ryujinx.Graphics.Device/DeviceState.cs
index 0dd4f5904..11d8e3ac2 100644
--- a/src/Ryujinx.Graphics.Device/DeviceState.cs
+++ b/src/Ryujinx.Graphics.Device/DeviceState.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -32,15 +33,15 @@ namespace Ryujinx.Graphics.Device
_debugLogCallback = debugLogCallback;
}
- var fields = typeof(TState).GetFields();
+ FieldInfo[] fields = typeof(TState).GetFields();
int offset = 0;
for (int fieldIndex = 0; fieldIndex < fields.Length; fieldIndex++)
{
- var field = fields[fieldIndex];
+ FieldInfo field = fields[fieldIndex];
- var currentFieldOffset = (int)Marshal.OffsetOf(field.Name);
- var nextFieldOffset = fieldIndex + 1 == fields.Length ? Unsafe.SizeOf() : (int)Marshal.OffsetOf(fields[fieldIndex + 1].Name);
+ int currentFieldOffset = (int)Marshal.OffsetOf(field.Name);
+ int nextFieldOffset = fieldIndex + 1 == fields.Length ? Unsafe.SizeOf() : (int)Marshal.OffsetOf(fields[fieldIndex + 1].Name);
int sizeOfField = nextFieldOffset - currentFieldOffset;
@@ -48,7 +49,7 @@ namespace Ryujinx.Graphics.Device
{
int index = (offset + i) / RegisterSize;
- if (callbacks != null && callbacks.TryGetValue(field.Name, out var cb))
+ if (callbacks != null && callbacks.TryGetValue(field.Name, out RwCallback cb))
{
if (cb.Read != null)
{
@@ -81,7 +82,7 @@ namespace Ryujinx.Graphics.Device
{
uint alignedOffset = index * RegisterSize;
- var readCallback = Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_readCallbacks), (nint)index);
+ Func readCallback = Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(_readCallbacks), (nint)index);
if (readCallback != null)
{
return readCallback();
@@ -119,7 +120,7 @@ namespace Ryujinx.Graphics.Device
uint alignedOffset = index * RegisterSize;
DebugWrite(alignedOffset, data);
- ref var storage = ref GetRefIntAlignedUncheck(index);
+ ref int storage = ref GetRefIntAlignedUncheck(index);
changed = storage != data;
storage = data;
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs
index deec36648..c999ad789 100644
--- a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedPipeline.cs
@@ -359,7 +359,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
public bool TryHostConditionalRendering(ICounterEvent value, ulong compare, bool isEqual)
{
- var evt = value as ThreadedCounterEvent;
+ ThreadedCounterEvent evt = value as ThreadedCounterEvent;
if (evt != null)
{
if (compare == 0 && evt.Type == CounterType.SamplesPassed && evt.ClearCounter)
diff --git a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs
index 6375d290c..676cbe8fc 100644
--- a/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs
+++ b/src/Ryujinx.Graphics.GAL/Multithreading/ThreadedRenderer.cs
@@ -294,7 +294,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
public IImageArray CreateImageArray(int size, bool isBuffer)
{
- var imageArray = new ThreadedImageArray(this);
+ ThreadedImageArray imageArray = new(this);
New().Set(Ref(imageArray), size, isBuffer);
QueueCommand();
@@ -303,7 +303,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
public IProgram CreateProgram(ShaderSource[] shaders, ShaderInfo info)
{
- var program = new ThreadedProgram(this);
+ ThreadedProgram program = new(this);
SourceProgramRequest request = new(program, shaders, info);
@@ -319,7 +319,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
public ISampler CreateSampler(SamplerCreateInfo info)
{
- var sampler = new ThreadedSampler(this);
+ ThreadedSampler sampler = new(this);
New().Set(Ref(sampler), info);
QueueCommand();
@@ -337,7 +337,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
{
if (IsGpuThread())
{
- var texture = new ThreadedTexture(this, info);
+ ThreadedTexture texture = new ThreadedTexture(this, info);
New().Set(Ref(texture), info);
QueueCommand();
@@ -345,7 +345,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
}
else
{
- var texture = new ThreadedTexture(this, info)
+ ThreadedTexture texture = new ThreadedTexture(this, info)
{
Base = _baseRenderer.CreateTexture(info),
};
@@ -355,7 +355,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
}
public ITextureArray CreateTextureArray(int size, bool isBuffer)
{
- var textureArray = new ThreadedTextureArray(this);
+ ThreadedTextureArray textureArray = new ThreadedTextureArray(this);
New().Set(Ref(textureArray), size, isBuffer);
QueueCommand();
@@ -414,7 +414,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
public IProgram LoadProgramBinary(byte[] programBinary, bool hasFragmentShader, ShaderInfo info)
{
- var program = new ThreadedProgram(this);
+ ThreadedProgram program = new ThreadedProgram(this);
BinaryProgramRequest request = new(program, programBinary, hasFragmentShader, info);
Programs.Add(request);
diff --git a/src/Ryujinx.Graphics.GAL/ResourceLayout.cs b/src/Ryujinx.Graphics.GAL/ResourceLayout.cs
index b7464ee12..c91eed3d2 100644
--- a/src/Ryujinx.Graphics.GAL/ResourceLayout.cs
+++ b/src/Ryujinx.Graphics.GAL/ResourceLayout.cs
@@ -126,7 +126,7 @@ namespace Ryujinx.Graphics.GAL
if (Descriptors != null)
{
- foreach (var descriptor in Descriptors)
+ foreach (ResourceDescriptor descriptor in Descriptors)
{
hasher.Add(descriptor);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
index cd8144724..0784fdca8 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Compute/ComputeClass.cs
@@ -2,6 +2,7 @@ using Ryujinx.Graphics.Device;
using Ryujinx.Graphics.Gpu.Engine.InlineToMemory;
using Ryujinx.Graphics.Gpu.Engine.Threed;
using Ryujinx.Graphics.Gpu.Engine.Types;
+using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Gpu.Shader;
using Ryujinx.Graphics.Shader;
using System;
@@ -90,7 +91,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
/// Method call argument
private void SendSignalingPcasB(int argument)
{
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
// Since we're going to change the state, make sure any pending instanced draws are done.
_3dEngine.PerformDeferredDraws();
@@ -100,7 +101,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Compute
uint qmdAddress = _state.State.SendPcasA;
- var qmd = _channel.MemoryManager.Read((ulong)qmdAddress << 8);
+ ComputeQmd qmd = _channel.MemoryManager.Read((ulong)qmdAddress << 8);
ulong shaderGpuVa = ((ulong)_state.State.SetProgramRegionAAddressUpper << 32) | _state.State.SetProgramRegionB;
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/DeviceStateWithShadow.cs b/src/Ryujinx.Graphics.Gpu/Engine/DeviceStateWithShadow.cs
index a2e5b1164..ccfba79a4 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/DeviceStateWithShadow.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/DeviceStateWithShadow.cs
@@ -80,7 +80,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WriteWithRedundancyCheck(int offset, int value, out bool changed)
{
- var shadowRamControl = _state.State.SetMmeShadowRamControlMode;
+ SetMmeShadowRamControlMode shadowRamControl = _state.State.SetMmeShadowRamControlMode;
if (shadowRamControl == SetMmeShadowRamControlMode.MethodPassthrough || offset < 0x200)
{
_state.WriteWithRedundancyCheck(offset, value, out changed);
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
index cdeae0040..4ee15dfef 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Dma/DmaClass.cs
@@ -190,7 +190,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
/// The LaunchDma call argument
private void DmaCopy(int argument)
{
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
CopyFlags copyFlags = (CopyFlags)argument;
@@ -225,8 +225,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
int srcBpp = remap ? srcComponents * componentSize : 1;
int dstBpp = remap ? dstComponents * componentSize : 1;
- var dst = Unsafe.As(ref _state.State.SetDstBlockSize);
- var src = Unsafe.As(ref _state.State.SetSrcBlockSize);
+ DmaTexture dst = Unsafe.As(ref _state.State.SetDstBlockSize);
+ DmaTexture src = Unsafe.As(ref _state.State.SetSrcBlockSize);
int srcRegionX = 0, srcRegionY = 0, dstRegionX = 0, dstRegionY = 0;
@@ -245,7 +245,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
int srcStride = (int)_state.State.PitchIn;
int dstStride = (int)_state.State.PitchOut;
- var srcCalculator = new OffsetCalculator(
+ OffsetCalculator srcCalculator = new OffsetCalculator(
src.Width,
src.Height,
srcStride,
@@ -254,7 +254,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
src.MemoryLayout.UnpackGobBlocksInZ(),
srcBpp);
- var dstCalculator = new OffsetCalculator(
+ OffsetCalculator dstCalculator = new OffsetCalculator(
dst.Width,
dst.Height,
dstStride,
@@ -293,7 +293,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
if (completeSource && completeDest && !srcLinear && isIdentityRemap)
{
- var source = memoryManager.Physical.TextureCache.FindTexture(
+ Image.Texture source = memoryManager.Physical.TextureCache.FindTexture(
memoryManager,
srcGpuVa,
srcBpp,
@@ -309,7 +309,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
{
source.SynchronizeMemory();
- var target = memoryManager.Physical.TextureCache.FindOrCreateTexture(
+ Image.Texture target = memoryManager.Physical.TextureCache.FindOrCreateTexture(
memoryManager,
source.Info.FormatInfo,
dstGpuVa,
@@ -339,7 +339,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Dma
if (completeSource && completeDest && !(dstLinear && !srcLinear) && isIdentityRemap)
{
- var target = memoryManager.Physical.TextureCache.FindTexture(
+ Image.Texture target = memoryManager.Physical.TextureCache.FindTexture(
memoryManager,
dstGpuVa,
dstBpp,
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs
index 984a9cff8..c0f8ccf76 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/GPFifo/GPFifoProcessor.cs
@@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.GPFifo
int availableCount = commandBuffer.Length - offset;
int consumeCount = Math.Min(_state.MethodCount, availableCount);
- var data = commandBuffer.Slice(offset, consumeCount);
+ ReadOnlySpan data = commandBuffer.Slice(offset, consumeCount);
if (_state.SubChannel == 0)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs
index 78099f74a..aad97ad81 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/InlineToMemory/InlineToMemoryClass.cs
@@ -1,6 +1,7 @@
using Ryujinx.Common;
using Ryujinx.Common.Memory;
using Ryujinx.Graphics.Device;
+using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Texture;
using System;
using System.Collections.Generic;
@@ -168,9 +169,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
///
private void FinishTransfer()
{
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
- var data = MemoryMarshal.Cast(_buffer)[.._size];
+ Span data = MemoryMarshal.Cast(_buffer)[.._size];
if (_isLinear && _lineCount == 1)
{
@@ -184,7 +185,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
// Right now the copy code at the bottom assumes that it is used on both which might be incorrect.
if (!_isLinear)
{
- var target = memoryManager.Physical.TextureCache.FindTexture(
+ Image.Texture target = memoryManager.Physical.TextureCache.FindTexture(
memoryManager,
_dstGpuVa,
1,
@@ -199,7 +200,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
if (target != null)
{
target.SynchronizeMemory();
- var dataCopy = MemoryOwner.RentCopy(data);
+ MemoryOwner dataCopy = MemoryOwner.RentCopy(data);
target.SetData(dataCopy, 0, 0, new GAL.Rectangle(_dstX, _dstY, _lineLengthIn / target.Info.FormatInfo.BytesPerPixel, _lineCount));
target.SignalModified();
@@ -207,7 +208,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.InlineToMemory
}
}
- var dstCalculator = new OffsetCalculator(
+ OffsetCalculator dstCalculator = new OffsetCalculator(
_dstWidth,
_dstHeight,
_dstStride,
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs
index 475d1ee4e..f62a4c01a 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLE.cs
@@ -285,12 +285,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// First argument of the call
private void DrawArraysInstanced(IDeviceState state, int arg0)
{
- var topology = (PrimitiveTopology)arg0;
+ PrimitiveTopology topology = (PrimitiveTopology)arg0;
- var count = FetchParam();
- var instanceCount = FetchParam();
- var firstVertex = FetchParam();
- var firstInstance = FetchParam();
+ FifoWord count = FetchParam();
+ FifoWord instanceCount = FetchParam();
+ FifoWord firstVertex = FetchParam();
+ FifoWord firstInstance = FetchParam();
if (ShouldSkipDraw(state, instanceCount.Word))
{
@@ -314,13 +314,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// First argument of the call
private void DrawElements(IDeviceState state, int arg0)
{
- var topology = (PrimitiveTopology)arg0;
+ PrimitiveTopology topology = (PrimitiveTopology)arg0;
- var indexAddressHigh = FetchParam();
- var indexAddressLow = FetchParam();
- var indexType = FetchParam();
- var firstIndex = 0;
- var indexCount = FetchParam();
+ FifoWord indexAddressHigh = FetchParam();
+ FifoWord indexAddressLow = FetchParam();
+ FifoWord indexType = FetchParam();
+ int firstIndex = 0;
+ FifoWord indexCount = FetchParam();
_processor.ThreedClass.UpdateIndexBuffer(
(uint)indexAddressHigh.Word,
@@ -344,13 +344,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// First argument of the call
private void DrawElementsInstanced(IDeviceState state, int arg0)
{
- var topology = (PrimitiveTopology)arg0;
+ PrimitiveTopology topology = (PrimitiveTopology)arg0;
- var count = FetchParam();
- var instanceCount = FetchParam();
- var firstIndex = FetchParam();
- var firstVertex = FetchParam();
- var firstInstance = FetchParam();
+ FifoWord count = FetchParam();
+ FifoWord instanceCount = FetchParam();
+ FifoWord firstIndex = FetchParam();
+ FifoWord firstVertex = FetchParam();
+ FifoWord firstInstance = FetchParam();
if (ShouldSkipDraw(state, instanceCount.Word))
{
@@ -374,17 +374,17 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// First argument of the call
private void DrawElementsIndirect(IDeviceState state, int arg0)
{
- var topology = (PrimitiveTopology)arg0;
+ PrimitiveTopology topology = (PrimitiveTopology)arg0;
- var count = FetchParam();
- var instanceCount = FetchParam();
- var firstIndex = FetchParam();
- var firstVertex = FetchParam();
- var firstInstance = FetchParam();
+ FifoWord count = FetchParam();
+ FifoWord instanceCount = FetchParam();
+ FifoWord firstIndex = FetchParam();
+ FifoWord firstVertex = FetchParam();
+ FifoWord firstInstance = FetchParam();
ulong indirectBufferGpuVa = count.GpuVa;
- var bufferCache = _processor.MemoryManager.Physical.BufferCache;
+ BufferCache bufferCache = _processor.MemoryManager.Physical.BufferCache;
bool useBuffer = bufferCache.CheckModified(_processor.MemoryManager, indirectBufferGpuVa, IndirectIndexedDataEntrySize, out ulong indirectBufferAddress);
@@ -432,7 +432,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
int startDraw = arg0;
int endDraw = arg1;
- var topology = (PrimitiveTopology)arg2;
+ PrimitiveTopology topology = (PrimitiveTopology)arg2;
int paddingWords = arg3;
int stride = paddingWords * 4 + 0x14;
@@ -468,12 +468,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
for (int i = 0; i < maxDrawCount; i++)
{
- var count = FetchParam();
+ FifoWord count = FetchParam();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
- var instanceCount = FetchParam();
- var firstIndex = FetchParam();
- var firstVertex = FetchParam();
- var firstInstance = FetchParam();
+ FifoWord instanceCount = FetchParam();
+ FifoWord firstIndex = FetchParam();
+ FifoWord firstVertex = FetchParam();
+ FifoWord firstInstance = FetchParam();
#pragma warning restore IDE0059
if (i == 0)
@@ -492,7 +492,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
}
}
- var bufferCache = _processor.MemoryManager.Physical.BufferCache;
+ BufferCache bufferCache = _processor.MemoryManager.Physical.BufferCache;
ulong indirectBufferSize = (ulong)maxDrawCount * (ulong)stride;
@@ -526,7 +526,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// The call argument, or a 0 value with null address if the FIFO is empty
private FifoWord FetchParam()
{
- if (!Fifo.TryDequeue(out var value))
+ if (!Fifo.TryDequeue(out FifoWord value))
{
Logger.Warning?.Print(LogClass.Gpu, "Macro attempted to fetch an inexistent argument.");
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs
index e3080228e..1df68a50f 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs
@@ -90,13 +90,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// True if there is a implementation available and supported, false otherwise
public static bool TryGetMacroHLEFunction(ReadOnlySpan code, Capabilities caps, out MacroHLEFunctionName name)
{
- var mc = MemoryMarshal.Cast(code);
+ ReadOnlySpan mc = MemoryMarshal.Cast(code);
for (int i = 0; i < _table.Length; i++)
{
- ref var entry = ref _table[i];
+ ref TableEntry entry = ref _table[i];
- var hash = Hash128.ComputeHash(mc[..entry.Length]);
+ Hash128 hash = Hash128.ComputeHash(mc[..entry.Length]);
if (hash == entry.Hash)
{
if (IsMacroHLESupported(caps, entry.Name))
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs
index dd60688d6..707265184 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroInterpreter.cs
@@ -369,7 +369,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// The call argument, or 0 if the FIFO is empty
private int FetchParam()
{
- if (!Fifo.TryDequeue(out var value))
+ if (!Fifo.TryDequeue(out FifoWord value))
{
Logger.Warning?.Print(LogClass.Gpu, "Macro attempted to fetch an inexistent argument.");
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs
index 01bff8e89..174af9739 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/MME/MacroJitContext.cs
@@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME
/// The call argument, or 0 if the FIFO is empty
public int FetchParam()
{
- if (!Fifo.TryDequeue(out var value))
+ if (!Fifo.TryDequeue(out FifoWord value))
{
Logger.Warning?.Print(LogClass.Gpu, "Macro attempted to fetch an inexistent argument.");
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs
index 13e5d2a86..020db62be 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendFunctions.cs
@@ -221,7 +221,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
sb.AppendLine($"private static Dictionary _entries = new()");
sb.AppendLine("{");
- foreach (var entry in Table)
+ foreach (AdvancedBlendUcode entry in Table)
{
Hash128 hash = Hash128.ComputeHash(MemoryMarshal.Cast(entry.Code));
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs
index ce3d2c236..18428eda9 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/Blender/AdvancedBlendManager.cs
@@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
descriptor = default;
- if (!AdvancedBlendPreGenTable.Entries.TryGetValue(hash, out var entry))
+ if (!AdvancedBlendPreGenTable.Entries.TryGetValue(hash, out AdvancedBlendEntry entry))
{
return false;
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs
index 34f2cfcad..15f1a4a33 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeContext.cs
@@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
{
if (disposing)
{
- foreach (var texture in _cache.Values)
+ foreach (ITexture texture in _cache.Values)
{
texture.Release();
}
@@ -603,7 +603,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
DestroyIfNotNull(ref _geometryIndexDataBuffer.Handle);
DestroyIfNotNull(ref _sequentialIndexBuffer);
- foreach (var indexBuffer in _topologyRemapBuffers.Values)
+ foreach (IndexBuffer indexBuffer in _topologyRemapBuffers.Values)
{
_context.Renderer.DeleteBuffer(indexBuffer.Handle);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeState.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeState.cs
index 2de324392..8a667b408 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ComputeDraw/VtgAsComputeState.cs
@@ -127,7 +127,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
for (int index = 0; index < Constants.TotalVertexAttribs; index++)
{
- var vertexAttrib = _state.State.VertexAttribState[index];
+ VertexAttribState vertexAttrib = _state.State.VertexAttribState[index];
if (!FormatTable.TryGetSingleComponentAttribFormat(vertexAttrib.UnpackFormat(), out Format format, out int componentsCount))
{
@@ -153,7 +153,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
int bufferIndex = vertexAttrib.UnpackBufferIndex();
GpuVa endAddress = _state.State.VertexBufferEndAddress[bufferIndex];
- var vertexBuffer = _state.State.VertexBufferState[bufferIndex];
+ VertexBufferState vertexBuffer = _state.State.VertexBufferState[bufferIndex];
bool instanced = _state.State.VertexBufferInstanced[bufferIndex];
ulong address = vertexBuffer.Address.Pack();
@@ -351,7 +351,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
/// Size of the buffer in bytes
private readonly void SetBufferTexture(ResourceReservations reservations, int index, Format format, ulong address, ulong size)
{
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
BufferRange range = memoryManager.Physical.BufferCache.GetBufferRange(memoryManager.GetPhysicalRegions(address, size), BufferStage.VertexBuffer);
@@ -392,7 +392,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.ComputeDraw
indexOffset <<= shift;
size <<= shift;
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
ulong misalign = address & ((ulong)_context.Capabilities.TextureBufferOffsetAlignment - 1);
BufferRange range = memoryManager.Physical.BufferCache.GetBufferRange(
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs
index 2095fcd7a..6fc49fc8d 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ConstantBufferUpdater.cs
@@ -1,3 +1,4 @@
+using Ryujinx.Graphics.Gpu.Memory;
using System;
using System.Runtime.InteropServices;
@@ -92,7 +93,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (enable)
{
- var uniformBuffer = _state.State.UniformBufferState;
+ UniformBufferState uniformBuffer = _state.State.UniformBufferState;
ulong address = uniformBuffer.Address.Pack();
@@ -111,7 +112,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
if (_ubFollowUpAddress != 0)
{
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
Span data = MemoryMarshal.Cast(_ubData.AsSpan(0, (int)(_ubByteCount / 4)));
@@ -131,7 +132,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// New uniform buffer data word
public void Update(int argument)
{
- var uniformBuffer = _state.State.UniformBufferState;
+ UniformBufferState uniformBuffer = _state.State.UniformBufferState;
ulong address = uniformBuffer.Address.Pack() + (uint)uniformBuffer.Offset;
@@ -157,7 +158,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Data to be written to the uniform buffer
public void Update(ReadOnlySpan data)
{
- var uniformBuffer = _state.State.UniformBufferState;
+ UniformBufferState uniformBuffer = _state.State.UniformBufferState;
ulong address = uniformBuffer.Address.Pack() + (uint)uniformBuffer.Offset;
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
index 56ef64c6e..2537b79b7 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/DrawManager.cs
@@ -471,7 +471,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
int textureId = _state.State.DrawTextureTextureId;
int samplerId = _state.State.DrawTextureSamplerId;
- (var texture, var sampler) = _channel.TextureManager.GetGraphicsTextureAndSampler(textureId, samplerId);
+ (Image.Texture texture, Sampler sampler) = _channel.TextureManager.GetGraphicsTextureAndSampler(textureId, samplerId);
srcX0 *= texture.ScaleFactor;
srcY0 *= texture.ScaleFactor;
@@ -684,8 +684,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (hasCount)
{
- var indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
- var parameterBuffer = memory.BufferCache.GetBufferRange(parameterBufferRange, BufferStage.Indirect);
+ BufferRange indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
+ BufferRange parameterBuffer = memory.BufferCache.GetBufferRange(parameterBufferRange, BufferStage.Indirect);
if (indexed)
{
@@ -698,7 +698,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
}
else
{
- var indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
+ BufferRange indirectBuffer = memory.BufferCache.GetBufferRange(indirectBufferRange, BufferStage.Indirect);
if (indexed)
{
@@ -820,7 +820,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
// If there is a mismatch on the host clip region and the one explicitly defined by the guest
// on the screen scissor state, then we need to force only one texture to be bound to avoid
// host clipping.
- var screenScissorState = _state.State.ScreenScissorState;
+ ScreenScissorState screenScissorState = _state.State.ScreenScissorState;
bool clearAffectedByStencilMask = (_state.State.ClearFlags & 1) != 0;
bool clearAffectedByScissor = (_state.State.ClearFlags & 0x100) != 0;
@@ -833,7 +833,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (fullClear && clearAffectedByScissor && _state.State.ScissorState[0].Enable)
{
- ref var scissorState = ref _state.State.ScissorState[0];
+ ref ScissorState scissorState = ref _state.State.ScissorState[0];
fullClear = scissorState.X1 == screenScissorState.X &&
scissorState.Y1 == screenScissorState.Y &&
@@ -894,7 +894,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (clearAffectedByScissor && _state.State.ScissorState[0].Enable)
{
- ref var scissorState = ref _state.State.ScissorState[0];
+ ref ScissorState scissorState = ref _state.State.ScissorState[0];
scissorX = Math.Max(scissorX, scissorState.X1);
scissorY = Math.Max(scissorY, scissorState.Y1);
@@ -923,7 +923,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (componentMask != 0)
{
- var clearColor = _state.State.ClearColors;
+ ClearColors clearColor = _state.State.ClearColors;
ColorF color = new(clearColor.Red, clearColor.Green, clearColor.Blue, clearColor.Alpha);
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
index dbd4efc8f..4eea80687 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/SpecializationStateUpdater.cs
@@ -288,7 +288,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
int rtIndex = rtControl.UnpackPermutationIndex(index);
- var colorState = state[rtIndex];
+ RtColorState colorState = state[rtIndex];
if (index < count && StateUpdater.IsRtEnabled(colorState))
{
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs
index ea9fc9e31..4f9e57f76 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdateTracker.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -58,13 +59,13 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_registerToGroupMapping = new byte[BlockSize];
_callbacks = new Action[entries.Length];
- var fieldToDelegate = new Dictionary();
+ Dictionary fieldToDelegate = new Dictionary();
for (int entryIndex = 0; entryIndex < entries.Length; entryIndex++)
{
- var entry = entries[entryIndex];
+ StateUpdateCallbackEntry entry = entries[entryIndex];
- foreach (var fieldName in entry.FieldNames)
+ foreach (string fieldName in entry.FieldNames)
{
fieldToDelegate.Add(fieldName, entryIndex);
}
@@ -72,15 +73,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_callbacks[entryIndex] = entry.Callback;
}
- var fields = typeof(TState).GetFields();
+ FieldInfo[] fields = typeof(TState).GetFields();
int offset = 0;
for (int fieldIndex = 0; fieldIndex < fields.Length; fieldIndex++)
{
- var field = fields[fieldIndex];
+ FieldInfo field = fields[fieldIndex];
- var currentFieldOffset = (int)Marshal.OffsetOf(field.Name);
- var nextFieldOffset = fieldIndex + 1 == fields.Length ? Unsafe.SizeOf() : (int)Marshal.OffsetOf(fields[fieldIndex + 1].Name);
+ int currentFieldOffset = (int)Marshal.OffsetOf(field.Name);
+ int nextFieldOffset = fieldIndex + 1 == fields.Length ? Unsafe.SizeOf() : (int)Marshal.OffsetOf(fields[fieldIndex + 1].Name);
int sizeOfField = nextFieldOffset - currentFieldOffset;
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
index 1dc77b52d..d8e53124b 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
@@ -3,6 +3,7 @@ using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Engine.Threed.Blender;
using Ryujinx.Graphics.Gpu.Engine.Types;
using Ryujinx.Graphics.Gpu.Image;
+using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Gpu.Shader;
using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Texture;
@@ -463,8 +464,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// If this is not -1, it indicates that only the given indexed target will be used.
public void UpdateRenderTargetState(RenderTargetUpdateFlags updateFlags, int singleUse = -1)
{
- var memoryManager = _channel.MemoryManager;
- var rtControl = _state.State.RtControl;
+ MemoryManager memoryManager = _channel.MemoryManager;
+ RtControl rtControl = _state.State.RtControl;
bool useControl = updateFlags.HasFlag(RenderTargetUpdateFlags.UseControl);
bool layered = updateFlags.HasFlag(RenderTargetUpdateFlags.Layered);
@@ -473,12 +474,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
int count = useControl ? rtControl.UnpackCount() : Constants.TotalRenderTargets;
- var msaaMode = _state.State.RtMsaaMode;
+ TextureMsaaMode msaaMode = _state.State.RtMsaaMode;
int samplesInX = msaaMode.SamplesInX();
int samplesInY = msaaMode.SamplesInY();
- var scissor = _state.State.ScreenScissorState;
+ ScreenScissorState scissor = _state.State.ScreenScissorState;
Size sizeHint = new((scissor.X + scissor.Width) * samplesInX, (scissor.Y + scissor.Height) * samplesInY, 1);
int clipRegionWidth = int.MaxValue;
@@ -491,7 +492,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
int rtIndex = useControl ? rtControl.UnpackPermutationIndex(index) : index;
- var colorState = _state.State.RtColorState[rtIndex];
+ RtColorState colorState = _state.State.RtColorState[rtIndex];
if (index >= count || !IsRtEnabled(colorState) || (singleColor && index != singleUse))
{
@@ -541,8 +542,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (dsEnable && updateFlags.HasFlag(RenderTargetUpdateFlags.UpdateDepthStencil))
{
- var dsState = _state.State.RtDepthStencilState;
- var dsSize = _state.State.RtDepthStencilSize;
+ RtDepthStencilState dsState = _state.State.RtDepthStencilState;
+ Size3D dsSize = _state.State.RtDepthStencilSize;
depthStencil = memoryManager.Physical.TextureCache.FindOrCreateTexture(
memoryManager,
@@ -643,7 +644,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (_state.State.YControl.HasFlag(YControl.NegateY))
{
- ref var screenScissor = ref _state.State.ScreenScissorState;
+ ref ScreenScissorState screenScissor = ref _state.State.ScreenScissorState;
y = screenScissor.Height - height - y;
if (y < 0)
@@ -721,8 +722,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateViewportTransform()
{
- var yControl = _state.State.YControl;
- var face = _state.State.FaceState;
+ YControl yControl = _state.State.YControl;
+ FaceState face = _state.State.FaceState;
bool disableTransform = _state.State.ViewportTransformEnable == 0;
bool yNegate = yControl.HasFlag(YControl.NegateY);
@@ -736,17 +737,17 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
if (disableTransform)
{
- ref var scissor = ref _state.State.ScreenScissorState;
+ ref ScreenScissorState scissor = ref _state.State.ScreenScissorState;
float rScale = _channel.TextureManager.RenderTargetScale;
- var scissorRect = new Rectangle(0, 0, (scissor.X + scissor.Width) * rScale, (scissor.Y + scissor.Height) * rScale);
+ Rectangle scissorRect = new Rectangle(0, 0, (scissor.X + scissor.Width) * rScale, (scissor.Y + scissor.Height) * rScale);
viewports[index] = new Viewport(scissorRect, ViewportSwizzle.PositiveX, ViewportSwizzle.PositiveY, ViewportSwizzle.PositiveZ, ViewportSwizzle.PositiveW, 0, 1);
continue;
}
- ref var transform = ref _state.State.ViewportTransform[index];
- ref var extents = ref _state.State.ViewportExtents[index];
+ ref ViewportTransform transform = ref _state.State.ViewportTransform[index];
+ ref ViewportExtents extents = ref _state.State.ViewportExtents[index];
float scaleX = MathF.Abs(transform.ScaleX);
float scaleY = transform.ScaleY;
@@ -841,7 +842,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateDepthBiasState()
{
- var depthBias = _state.State.DepthBiasState;
+ DepthBiasState depthBias = _state.State.DepthBiasState;
float factor = _state.State.DepthBiasFactor;
float units = _state.State.DepthBiasUnits;
@@ -862,9 +863,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateStencilTestState()
{
- var backMasks = _state.State.StencilBackMasks;
- var test = _state.State.StencilTestState;
- var backTest = _state.State.StencilBackTestState;
+ StencilBackMasks backMasks = _state.State.StencilBackMasks;
+ StencilTestState test = _state.State.StencilTestState;
+ StencilBackTestState backTest = _state.State.StencilBackTestState;
CompareOp backFunc;
StencilOp backSFail;
@@ -934,10 +935,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateSamplerPoolState()
{
- var texturePool = _state.State.TexturePoolState;
- var samplerPool = _state.State.SamplerPoolState;
+ PoolState texturePool = _state.State.TexturePoolState;
+ PoolState samplerPool = _state.State.SamplerPoolState;
- var samplerIndex = _state.State.SamplerIndex;
+ SamplerIndex samplerIndex = _state.State.SamplerIndex;
int maximumId = samplerIndex == SamplerIndex.ViaHeaderIndex
? texturePool.MaximumId
@@ -951,7 +952,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateTexturePoolState()
{
- var texturePool = _state.State.TexturePoolState;
+ PoolState texturePool = _state.State.TexturePoolState;
_channel.TextureManager.SetGraphicsTexturePool(texturePool.Address.Pack(), texturePool.MaximumId);
_channel.TextureManager.SetGraphicsTextureBufferIndex((int)_state.State.TextureBufferIndex);
@@ -971,7 +972,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalVertexAttribs; index++)
{
- var vertexAttrib = _state.State.VertexAttribState[index];
+ VertexAttribState vertexAttrib = _state.State.VertexAttribState[index];
int bufferIndex = vertexAttrib.UnpackBufferIndex();
@@ -1065,7 +1066,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateIndexBufferState()
{
- var indexBuffer = _state.State.IndexBufferState;
+ IndexBufferState indexBuffer = _state.State.IndexBufferState;
if (_drawState.IndexCount == 0)
{
@@ -1109,7 +1110,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalVertexBuffers; index++)
{
- var vertexBuffer = _state.State.VertexBufferState[index];
+ VertexBufferState vertexBuffer = _state.State.VertexBufferState[index];
if (!vertexBuffer.UnpackEnable())
{
@@ -1193,8 +1194,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateFaceState()
{
- var yControl = _state.State.YControl;
- var face = _state.State.FaceState;
+ YControl yControl = _state.State.YControl;
+ FaceState face = _state.State.FaceState;
_pipeline.CullEnable = face.CullEnable;
_pipeline.CullMode = face.CullFace;
@@ -1233,7 +1234,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalRenderTargets; index++)
{
- var colorMask = _state.State.RtColorMask[rtColorMaskShared ? 0 : index];
+ RtColorMask colorMask = _state.State.RtColorMask[rtColorMaskShared ? 0 : index];
uint componentMask;
@@ -1256,7 +1257,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
{
if (_state.State.BlendUcodeEnable != BlendUcodeEnable.Disabled)
{
- if (_context.Capabilities.SupportsBlendEquationAdvanced && _blendManager.TryGetAdvancedBlend(out var blendDescriptor))
+ if (_context.Capabilities.SupportsBlendEquationAdvanced && _blendManager.TryGetAdvancedBlend(out AdvancedBlendDescriptor blendDescriptor))
{
// Try to HLE it using advanced blend on the host if we can.
_context.Renderer.Pipeline.SetBlendState(blendDescriptor);
@@ -1278,9 +1279,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < Constants.TotalRenderTargets; index++)
{
bool enable = _state.State.BlendEnable[index];
- var blend = _state.State.BlendState[index];
+ BlendState blend = _state.State.BlendState[index];
- var descriptor = new BlendDescriptor(
+ BlendDescriptor descriptor = new BlendDescriptor(
enable,
blendConstant,
blend.ColorOp,
@@ -1306,9 +1307,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
else
{
bool enable = _state.State.BlendEnable[0];
- var blend = _state.State.BlendStateCommon;
+ BlendStateCommon blend = _state.State.BlendStateCommon;
- var descriptor = new BlendDescriptor(
+ BlendDescriptor descriptor = new BlendDescriptor(
enable,
blendConstant,
blend.ColorOp,
@@ -1409,7 +1410,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateShaderState()
{
- var shaderCache = _channel.MemoryManager.Physical.ShaderCache;
+ ShaderCache shaderCache = _channel.MemoryManager.Physical.ShaderCache;
_vtgWritesRtLayer = false;
@@ -1420,7 +1421,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
for (int index = 0; index < 6; index++)
{
- var shader = _state.State.ShaderState[index];
+ ShaderState shader = _state.State.ShaderState[index];
if (!shader.UnpackEnable() && index != 1)
{
continue;
@@ -1525,7 +1526,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
///
private void UpdateSupportBufferViewportSize()
{
- ref var transform = ref _state.State.ViewportTransform[0];
+ ref ViewportTransform transform = ref _state.State.ViewportTransform[0];
float scaleX = MathF.Abs(transform.ScaleX);
float scaleY = transform.ScaleY;
@@ -1564,8 +1565,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Current depth mode
private DepthMode GetDepthMode()
{
- ref var transform = ref _state.State.ViewportTransform[0];
- ref var extents = ref _state.State.ViewportExtents[0];
+ ref ViewportTransform transform = ref _state.State.ViewportTransform[0];
+ ref ViewportExtents extents = ref _state.State.ViewportExtents[0];
DepthMode depthMode;
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs
index ab1d27a1c..618743018 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/ThreedClass.cs
@@ -82,8 +82,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
_i2mClass = new InlineToMemoryClass(context, channel, initializeState: false);
- var spec = new SpecializationStateUpdater(context);
- var drawState = new DrawState();
+ SpecializationStateUpdater spec = new SpecializationStateUpdater(context);
+ DrawState drawState = new DrawState();
_drawManager = new DrawManager(context, channel, _state, drawState, spec);
_blendManager = new AdvancedBlendManager(_state);
@@ -253,8 +253,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
}
else
{
- ref var lhsVec = ref Unsafe.As>(ref lhs);
- ref var rhsVec = ref Unsafe.As>(ref rhs);
+ ref Vector128 lhsVec = ref Unsafe.As>(ref lhs);
+ ref Vector128 rhsVec = ref Unsafe.As>(ref rhs);
return Vector128.EqualsAll(lhsVec, rhsVec) &&
Vector128.EqualsAll(Unsafe.Add(ref lhsVec, 1), Unsafe.Add(ref rhsVec, 1));
@@ -267,8 +267,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Blend enable
public void UpdateBlendEnable(ref Array8 enable)
{
- var shadow = ShadowMode;
- ref var state = ref _state.State.BlendEnable;
+ SetMmeShadowRamControlMode shadow = ShadowMode;
+ ref Array8 state = ref _state.State.BlendEnable;
if (shadow.IsReplay())
{
@@ -294,8 +294,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Color masks
public void UpdateColorMasks(ref Array8 masks)
{
- var shadow = ShadowMode;
- ref var state = ref _state.State.RtColorMask;
+ SetMmeShadowRamControlMode shadow = ShadowMode;
+ ref Array8 state = ref _state.State.RtColorMask;
if (shadow.IsReplay())
{
@@ -323,12 +323,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Type of the binding
public void UpdateIndexBuffer(uint addrHigh, uint addrLow, IndexType type)
{
- var shadow = ShadowMode;
- ref var state = ref _state.State.IndexBufferState;
+ SetMmeShadowRamControlMode shadow = ShadowMode;
+ ref IndexBufferState state = ref _state.State.IndexBufferState;
if (shadow.IsReplay())
{
- ref var shadowState = ref _state.ShadowState.IndexBufferState;
+ ref IndexBufferState shadowState = ref _state.ShadowState.IndexBufferState;
addrHigh = shadowState.Address.High;
addrLow = shadowState.Address.Low;
type = shadowState.Type;
@@ -345,7 +345,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (shadow.IsTrack())
{
- ref var shadowState = ref _state.ShadowState.IndexBufferState;
+ ref IndexBufferState shadowState = ref _state.ShadowState.IndexBufferState;
shadowState.Address.High = addrHigh;
shadowState.Address.Low = addrLow;
shadowState.Type = type;
@@ -360,12 +360,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Low part of the address
public void UpdateUniformBufferState(int size, uint addrHigh, uint addrLow)
{
- var shadow = ShadowMode;
- ref var state = ref _state.State.UniformBufferState;
+ SetMmeShadowRamControlMode shadow = ShadowMode;
+ ref UniformBufferState state = ref _state.State.UniformBufferState;
if (shadow.IsReplay())
{
- ref var shadowState = ref _state.ShadowState.UniformBufferState;
+ ref UniformBufferState shadowState = ref _state.ShadowState.UniformBufferState;
size = shadowState.Size;
addrHigh = shadowState.Address.High;
addrLow = shadowState.Address.Low;
@@ -377,7 +377,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
if (shadow.IsTrack())
{
- ref var shadowState = ref _state.ShadowState.UniformBufferState;
+ ref UniformBufferState shadowState = ref _state.ShadowState.UniformBufferState;
shadowState.Size = size;
shadowState.Address.High = addrHigh;
shadowState.Address.Low = addrLow;
@@ -391,8 +391,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Offset to update with
public void SetShaderOffset(int index, uint offset)
{
- var shadow = ShadowMode;
- ref var shaderState = ref _state.State.ShaderState[index];
+ SetMmeShadowRamControlMode shadow = ShadowMode;
+ ref ShaderState shaderState = ref _state.State.ShaderState[index];
if (shadow.IsReplay())
{
@@ -418,8 +418,8 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// Uniform buffer state
public void UpdateUniformBufferState(UniformBufferState ubState)
{
- var shadow = ShadowMode;
- ref var state = ref _state.State.UniformBufferState;
+ SetMmeShadowRamControlMode shadow = ShadowMode;
+ ref UniformBufferState state = ref _state.State.UniformBufferState;
if (shadow.IsReplay())
{
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
index 0dd9481df..60a558d56 100644
--- a/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
+++ b/src/Ryujinx.Graphics.Gpu/Engine/Twod/TwodClass.cs
@@ -3,6 +3,7 @@ using Ryujinx.Graphics.Device;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Engine.Types;
using Ryujinx.Graphics.Gpu.Image;
+using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Texture;
using Ryujinx.Memory;
using System;
@@ -123,7 +124,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
/// Bytes per pixel
private void UnscaledFullCopy(TwodTexture src, TwodTexture dst, int w, int h, int bpp)
{
- var srcCalculator = new OffsetCalculator(
+ OffsetCalculator srcCalculator = new OffsetCalculator(
w,
h,
src.Stride,
@@ -134,7 +135,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
(int _, int srcSize) = srcCalculator.GetRectangleRange(0, 0, w, h);
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
ulong srcGpuVa = src.Address.Pack();
ulong dstGpuVa = dst.Address.Pack();
@@ -228,10 +229,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
/// Method call argument
private void PixelsFromMemorySrcY0Int(int argument)
{
- var memoryManager = _channel.MemoryManager;
+ MemoryManager memoryManager = _channel.MemoryManager;
- var dstCopyTexture = Unsafe.As(ref _state.State.SetDstFormat);
- var srcCopyTexture = Unsafe.As(ref _state.State.SetSrcFormat);
+ TwodTexture dstCopyTexture = Unsafe.As(ref _state.State.SetDstFormat);
+ TwodTexture srcCopyTexture = Unsafe.As(ref _state.State.SetSrcFormat);
long srcX = ((long)_state.State.SetPixelsFromMemorySrcX0Int << 32) | (long)(ulong)_state.State.SetPixelsFromMemorySrcX0Frac;
long srcY = ((long)_state.State.PixelsFromMemorySrcY0Int << 32) | (long)(ulong)_state.State.SetPixelsFromMemorySrcY0Frac;
@@ -268,10 +269,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
// The source and destination textures should at least be as big as the region being requested.
// The hints will only resize within alignment constraints, so out of bound copies won't resize in most cases.
- var srcHint = new Size(srcX2, srcY2, 1);
- var dstHint = new Size(dstX2, dstY2, 1);
+ Size srcHint = new Size(srcX2, srcY2, 1);
+ Size dstHint = new Size(dstX2, dstY2, 1);
- var srcCopyTextureFormat = srcCopyTexture.Format.Convert();
+ FormatInfo srcCopyTextureFormat = srcCopyTexture.Format.Convert();
int srcWidthAligned = srcCopyTexture.Stride / srcCopyTextureFormat.BytesPerPixel;
@@ -304,7 +305,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
// are the same, as we can't blit between different depth formats.
bool srcDepthAlias = srcCopyTexture.Format == dstCopyTexture.Format;
- var srcTexture = memoryManager.Physical.TextureCache.FindOrCreateTexture(
+ Image.Texture srcTexture = memoryManager.Physical.TextureCache.FindOrCreateTexture(
memoryManager,
srcCopyTexture,
offset,
@@ -341,7 +342,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Twod
dstCopyTextureFormat = dstCopyTexture.Format.Convert();
}
- var dstTexture = memoryManager.Physical.TextureCache.FindOrCreateTexture(
+ Image.Texture dstTexture = memoryManager.Physical.TextureCache.FindOrCreateTexture(
memoryManager,
dstCopyTexture,
0,
diff --git a/src/Ryujinx.Graphics.Gpu/GpuChannel.cs b/src/Ryujinx.Graphics.Gpu/GpuChannel.cs
index 33618a15b..047cbcca6 100644
--- a/src/Ryujinx.Graphics.Gpu/GpuChannel.cs
+++ b/src/Ryujinx.Graphics.Gpu/GpuChannel.cs
@@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Gpu
/// The new memory manager to be bound
public void BindMemory(MemoryManager memoryManager)
{
- var oldMemoryManager = Interlocked.Exchange(ref _memoryManager, memoryManager ?? throw new ArgumentNullException(nameof(memoryManager)));
+ MemoryManager oldMemoryManager = Interlocked.Exchange(ref _memoryManager, memoryManager ?? throw new ArgumentNullException(nameof(memoryManager)));
memoryManager.Physical.IncrementReferenceCount();
@@ -85,7 +85,7 @@ namespace Ryujinx.Graphics.Gpu
{
TextureManager.ReloadPools();
- var memoryManager = Volatile.Read(ref _memoryManager);
+ MemoryManager memoryManager = Volatile.Read(ref _memoryManager);
memoryManager?.Physical.BufferCache.QueuePrune();
}
@@ -138,7 +138,7 @@ namespace Ryujinx.Graphics.Gpu
_processor.Dispose();
TextureManager.Dispose();
- var oldMemoryManager = Interlocked.Exchange(ref _memoryManager, null);
+ MemoryManager oldMemoryManager = Interlocked.Exchange(ref _memoryManager, null);
if (oldMemoryManager != null)
{
oldMemoryManager.Physical.BufferCache.NotifyBuffersModified -= BufferManager.Rebind;
diff --git a/src/Ryujinx.Graphics.Gpu/GpuContext.cs b/src/Ryujinx.Graphics.Gpu/GpuContext.cs
index f7e8f1bf8..fa877cf8a 100644
--- a/src/Ryujinx.Graphics.Gpu/GpuContext.cs
+++ b/src/Ryujinx.Graphics.Gpu/GpuContext.cs
@@ -167,7 +167,7 @@ namespace Ryujinx.Graphics.Gpu
/// Thrown when is invalid
public MemoryManager CreateMemoryManager(ulong pid, ulong cpuMemorySize)
{
- if (!PhysicalMemoryRegistry.TryGetValue(pid, out var physicalMemory))
+ if (!PhysicalMemoryRegistry.TryGetValue(pid, out PhysicalMemory physicalMemory))
{
throw new ArgumentException("The PID is invalid or the process was not registered", nameof(pid));
}
@@ -183,7 +183,7 @@ namespace Ryujinx.Graphics.Gpu
/// Thrown when is invalid
public DeviceMemoryManager CreateDeviceMemoryManager(ulong pid)
{
- if (!PhysicalMemoryRegistry.TryGetValue(pid, out var physicalMemory))
+ if (!PhysicalMemoryRegistry.TryGetValue(pid, out PhysicalMemory physicalMemory))
{
throw new ArgumentException("The PID is invalid or the process was not registered", nameof(pid));
}
@@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Gpu
/// Thrown if was already registered
public void RegisterProcess(ulong pid, Cpu.IVirtualMemoryManagerTracked cpuMemory)
{
- var physicalMemory = new PhysicalMemory(this, cpuMemory);
+ PhysicalMemory physicalMemory = new PhysicalMemory(this, cpuMemory);
if (!PhysicalMemoryRegistry.TryAdd(pid, physicalMemory))
{
throw new ArgumentException("The PID was already registered", nameof(pid));
@@ -214,7 +214,7 @@ namespace Ryujinx.Graphics.Gpu
/// ID of the process
public void UnregisterProcess(ulong pid)
{
- if (PhysicalMemoryRegistry.TryRemove(pid, out var physicalMemory))
+ if (PhysicalMemoryRegistry.TryRemove(pid, out PhysicalMemory physicalMemory))
{
physicalMemory.ShaderCache.ShaderCacheStateChanged -= ShaderCacheStateUpdate;
physicalMemory.Dispose();
@@ -289,7 +289,7 @@ namespace Ryujinx.Graphics.Gpu
{
HostInitalized.WaitOne();
- foreach (var physicalMemory in PhysicalMemoryRegistry.Values)
+ foreach (PhysicalMemory physicalMemory in PhysicalMemoryRegistry.Values)
{
physicalMemory.ShaderCache.Initialize(cancellationToken);
}
@@ -329,7 +329,7 @@ namespace Ryujinx.Graphics.Gpu
///
public void ProcessShaderCacheQueue()
{
- foreach (var physicalMemory in PhysicalMemoryRegistry.Values)
+ foreach (PhysicalMemory physicalMemory in PhysicalMemoryRegistry.Values)
{
physicalMemory.ShaderCache.ProcessShaderCacheQueue();
}
@@ -404,12 +404,12 @@ namespace Ryujinx.Graphics.Gpu
if (force || _pendingSync || (syncpoint && SyncpointActions.Count > 0))
{
- foreach (var action in SyncActions)
+ foreach (ISyncActionHandler action in SyncActions)
{
action.SyncPreAction(syncpoint);
}
- foreach (var action in SyncpointActions)
+ foreach (ISyncActionHandler action in SyncpointActions)
{
action.SyncPreAction(syncpoint);
}
@@ -450,7 +450,7 @@ namespace Ryujinx.Graphics.Gpu
_gpuReadyEvent.Dispose();
// Has to be disposed before processing deferred actions, as it will produce some.
- foreach (var physicalMemory in PhysicalMemoryRegistry.Values)
+ foreach (PhysicalMemory physicalMemory in PhysicalMemoryRegistry.Values)
{
physicalMemory.Dispose();
}
diff --git a/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs b/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs
index 74967b190..b1a416e23 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs
@@ -80,7 +80,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// The amount of physical CPU Memory Avaiable on the device.
public void Initialize(GpuContext context, ulong cpuMemorySize)
{
- var cpuMemorySizeGiB = cpuMemorySize / GiB;
+ ulong cpuMemorySizeGiB = cpuMemorySize / GiB;
if (cpuMemorySizeGiB < 6 || context.Capabilities.MaximumGpuMemory == 0)
{
@@ -100,7 +100,7 @@ namespace Ryujinx.Graphics.Gpu.Image
MaxTextureSizeCapacity = TextureSizeCapacity12GiB;
}
- var cacheMemory = (ulong)(context.Capabilities.MaximumGpuMemory * MemoryScaleFactor);
+ ulong cacheMemory = (ulong)(context.Capabilities.MaximumGpuMemory * MemoryScaleFactor);
_maxCacheMemoryUsage = Math.Clamp(cacheMemory, MinTextureSizeCapacity, MaxTextureSizeCapacity);
@@ -232,7 +232,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// The texture if found, null otherwise
public Texture FindShortCache(in TextureDescriptor descriptor)
{
- if (_shortCacheLookup.Count > 0 && _shortCacheLookup.TryGetValue(descriptor, out var entry))
+ if (_shortCacheLookup.Count > 0 && _shortCacheLookup.TryGetValue(descriptor, out ShortTextureCacheEntry entry))
{
if (entry.InvalidatedSequence == entry.Texture.InvalidatedSequence)
{
@@ -277,7 +277,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Last used texture descriptor
public void AddShortCache(Texture texture, ref TextureDescriptor descriptor)
{
- var entry = new ShortTextureCacheEntry(descriptor, texture);
+ ShortTextureCacheEntry entry = new ShortTextureCacheEntry(descriptor, texture);
_shortCacheBuilder.Add(entry);
_shortCacheLookup.Add(entry.Descriptor, entry);
@@ -296,7 +296,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
if (texture.ShortCacheEntry != null)
{
- var entry = new ShortTextureCacheEntry(texture);
+ ShortTextureCacheEntry entry = new ShortTextureCacheEntry(texture);
_shortCacheBuilder.Add(entry);
@@ -314,7 +314,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
HashSet toRemove = _shortCache;
- foreach (var entry in toRemove)
+ foreach (ShortTextureCacheEntry entry in toRemove)
{
entry.Texture.DecrementReferenceCount();
diff --git a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs
index da9e5c3a9..45e1971a8 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/FormatTable.cs
@@ -704,7 +704,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// True if the format is valid, false otherwise
public static bool TryGetSingleComponentAttribFormat(uint encoded, out Format format, out int componentsCount)
{
- bool result = _singleComponentAttribFormats.TryGetValue((VertexAttributeFormat)encoded, out var tuple);
+ bool result = _singleComponentAttribFormats.TryGetValue((VertexAttributeFormat)encoded, out (Format, int) tuple);
format = tuple.Item1;
componentsCount = tuple.Item2;
diff --git a/src/Ryujinx.Graphics.Gpu/Image/Texture.cs b/src/Ryujinx.Graphics.Gpu/Image/Texture.cs
index 7ee2e5cf0..51ce195f4 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/Texture.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/Texture.cs
@@ -536,7 +536,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// All views must be recreated against the new storage.
- foreach (var view in _views)
+ foreach (Texture view in _views)
{
Logger.Debug?.Print(LogClass.Gpu, $" Recreating view {Info.Width}x{Info.Height} {Info.FormatInfo.Format}.");
view.ScaleFactor = scale;
@@ -553,7 +553,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
ScaleMode = newScaleMode;
- foreach (var view in _views)
+ foreach (Texture view in _views)
{
view.ScaleMode = newScaleMode;
}
@@ -899,7 +899,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
using (result)
{
- var converted = PixelConverter.ConvertR4G4ToR4G4B4A4(result.Span, width);
+ MemoryOwner converted = PixelConverter.ConvertR4G4ToR4G4B4A4(result.Span, width);
if (_context.Capabilities.SupportsR4G4B4A4Format)
{
@@ -1650,7 +1650,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
lock (_poolOwners)
{
- foreach (var owner in _poolOwners)
+ foreach (TexturePoolOwner owner in _poolOwners)
{
owner.Pool.ForceRemove(this, owner.ID, deferred);
}
@@ -1680,7 +1680,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
ulong address = 0;
- foreach (var owner in _poolOwners)
+ foreach (TexturePoolOwner owner in _poolOwners)
{
if (address == 0 || address == owner.GpuAddress)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
index ff7f11142..71de06e2c 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
@@ -128,7 +128,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// Any texture that has been unmapped at any point or is partially unmapped
// should update their pool references after the remap completes.
- foreach (var texture in _partiallyMappedTextures)
+ foreach (Texture texture in _partiallyMappedTextures)
{
texture.UpdatePoolMappings();
}
@@ -253,7 +253,7 @@ namespace Ryujinx.Graphics.Gpu.Image
for (int i = 0; i < overlapCount; i++)
{
- var other = _textureOverlaps[i];
+ Texture other = _textureOverlaps[i];
if (texture != other &&
(texture.IsViewCompatible(other.Info, other.Range, true, other.LayerSize, _context.Capabilities, out _, out _) != TextureViewCompatibility.Incompatible ||
@@ -486,7 +486,7 @@ namespace Ryujinx.Graphics.Gpu.Image
int layerSize = !isLinear ? colorState.LayerSize * 4 : 0;
- var flags = TextureSearchFlags.WithUpscale;
+ TextureSearchFlags flags = TextureSearchFlags.WithUpscale;
if (discard)
{
@@ -560,7 +560,7 @@ namespace Ryujinx.Graphics.Gpu.Image
target,
formatInfo);
- var flags = TextureSearchFlags.WithUpscale;
+ TextureSearchFlags flags = TextureSearchFlags.WithUpscale;
if (discard)
{
@@ -947,7 +947,7 @@ namespace Ryujinx.Graphics.Gpu.Image
bool hasLayerViews = false;
bool hasMipViews = false;
- var incompatibleOverlaps = new List();
+ List incompatibleOverlaps = new List();
for (int index = 0; index < overlapsCount; index++)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
index 2db5c6290..47a66747b 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
@@ -231,7 +231,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
bool flushed = false;
- foreach (var overlap in _incompatibleOverlaps)
+ foreach (TextureIncompatibleOverlap overlap in _incompatibleOverlaps)
{
flushed |= overlap.Group.Storage.FlushModified(true);
}
@@ -403,7 +403,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
if (_loadNeeded[baseHandle + i])
{
- var info = GetHandleInformation(baseHandle + i);
+ (int BaseLayer, int BaseLevel, int Levels, int Layers, int Index) info = GetHandleInformation(baseHandle + i);
// Ensure the data for this handle is loaded in the span.
if (spanEndIndex <= i - 1)
@@ -426,7 +426,7 @@ namespace Ryujinx.Graphics.Gpu.Image
}
}
- var endInfo = spanEndIndex == i ? info : GetHandleInformation(baseHandle + spanEndIndex);
+ (int BaseLayer, int BaseLevel, int Levels, int Layers, int Index) endInfo = spanEndIndex == i ? info : GetHandleInformation(baseHandle + spanEndIndex);
spanBase = _allOffsets[info.Index];
int spanLast = _allOffsets[endInfo.Index + endInfo.Layers * endInfo.Levels - 1];
@@ -479,7 +479,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// True if flushes should be tracked, false otherwise
private bool ShouldFlushTriggerTracking()
{
- foreach (var overlap in _incompatibleOverlaps)
+ foreach (TextureIncompatibleOverlap overlap in _incompatibleOverlaps)
{
if (overlap.Group._flushIncompatibleOverlaps)
{
@@ -637,7 +637,7 @@ namespace Ryujinx.Graphics.Gpu.Image
bool canImport = Storage.Info.IsLinear && Storage.Info.Stride >= Storage.Info.Width * Storage.Info.FormatInfo.BytesPerPixel;
- var hostPointer = canImport ? _physicalMemory.GetHostPointer(Storage.Range) : 0;
+ IntPtr hostPointer = canImport ? _physicalMemory.GetHostPointer(Storage.Range) : 0;
if (hostPointer != 0 && _context.Renderer.PrepareHostMapping(hostPointer, Storage.Size))
{
@@ -1019,7 +1019,7 @@ namespace Ryujinx.Graphics.Gpu.Image
int endOffset = _allOffsets[viewEnd] + _sliceSizes[lastLevel];
int size = endOffset - offset;
- var result = new List();
+ List result = new List();
for (int i = 0; i < TextureRange.Count; i++)
{
@@ -1053,7 +1053,7 @@ namespace Ryujinx.Graphics.Gpu.Image
offset = _allOffsets[viewStart];
ulong maxSize = Storage.Size - (ulong)offset;
- var groupHandle = new TextureGroupHandle(
+ TextureGroupHandle groupHandle = new TextureGroupHandle(
this,
offset,
Math.Min(maxSize, (ulong)size),
@@ -1160,17 +1160,17 @@ namespace Ryujinx.Graphics.Gpu.Image
/// The offset of the old handles in relation to the new ones
private void InheritHandles(TextureGroupHandle[] oldHandles, TextureGroupHandle[] handles, int relativeOffset)
{
- foreach (var group in handles)
+ foreach (TextureGroupHandle group in handles)
{
- foreach (var handle in group.Handles)
+ foreach (RegionHandle handle in group.Handles)
{
bool dirty = false;
- foreach (var oldGroup in oldHandles)
+ foreach (TextureGroupHandle oldGroup in oldHandles)
{
if (group.OverlapsWith(oldGroup.Offset + relativeOffset, oldGroup.Size))
{
- foreach (var oldHandle in oldGroup.Handles)
+ foreach (RegionHandle oldHandle in oldGroup.Handles)
{
if (handle.OverlapsWith(oldHandle.Address, oldHandle.Size))
{
@@ -1194,7 +1194,7 @@ namespace Ryujinx.Graphics.Gpu.Image
}
}
- foreach (var oldGroup in oldHandles)
+ foreach (TextureGroupHandle oldGroup in oldHandles)
{
oldGroup.Modified = false;
}
@@ -1254,7 +1254,7 @@ namespace Ryujinx.Graphics.Gpu.Image
continue;
}
- foreach (var oldGroup in _handles)
+ foreach (TextureGroupHandle oldGroup in _handles)
{
if (!groupHandle.OverlapsWith(oldGroup.Offset, oldGroup.Size))
{
@@ -1265,7 +1265,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
bool hasMatch = false;
- foreach (var oldHandle in oldGroup.Handles)
+ foreach (RegionHandle oldHandle in oldGroup.Handles)
{
if (oldHandle.RangeEquals(handle))
{
@@ -1292,9 +1292,9 @@ namespace Ryujinx.Graphics.Gpu.Image
InheritHandles(_handles, handles, 0);
- foreach (var oldGroup in _handles)
+ foreach (TextureGroupHandle oldGroup in _handles)
{
- foreach (var oldHandle in oldGroup.Handles)
+ foreach (RegionHandle oldHandle in oldGroup.Handles)
{
oldHandle.Dispose();
}
@@ -1320,12 +1320,12 @@ namespace Ryujinx.Graphics.Gpu.Image
else if (!(_hasMipViews || _hasLayerViews))
{
// Single dirty region.
- var cpuRegionHandles = new RegionHandle[TextureRange.Count];
+ RegionHandle[] cpuRegionHandles = new RegionHandle[TextureRange.Count];
int count = 0;
for (int i = 0; i < TextureRange.Count; i++)
{
- var currentRange = TextureRange.GetSubRange(i);
+ MemoryRange currentRange = TextureRange.GetSubRange(i);
if (currentRange.Address != MemoryManager.PteUnmapped)
{
cpuRegionHandles[count++] = GenerateHandle(currentRange.Address, currentRange.Size);
@@ -1337,7 +1337,7 @@ namespace Ryujinx.Graphics.Gpu.Image
Array.Resize(ref cpuRegionHandles, count);
}
- var groupHandle = new TextureGroupHandle(this, 0, Storage.Size, _views, 0, 0, 0, _allOffsets.Length, cpuRegionHandles);
+ TextureGroupHandle groupHandle = new TextureGroupHandle(this, 0, Storage.Size, _views, 0, 0, 0, _allOffsets.Length, cpuRegionHandles);
handles = new TextureGroupHandle[] { groupHandle };
}
@@ -1355,7 +1355,7 @@ namespace Ryujinx.Graphics.Gpu.Image
if (_is3D)
{
- var handlesList = new List();
+ List handlesList = new List();
for (int i = 0; i < levelHandles; i++)
{
@@ -1438,8 +1438,8 @@ namespace Ryujinx.Graphics.Gpu.Image
// Get the location of each texture within its storage, so we can find the handles to apply the dependency to.
// This can consist of multiple disjoint regions, for example if this is a mip slice of an array texture.
- var targetRange = new List<(int BaseHandle, int RegionCount)>();
- var otherRange = new List<(int BaseHandle, int RegionCount)>();
+ List<(int BaseHandle, int RegionCount)> targetRange = new List<(int BaseHandle, int RegionCount)>();
+ List<(int BaseHandle, int RegionCount)> otherRange = new List<(int BaseHandle, int RegionCount)>();
EvaluateRelevantHandles(firstLayer, firstLevel, other.Info.GetSlices(), other.Info.Levels, (baseHandle, regionCount, split) => targetRange.Add((baseHandle, regionCount)));
otherGroup.EvaluateRelevantHandles(other, (baseHandle, regionCount, split) => otherRange.Add((baseHandle, regionCount)));
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TexturePool.cs b/src/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
index 3bf122412..3effc39b1 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/TexturePool.cs
@@ -118,7 +118,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Texture with the requested format, or null if not found
public Texture Find(Format format)
{
- foreach (var alias in _aliases)
+ foreach (Alias alias in _aliases)
{
if (alias.Format == format)
{
@@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Gpu.Image
///
public void Destroy()
{
- foreach (var entry in _aliases)
+ foreach (Alias entry in _aliases)
{
entry.Texture.DecrementReferenceCount();
}
@@ -361,7 +361,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// If true, queue the dereference to happen on the render thread, otherwise dereference immediately
public void ForceRemove(Texture texture, int id, bool deferred)
{
- var previous = Interlocked.Exchange(ref Items[id], null);
+ Texture previous = Interlocked.Exchange(ref Items[id], null);
if (deferred)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs b/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
index e060e0b4f..6cc603b76 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
@@ -735,7 +735,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
_context.Renderer.BackgroundContextAction(() =>
{
- var ranges = _modifiedRanges;
+ BufferModifiedRangeList ranges = _modifiedRanges;
if (ranges != null)
{
@@ -850,7 +850,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
if (_virtualDependencies != null)
{
- foreach (var virtualBuffer in _virtualDependencies)
+ foreach (MultiRangeBuffer virtualBuffer in _virtualDependencies)
{
CopyToDependantVirtualBuffer(virtualBuffer, address, size);
}
@@ -875,7 +875,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
[MethodImpl(MethodImplOptions.NoInlining)]
private void CopyFromDependantVirtualBuffersImpl()
{
- foreach (var virtualBuffer in _virtualDependencies.OrderBy(x => x.ModificationSequenceNumber))
+ foreach (MultiRangeBuffer virtualBuffer in _virtualDependencies.OrderBy(x => x.ModificationSequenceNumber))
{
virtualBuffer.ConsumeModifiedRegion(this, (mAddress, mSize) =>
{
@@ -914,7 +914,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
byte[] storage = dataSpan.ToArray();
- foreach (var virtualBuffer in _virtualDependencies.OrderBy(x => x.ModificationSequenceNumber))
+ foreach (MultiRangeBuffer virtualBuffer in _virtualDependencies.OrderBy(x => x.ModificationSequenceNumber))
{
virtualBuffer.ConsumeModifiedRegion(address, size, (mAddress, mSize) =>
{
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/BufferBackingState.cs b/src/Ryujinx.Graphics.Gpu/Memory/BufferBackingState.cs
index 3f65131e6..56bc9143f 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/BufferBackingState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/BufferBackingState.cs
@@ -81,7 +81,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
// Storage buffer bindings may require special treatment.
- var rawStage = stage & BufferStage.StageMask;
+ BufferStage rawStage = stage & BufferStage.StageMask;
if (rawStage == BufferStage.Fragment)
{
@@ -225,7 +225,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
// Storage write.
_writeCount++;
- var rawStage = stage & BufferStage.StageMask;
+ BufferStage rawStage = stage & BufferStage.StageMask;
if (rawStage == BufferStage.Fragment)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs b/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs
index 66d2cdb62..2368da90f 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/BufferCache.cs
@@ -412,7 +412,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
dstOffset += subRange.Size;
}
- foreach (var buffer in physicalBuffers)
+ foreach (Buffer buffer in physicalBuffers)
{
buffer.CopyToDependantVirtualBuffer(virtualBuffer);
}
@@ -1037,7 +1037,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// List used to track entries to delete
private static void Prune(Dictionary dictionary, ref List toDelete)
{
- foreach (var entry in dictionary)
+ foreach (KeyValuePair entry in dictionary)
{
if (entry.Value.UnmappedSequence != entry.Value.Buffer.UnmappedSequence)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs b/src/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs
index 409867e09..a07e3445b 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/BufferManager.cs
@@ -478,7 +478,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
///
public void CommitComputeBindings()
{
- var bufferCache = _channel.MemoryManager.Physical.BufferCache;
+ BufferCache bufferCache = _channel.MemoryManager.Physical.BufferCache;
BindBuffers(bufferCache, _cpStorageBuffers, isStorage: true);
BindBuffers(bufferCache, _cpUniformBuffers, isStorage: false);
@@ -499,10 +499,10 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
if (_bufferTextures.Count > 0)
{
- foreach (var binding in _bufferTextures)
+ foreach (BufferTextureBinding binding in _bufferTextures)
{
- var isStore = binding.BindingInfo.Flags.HasFlag(TextureUsageFlags.ImageStore);
- var range = bufferCache.GetBufferRange(binding.Range, BufferStageUtils.TextureBuffer(binding.Stage, binding.BindingInfo.Flags), isStore);
+ bool isStore = binding.BindingInfo.Flags.HasFlag(TextureUsageFlags.ImageStore);
+ BufferRange range = bufferCache.GetBufferRange(binding.Range, BufferStageUtils.TextureBuffer(binding.Stage, binding.BindingInfo.Flags), isStore);
binding.Texture.SetStorage(range);
// The texture must be rebound to use the new storage if it was updated.
@@ -524,19 +524,19 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
ITexture[] textureArray = new ITexture[1];
- foreach (var binding in _bufferTextureArrays)
+ foreach (BufferTextureArrayBinding binding in _bufferTextureArrays)
{
- var range = bufferCache.GetBufferRange(binding.Range, BufferStage.None);
+ BufferRange range = bufferCache.GetBufferRange(binding.Range, BufferStage.None);
binding.Texture.SetStorage(range);
textureArray[0] = binding.Texture;
binding.Array.SetTextures(binding.Index, textureArray);
}
- foreach (var binding in _bufferImageArrays)
+ foreach (BufferTextureArrayBinding binding in _bufferImageArrays)
{
- var isStore = binding.BindingInfo.Flags.HasFlag(TextureUsageFlags.ImageStore);
- var range = bufferCache.GetBufferRange(binding.Range, BufferStage.None, isStore);
+ bool isStore = binding.BindingInfo.Flags.HasFlag(TextureUsageFlags.ImageStore);
+ BufferRange range = bufferCache.GetBufferRange(binding.Range, BufferStage.None, isStore);
binding.Texture.SetStorage(range);
textureArray[0] = binding.Texture;
@@ -555,7 +555,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// True if the index buffer is in use
public void CommitGraphicsBindings(bool indexed)
{
- var bufferCache = _channel.MemoryManager.Physical.BufferCache;
+ BufferCache bufferCache = _channel.MemoryManager.Physical.BufferCache;
if (indexed)
{
@@ -750,19 +750,19 @@ namespace Ryujinx.Graphics.Gpu.Memory
for (ShaderStage stage = ShaderStage.Vertex; stage <= ShaderStage.Fragment; stage++)
{
- ref var buffers = ref bindings[(int)stage - 1];
+ ref BuffersPerStage buffers = ref bindings[(int)stage - 1];
BufferStage bufferStage = BufferStageUtils.FromShaderStage(stage);
for (int index = 0; index < buffers.Count; index++)
{
- ref var bindingInfo = ref buffers.Bindings[index];
+ ref BufferDescriptor bindingInfo = ref buffers.Bindings[index];
BufferBounds bounds = buffers.Buffers[bindingInfo.Slot];
if (!bounds.IsUnmapped)
{
- var isWrite = bounds.Flags.HasFlag(BufferUsageFlags.Write);
- var range = isStorage
+ bool isWrite = bounds.Flags.HasFlag(BufferUsageFlags.Write);
+ BufferRange range = isStorage
? bufferCache.GetBufferRangeAligned(bounds.Range, bufferStage | BufferStageUtils.FromUsage(bounds.Flags), isWrite)
: bufferCache.GetBufferRange(bounds.Range, bufferStage);
@@ -792,14 +792,14 @@ namespace Ryujinx.Graphics.Gpu.Memory
for (int index = 0; index < buffers.Count; index++)
{
- ref var bindingInfo = ref buffers.Bindings[index];
+ ref BufferDescriptor bindingInfo = ref buffers.Bindings[index];
BufferBounds bounds = buffers.Buffers[bindingInfo.Slot];
if (!bounds.IsUnmapped)
{
- var isWrite = bounds.Flags.HasFlag(BufferUsageFlags.Write);
- var range = isStorage
+ bool isWrite = bounds.Flags.HasFlag(BufferUsageFlags.Write);
+ BufferRange range = isStorage
? bufferCache.GetBufferRangeAligned(bounds.Range, BufferStageUtils.ComputeStorage(bounds.Flags), isWrite)
: bufferCache.GetBufferRange(bounds.Range, BufferStage.Compute);
@@ -841,11 +841,11 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
for (ShaderStage stage = ShaderStage.Vertex; stage <= ShaderStage.Fragment; stage++)
{
- ref var buffers = ref bindings[(int)stage - 1];
+ ref BuffersPerStage buffers = ref bindings[(int)stage - 1];
for (int index = 0; index < buffers.Count; index++)
{
- ref var binding = ref buffers.Bindings[index];
+ ref BufferDescriptor binding = ref buffers.Bindings[index];
BufferBounds bounds = buffers.Buffers[binding.Slot];
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs b/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs
index c5a12c1fc..105082f31 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/BufferModifiedRangeList.cs
@@ -117,7 +117,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
lock (_lock)
{
// Slices a given region using the modified regions in the list. Calls the action for the new slices.
- ref var overlaps = ref ThreadStaticArray.Get();
+ ref BufferModifiedRange[] overlaps = ref ThreadStaticArray.Get();
int count = FindOverlapsNonOverlapping(address, size, ref overlaps);
@@ -156,7 +156,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
lock (_lock)
{
// We may overlap with some existing modified regions. They must be cut into by the new entry.
- ref var overlaps = ref ThreadStaticArray.Get();
+ ref BufferModifiedRange[] overlaps = ref ThreadStaticArray.Get();
int count = FindOverlapsNonOverlapping(address, size, ref overlaps);
@@ -210,7 +210,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
int count = 0;
- ref var overlaps = ref ThreadStaticArray.Get();
+ ref BufferModifiedRange[] overlaps = ref ThreadStaticArray.Get();
// Range list must be consistent for this operation.
lock (_lock)
@@ -239,7 +239,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
int count = 0;
- ref var overlaps = ref ThreadStaticArray.Get();
+ ref BufferModifiedRange[] overlaps = ref ThreadStaticArray.Get();
// Range list must be consistent for this operation.
lock (_lock)
@@ -355,7 +355,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
int rangeCount = 0;
- ref var overlaps = ref ThreadStaticArray.Get();
+ ref BufferModifiedRange[] overlaps = ref ThreadStaticArray.Get();
// Range list must be consistent for this operation
lock (_lock)
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/BufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Memory/BufferUpdater.cs
index 02090c04f..a5ee3ab70 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/BufferUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/BufferUpdater.cs
@@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
if (binding >= 0)
{
- var range = new BufferRange(_handle, 0, data.Length);
+ BufferRange range = new BufferRange(_handle, 0, data.Length);
_renderer.Pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, range) });
}
};
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs b/src/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs
index bdb7cf2c2..77eb7c4a4 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/GpuRegionHandle.cs
@@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
get
{
- foreach (var regionHandle in _cpuRegionHandles)
+ foreach (RegionHandle regionHandle in _cpuRegionHandles)
{
if (regionHandle.Dirty)
{
@@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
///
public void Dispose()
{
- foreach (var regionHandle in _cpuRegionHandles)
+ foreach (RegionHandle regionHandle in _cpuRegionHandles)
{
regionHandle.Dispose();
}
@@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// Action to call on read or write
public void RegisterAction(RegionSignal action)
{
- foreach (var regionHandle in _cpuRegionHandles)
+ foreach (RegionHandle regionHandle in _cpuRegionHandles)
{
regionHandle.RegisterAction(action);
}
@@ -70,7 +70,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// Action to call on read or write
public void RegisterPreciseAction(PreciseRegionSignal action)
{
- foreach (var regionHandle in _cpuRegionHandles)
+ foreach (RegionHandle regionHandle in _cpuRegionHandles)
{
regionHandle.RegisterPreciseAction(action);
}
@@ -81,7 +81,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
///
public void Reprotect(bool asDirty = false)
{
- foreach (var regionHandle in _cpuRegionHandles)
+ foreach (RegionHandle regionHandle in _cpuRegionHandles)
{
regionHandle.Reprotect(asDirty);
}
@@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
///
public void ForceDirty()
{
- foreach (var regionHandle in _cpuRegionHandles)
+ foreach (RegionHandle regionHandle in _cpuRegionHandles)
{
regionHandle.ForceDirty();
}
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs b/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs
index 59e618c02..5ee5ce456 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/MemoryManager.cs
@@ -458,7 +458,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
int pages = (int)((endVaRounded - va) / PageSize);
- var regions = new List();
+ List regions = new List();
for (int page = 0; page < pages - 1; page++)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/MultiRangeBuffer.cs b/src/Ryujinx.Graphics.Gpu/Memory/MultiRangeBuffer.cs
index d92b0836e..19ef56bb1 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/MultiRangeBuffer.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/MultiRangeBuffer.cs
@@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
if (_dependencies != null)
{
- foreach (var dependency in _dependencies)
+ foreach (PhysicalDependency dependency in _dependencies)
{
if (dependency.PhysicalBuffer == buffer && dependency.VirtualOffset >= minimumVirtOffset)
{
@@ -231,7 +231,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
if (_dependencies != null)
{
- foreach (var dependency in _dependencies)
+ foreach (PhysicalDependency dependency in _dependencies)
{
dependency.PhysicalBuffer.RemoveVirtualDependency(this);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs b/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs
index b22cc01b8..d9dd7f1d9 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/PhysicalMemory.cs
@@ -102,10 +102,10 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
if (range.Count == 1)
{
- var singleRange = range.GetSubRange(0);
+ MemoryRange singleRange = range.GetSubRange(0);
if (singleRange.Address != MemoryManager.PteUnmapped)
{
- var regions = _cpuMemory.GetHostRegions(singleRange.Address, singleRange.Size);
+ IEnumerable regions = _cpuMemory.GetHostRegions(singleRange.Address, singleRange.Size);
if (regions != null && regions.Count() == 1)
{
@@ -139,7 +139,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
if (range.Count == 1)
{
- var singleRange = range.GetSubRange(0);
+ MemoryRange singleRange = range.GetSubRange(0);
if (singleRange.Address != MemoryManager.PteUnmapped)
{
return _cpuMemory.GetSpan(singleRange.Address, (int)singleRange.Size, tracked);
@@ -152,7 +152,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
for (int i = 0; i < range.Count; i++)
{
- var currentRange = range.GetSubRange(i);
+ MemoryRange currentRange = range.GetSubRange(i);
int size = (int)currentRange.Size;
if (currentRange.Address != MemoryManager.PteUnmapped)
{
@@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
int offset = 0;
for (int i = 0; i < range.Count; i++)
{
- var currentRange = range.GetSubRange(i);
+ MemoryRange currentRange = range.GetSubRange(i);
int size = (int)currentRange.Size;
if (currentRange.Address != MemoryManager.PteUnmapped)
{
@@ -322,7 +322,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{
if (range.Count == 1)
{
- var singleRange = range.GetSubRange(0);
+ MemoryRange singleRange = range.GetSubRange(0);
if (singleRange.Address != MemoryManager.PteUnmapped)
{
writeCallback(singleRange.Address, data);
@@ -334,7 +334,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
for (int i = 0; i < range.Count; i++)
{
- var currentRange = range.GetSubRange(i);
+ MemoryRange currentRange = range.GetSubRange(i);
int size = (int)currentRange.Size;
if (currentRange.Address != MemoryManager.PteUnmapped)
{
@@ -382,12 +382,12 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// The memory tracking handle
public GpuRegionHandle BeginTracking(MultiRange range, ResourceKind kind)
{
- var cpuRegionHandles = new RegionHandle[range.Count];
+ RegionHandle[] cpuRegionHandles = new RegionHandle[range.Count];
int count = 0;
for (int i = 0; i < range.Count; i++)
{
- var currentRange = range.GetSubRange(i);
+ MemoryRange currentRange = range.GetSubRange(i);
if (currentRange.Address != MemoryManager.PteUnmapped)
{
cpuRegionHandles[count++] = _cpuMemory.BeginTracking(currentRange.Address, currentRange.Size, (int)kind);
diff --git a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
index fc444f49c..20831fa99 100644
--- a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
+++ b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
@@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// Renderer that the support buffer will be used with
public SupportBufferUpdater(IRenderer renderer) : base(renderer)
{
- var defaultScale = new Vector4 { X = 1f, Y = 0f, Z = 0f, W = 0f };
+ Vector4 defaultScale = new Vector4 { X = 1f, Y = 0f, Z = 0f, W = 0f };
_data.RenderScale.AsSpan().Fill(defaultScale);
DirtyRenderScale(0, SupportBuffer.RenderScaleMaxCount);
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/CachedShaderBindings.cs b/src/Ryujinx.Graphics.Gpu/Shader/CachedShaderBindings.cs
index 018c5fdc0..a4bcbc6f5 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/CachedShaderBindings.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/CachedShaderBindings.cs
@@ -60,7 +60,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
Target target = descriptor.Type != SamplerType.None ? ShaderTexture.GetTarget(descriptor.Type) : default;
- var result = new TextureBindingInfo(
+ TextureBindingInfo result = new TextureBindingInfo(
target,
descriptor.Set,
descriptor.Binding,
@@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
Target target = ShaderTexture.GetTarget(descriptor.Type);
FormatInfo formatInfo = ShaderTexture.GetFormatInfo(descriptor.Format);
- var result = new TextureBindingInfo(
+ TextureBindingInfo result = new TextureBindingInfo(
target,
formatInfo,
descriptor.Set,
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ComputeShaderCacheHashTable.cs b/src/Ryujinx.Graphics.Gpu/Shader/ComputeShaderCacheHashTable.cs
index 0119a6a33..49516b310 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/ComputeShaderCacheHashTable.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/ComputeShaderCacheHashTable.cs
@@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// Program to be added
public void Add(CachedShaderProgram program)
{
- var specList = _cache.GetOrAdd(program.Shaders[0].Code, new ShaderSpecializationList());
+ ShaderSpecializationList specList = _cache.GetOrAdd(program.Shaders[0].Code, new ShaderSpecializationList());
specList.Add(program);
_shaderPrograms.Add(program);
}
@@ -51,7 +51,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
program = null;
ShaderCodeAccessor codeAccessor = new(channel.MemoryManager, gpuVa);
- bool hasSpecList = _cache.TryFindItem(codeAccessor, out var specList, out cachedGuestCode);
+ bool hasSpecList = _cache.TryFindItem(codeAccessor, out ShaderSpecializationList specList, out cachedGuestCode);
return hasSpecList && specList.TryFindForCompute(channel, poolState, computeState, out program);
}
@@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// Programs added to the table
public IEnumerable GetPrograms()
{
- foreach (var program in _shaderPrograms)
+ foreach (CachedShaderProgram program in _shaderPrograms)
{
yield return program;
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGuestStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGuestStorage.cs
index 22af88d31..237ae18ec 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGuestStorage.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheGuestStorage.cs
@@ -180,8 +180,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
///
public void ClearCache()
{
- using var tocFileStream = DiskCacheCommon.OpenFile(_basePath, TocFileName, writable: true);
- using var dataFileStream = DiskCacheCommon.OpenFile(_basePath, DataFileName, writable: true);
+ using FileStream tocFileStream = DiskCacheCommon.OpenFile(_basePath, TocFileName, writable: true);
+ using FileStream dataFileStream = DiskCacheCommon.OpenFile(_basePath, DataFileName, writable: true);
tocFileStream.SetLength(0);
dataFileStream.SetLength(0);
@@ -258,8 +258,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// Index of the shader on the cache
public int AddShader(ReadOnlySpan data, ReadOnlySpan cb1Data)
{
- using var tocFileStream = DiskCacheCommon.OpenFile(_basePath, TocFileName, writable: true);
- using var dataFileStream = DiskCacheCommon.OpenFile(_basePath, DataFileName, writable: true);
+ using FileStream tocFileStream = DiskCacheCommon.OpenFile(_basePath, TocFileName, writable: true);
+ using FileStream dataFileStream = DiskCacheCommon.OpenFile(_basePath, DataFileName, writable: true);
TocHeader header = new();
@@ -267,9 +267,9 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
uint hash = CalcHash(data, cb1Data);
- if (_toc.TryGetValue(hash, out var list))
+ if (_toc.TryGetValue(hash, out List list))
{
- foreach (var entry in list)
+ foreach (TocMemoryEntry entry in list)
{
if (data.Length != entry.CodeSize || cb1Data.Length != entry.Cb1DataSize)
{
@@ -427,7 +427,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// Index of the data on the cache
private void AddTocMemoryEntry(uint dataOffset, uint codeSize, uint cb1DataSize, uint hash, int index)
{
- if (!_toc.TryGetValue(hash, out var list))
+ if (!_toc.TryGetValue(hash, out List list))
{
_toc.Add(hash, list = new List());
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
index b6b811389..4ef0caced 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/DiskCacheHostStorage.cs
@@ -301,11 +301,11 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
try
{
- using var tocFileStream = DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: false);
- using var dataFileStream = DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: false);
+ using FileStream tocFileStream = DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: false);
+ using FileStream dataFileStream = DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: false);
- using var guestTocFileStream = _guestStorage.OpenTocFileStream();
- using var guestDataFileStream = _guestStorage.OpenDataFileStream();
+ using Stream guestTocFileStream = _guestStorage.OpenTocFileStream();
+ using Stream guestDataFileStream = _guestStorage.OpenDataFileStream();
BinarySerializer tocReader = new(tocFileStream);
BinarySerializer dataReader = new(dataFileStream);
@@ -547,11 +547,11 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// A collection of disk cache output streams
public DiskCacheOutputStreams GetOutputStreams(GpuContext context)
{
- var tocFileStream = DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: true);
- var dataFileStream = DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: true);
+ FileStream tocFileStream = DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: true);
+ FileStream dataFileStream = DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: true);
- var hostTocFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostTocFileName(context), writable: true);
- var hostDataFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostDataFileName(context), writable: true);
+ FileStream hostTocFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostTocFileName(context), writable: true);
+ FileStream hostDataFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostDataFileName(context), writable: true);
return new DiskCacheOutputStreams(tocFileStream, dataFileStream, hostTocFileStream, hostDataFileStream);
}
@@ -569,7 +569,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
for (int index = 0; index < program.Shaders.Length; index++)
{
- var shader = program.Shaders[index];
+ CachedShaderStage shader = program.Shaders[index];
if (shader == null || (shader.Info != null && shader.Info.Stage == ShaderStage.Compute))
{
continue;
@@ -578,8 +578,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
stagesBitMask |= 1u << index;
}
- var tocFileStream = streams != null ? streams.TocFileStream : DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: true);
- var dataFileStream = streams != null ? streams.DataFileStream : DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: true);
+ FileStream tocFileStream = streams != null ? streams.TocFileStream : DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: true);
+ FileStream dataFileStream = streams != null ? streams.DataFileStream : DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: true);
ulong timestamp = (ulong)DateTime.UtcNow.Subtract(DateTime.UnixEpoch).TotalSeconds;
@@ -610,7 +610,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
for (int index = 0; index < program.Shaders.Length; index++)
{
- var shader = program.Shaders[index];
+ CachedShaderStage shader = program.Shaders[index];
if (shader == null)
{
continue;
@@ -655,8 +655,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// GPU context
public void ClearSharedCache()
{
- using var tocFileStream = DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: true);
- using var dataFileStream = DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: true);
+ using FileStream tocFileStream = DiskCacheCommon.OpenFile(_basePath, SharedTocFileName, writable: true);
+ using FileStream dataFileStream = DiskCacheCommon.OpenFile(_basePath, SharedDataFileName, writable: true);
tocFileStream.SetLength(0);
dataFileStream.SetLength(0);
@@ -668,8 +668,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// GPU context
public void ClearHostCache(GpuContext context)
{
- using var tocFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostTocFileName(context), writable: true);
- using var dataFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostDataFileName(context), writable: true);
+ using FileStream tocFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostTocFileName(context), writable: true);
+ using FileStream dataFileStream = DiskCacheCommon.OpenFile(_basePath, GetHostDataFileName(context), writable: true);
tocFileStream.SetLength(0);
dataFileStream.SetLength(0);
@@ -690,8 +690,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
DiskCacheOutputStreams streams,
ulong timestamp)
{
- var tocFileStream = streams != null ? streams.HostTocFileStream : DiskCacheCommon.OpenFile(_basePath, GetHostTocFileName(context), writable: true);
- var dataFileStream = streams != null ? streams.HostDataFileStream : DiskCacheCommon.OpenFile(_basePath, GetHostDataFileName(context), writable: true);
+ FileStream tocFileStream = streams != null ? streams.HostTocFileStream : DiskCacheCommon.OpenFile(_basePath, GetHostTocFileName(context), writable: true);
+ FileStream dataFileStream = streams != null ? streams.HostDataFileStream : DiskCacheCommon.OpenFile(_basePath, GetHostDataFileName(context), writable: true);
if (tocFileStream.Length == 0)
{
@@ -853,25 +853,25 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
for (int index = 0; index < info.CBuffers.Count; index++)
{
- var entry = info.CBuffers[index];
+ BufferDescriptor entry = info.CBuffers[index];
dataWriter.WriteWithMagicAndSize(ref entry, BufdMagic);
}
for (int index = 0; index < info.SBuffers.Count; index++)
{
- var entry = info.SBuffers[index];
+ BufferDescriptor entry = info.SBuffers[index];
dataWriter.WriteWithMagicAndSize(ref entry, BufdMagic);
}
for (int index = 0; index < info.Textures.Count; index++)
{
- var entry = info.Textures[index];
+ TextureDescriptor entry = info.Textures[index];
dataWriter.WriteWithMagicAndSize(ref entry, TexdMagic);
}
for (int index = 0; index < info.Images.Count; index++)
{
- var entry = info.Images[index];
+ TextureDescriptor entry = info.Images[index];
dataWriter.WriteWithMagicAndSize(ref entry, TexdMagic);
}
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs
index eb0f72af1..9424a1084 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/DiskCache/ParallelDiskCacheLoader.cs
@@ -303,10 +303,10 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
Logger.Info?.Print(LogClass.Gpu, $"Rebuilding {_programList.Count} shaders...");
- using var streams = _hostStorage.GetOutputStreams(_context);
+ using DiskCacheOutputStreams streams = _hostStorage.GetOutputStreams(_context);
int packagedShaders = 0;
- foreach (var kv in _programList)
+ foreach (KeyValuePair kv in _programList)
{
if (!Active)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
index 4e9134291..c7d86a47e 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/GpuAccessor.cs
@@ -4,6 +4,7 @@ using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Shader.Translation;
using System;
using System.Runtime.InteropServices;
+using TextureDescriptor = Ryujinx.Graphics.Gpu.Image.TextureDescriptor;
namespace Ryujinx.Graphics.Gpu.Shader
{
@@ -177,7 +178,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
public TextureFormat QueryTextureFormat(int handle, int cbufSlot)
{
_state.SpecializationState?.RecordTextureFormat(_stageIndex, handle, cbufSlot);
- var descriptor = GetTextureDescriptor(handle, cbufSlot);
+ TextureDescriptor descriptor = GetTextureDescriptor(handle, cbufSlot);
return ConvertToTextureFormat(descriptor.UnpackFormat(), descriptor.UnpackSrgb());
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs
index b50ea174d..3ff92896b 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs
@@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
GpuChannelComputeState computeState,
ulong gpuVa)
{
- if (_cpPrograms.TryGetValue(gpuVa, out var cpShader) && IsShaderEqual(channel, poolState, computeState, cpShader, gpuVa))
+ if (_cpPrograms.TryGetValue(gpuVa, out CachedShaderProgram cpShader) && IsShaderEqual(channel, poolState, computeState, cpShader, gpuVa))
{
return cpShader;
}
@@ -255,8 +255,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
channel.TextureManager.UpdateRenderTargets();
- var rtControl = state.RtControl;
- var msaaMode = state.RtMsaaMode;
+ RtControl rtControl = state.RtControl;
+ TextureMsaaMode msaaMode = state.RtMsaaMode;
pipeline.SamplesCount = msaaMode.SamplesInX() * msaaMode.SamplesInY();
@@ -266,7 +266,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
int rtIndex = rtControl.UnpackPermutationIndex(index);
- var colorState = state.RtColorState[rtIndex];
+ RtColorState colorState = state.RtColorState[rtIndex];
if (index >= count || colorState.Format == 0 || colorState.WidthOrStride == 0)
{
@@ -311,12 +311,12 @@ namespace Ryujinx.Graphics.Gpu.Shader
ref GpuChannelGraphicsState graphicsState,
ShaderAddresses addresses)
{
- if (_gpPrograms.TryGetValue(addresses, out var gpShaders) && IsShaderEqual(channel, ref poolState, ref graphicsState, gpShaders, addresses))
+ if (_gpPrograms.TryGetValue(addresses, out CachedShaderProgram gpShaders) && IsShaderEqual(channel, ref poolState, ref graphicsState, gpShaders, addresses))
{
return gpShaders;
}
- if (_graphicsShaderCache.TryFind(channel, ref poolState, ref graphicsState, addresses, out gpShaders, out var cachedGuestCode))
+ if (_graphicsShaderCache.TryFind(channel, ref poolState, ref graphicsState, addresses, out gpShaders, out CachedGraphicsGuestCode cachedGuestCode))
{
_gpPrograms[addresses] = gpShaders;
return gpShaders;
@@ -587,7 +587,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
for (int i = 0; i < Constants.TotalTransformFeedbackBuffers; i++)
{
- var tf = state.TfState[i];
+ TfState tf = state.TfState[i];
descs[i] = new TransformFeedbackDescriptor(
tf.BufferIndex,
@@ -693,7 +693,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// The generated translator context
public static TranslatorContext DecodeComputeShader(IGpuAccessor gpuAccessor, TargetApi api, ulong gpuVa)
{
- var options = CreateTranslationOptions(api, DefaultFlags | TranslationFlags.Compute);
+ TranslationOptions options = CreateTranslationOptions(api, DefaultFlags | TranslationFlags.Compute);
return Translator.CreateContext(gpuVa, gpuAccessor, options);
}
@@ -710,7 +710,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// The generated translator context
public static TranslatorContext DecodeGraphicsShader(IGpuAccessor gpuAccessor, TargetApi api, TranslationFlags flags, ulong gpuVa)
{
- var options = CreateTranslationOptions(api, flags);
+ TranslationOptions options = CreateTranslationOptions(api, flags);
return Translator.CreateContext(gpuVa, gpuAccessor, options);
}
@@ -736,7 +736,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
ulong cb1DataAddress = channel.BufferManager.GetGraphicsUniformBufferAddress(0, 1);
- var memoryManager = channel.MemoryManager;
+ MemoryManager memoryManager = channel.MemoryManager;
codeA ??= memoryManager.GetSpan(vertexA.Address, vertexA.Size).ToArray();
codeB ??= memoryManager.GetSpan(currentStage.Address, currentStage.Size).ToArray();
@@ -774,7 +774,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// Compiled graphics shader code
private static TranslatedShader TranslateShader(ShaderDumper dumper, GpuChannel channel, TranslatorContext context, byte[] code, bool asCompute)
{
- var memoryManager = channel.MemoryManager;
+ MemoryManager memoryManager = channel.MemoryManager;
ulong cb1DataAddress = context.Stage == ShaderStage.Compute
? channel.BufferManager.GetComputeUniformBufferAddress(1)
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCacheHashTable.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCacheHashTable.cs
index e65a1dec9..562837791 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCacheHashTable.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCacheHashTable.cs
@@ -156,7 +156,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
IdTable idTable = new();
- foreach (var shader in program.Shaders)
+ foreach (CachedShaderStage shader in program.Shaders)
{
if (shader == null)
{
@@ -221,7 +221,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
out CachedShaderProgram program,
out CachedGraphicsGuestCode guestCode)
{
- var memoryManager = channel.MemoryManager;
+ MemoryManager memoryManager = channel.MemoryManager;
IdTable idTable = new();
guestCode = new CachedGraphicsGuestCode();
@@ -270,9 +270,9 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// Programs added to the table
public IEnumerable GetPrograms()
{
- foreach (var specList in _shaderPrograms.Values)
+ foreach (ShaderSpecializationList specList in _shaderPrograms.Values)
{
- foreach (var program in specList)
+ foreach (CachedShaderProgram program in specList)
{
yield return program;
}
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs
index e283d0832..50061db60 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderInfoBuilder.cs
@@ -372,8 +372,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
{
int totalSets = _resourceDescriptors.Length;
- var descriptors = new ResourceDescriptorCollection[totalSets];
- var usages = new ResourceUsageCollection[totalSets];
+ ResourceDescriptorCollection[] descriptors = new ResourceDescriptorCollection[totalSets];
+ ResourceUsageCollection[] usages = new ResourceUsageCollection[totalSets];
for (int index = 0; index < totalSets; index++)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationList.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationList.cs
index 3c2f0b9be..25ed6e7ef 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationList.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationList.cs
@@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
ref GpuChannelGraphicsState graphicsState,
out CachedShaderProgram program)
{
- foreach (var entry in _entries)
+ foreach (CachedShaderProgram entry in _entries)
{
bool vertexAsCompute = entry.VertexAsCompute != null;
bool usesDrawParameters = entry.Shaders[1]?.Info.UsesDrawParameters ?? false;
@@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// True if a compatible program is found, false otherwise
public bool TryFindForCompute(GpuChannel channel, GpuChannelPoolState poolState, GpuChannelComputeState computeState, out CachedShaderProgram program)
{
- foreach (var entry in _entries)
+ foreach (CachedShaderProgram entry in _entries)
{
if (entry.SpecializationState.MatchesCompute(channel, ref poolState, computeState, true))
{
diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
index 1230c0580..4bb4392e1 100644
--- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
+++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderSpecializationState.cs
@@ -6,10 +6,12 @@ using Ryujinx.Graphics.Gpu.Shader.DiskCache;
using Ryujinx.Graphics.Shader;
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using TextureDescriptor = Ryujinx.Graphics.Shader.TextureDescriptor;
namespace Ryujinx.Graphics.Gpu.Shader
{
@@ -214,23 +216,23 @@ namespace Ryujinx.Graphics.Gpu.Shader
CachedShaderStage stage = stages[i];
if (stage?.Info != null)
{
- var textures = stage.Info.Textures;
- var images = stage.Info.Images;
+ ReadOnlyCollection textures = stage.Info.Textures;
+ ReadOnlyCollection images = stage.Info.Images;
- var texBindings = new Box[textures.Count];
- var imageBindings = new Box[images.Count];
+ Box[] texBindings = new Box[textures.Count];
+ Box[] imageBindings = new Box[images.Count];
int stageIndex = Math.Max(i - 1, 0); // Don't count VertexA for looking up spec state. No-Op for compute.
for (int j = 0; j < textures.Count; j++)
{
- var texture = textures[j];
+ TextureDescriptor texture = textures[j];
texBindings[j] = GetTextureSpecState(stageIndex, texture.HandleIndex, texture.CbufSlot);
}
for (int j = 0; j < images.Count; j++)
{
- var image = images[j];
+ TextureDescriptor image = images[j];
imageBindings[j] = GetTextureSpecState(stageIndex, image.HandleIndex, image.CbufSlot);
}
@@ -753,7 +755,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
ReadOnlySpan cachedTextureBuffer = Span.Empty;
ReadOnlySpan cachedSamplerBuffer = Span.Empty;
- foreach (var kv in _allTextures)
+ foreach (KeyValuePair> kv in _allTextures)
{
TextureKey textureKey = kv.Key;
@@ -1009,10 +1011,10 @@ namespace Ryujinx.Graphics.Gpu.Shader
ushort count = (ushort)_textureSpecialization.Count;
dataWriter.Write(ref count);
- foreach (var kv in _textureSpecialization)
+ foreach (KeyValuePair> kv in _textureSpecialization)
{
- var textureKey = kv.Key;
- var textureState = kv.Value;
+ TextureKey textureKey = kv.Key;
+ Box textureState = kv.Value;
dataWriter.WriteWithMagicAndSize(ref textureKey, TexkMagic);
dataWriter.WriteWithMagicAndSize(ref textureState.Value, TexsMagic);
@@ -1023,10 +1025,10 @@ namespace Ryujinx.Graphics.Gpu.Shader
count = (ushort)_textureArrayFromBufferSpecialization.Count;
dataWriter.Write(ref count);
- foreach (var kv in _textureArrayFromBufferSpecialization)
+ foreach (KeyValuePair kv in _textureArrayFromBufferSpecialization)
{
- var textureKey = kv.Key;
- var length = kv.Value;
+ TextureKey textureKey = kv.Key;
+ int length = kv.Value;
dataWriter.WriteWithMagicAndSize(ref textureKey, TexkMagic);
dataWriter.Write(ref length);
@@ -1038,10 +1040,10 @@ namespace Ryujinx.Graphics.Gpu.Shader
count = (ushort)_textureArrayFromPoolSpecialization.Count;
dataWriter.Write(ref count);
- foreach (var kv in _textureArrayFromPoolSpecialization)
+ foreach (KeyValuePair kv in _textureArrayFromPoolSpecialization)
{
- var textureKey = kv.Key;
- var length = kv.Value;
+ bool textureKey = kv.Key;
+ int length = kv.Value;
dataWriter.WriteWithMagicAndSize(ref textureKey, TexkMagic);
dataWriter.Write(ref length);
diff --git a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
index 1042a4db8..b68a64a47 100644
--- a/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
@@ -87,7 +87,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
}
using ManualResetEvent waitEvent = new(false);
- var info = _syncpoints[id].RegisterCallback(threshold, (x) => waitEvent.Set());
+ SyncpointWaiterHandle info = _syncpoints[id].RegisterCallback(threshold, (x) => waitEvent.Set());
if (info == null)
{
diff --git a/src/Ryujinx.Graphics.Gpu/Window.cs b/src/Ryujinx.Graphics.Gpu/Window.cs
index 59cd4c8a6..5c3463f2a 100644
--- a/src/Ryujinx.Graphics.Gpu/Window.cs
+++ b/src/Ryujinx.Graphics.Gpu/Window.cs
@@ -1,5 +1,6 @@
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Image;
+using Ryujinx.Graphics.Gpu.Memory;
using Ryujinx.Graphics.Texture;
using Ryujinx.Memory.Range;
using System;
@@ -137,7 +138,7 @@ namespace Ryujinx.Graphics.Gpu
Action