misc: chore: Use collection expressions (part 2)

This commit is contained in:
KeatonTheBot 2025-03-10 21:32:01 -05:00
parent c923c0043a
commit 340ec79e9f
176 changed files with 308 additions and 308 deletions

View file

@ -1079,7 +1079,7 @@ namespace ARMeilleure.CodeGen.Arm64
private static UnwindInfo WritePrologue(CodeGenContext context) private static UnwindInfo WritePrologue(CodeGenContext context)
{ {
List<UnwindPushEntry> pushEntries = new(); List<UnwindPushEntry> pushEntries = [];
Operand rsp = Register(SpRegister); Operand rsp = Register(SpRegister);

View file

@ -31,7 +31,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
public ParallelCopy() public ParallelCopy()
{ {
_copies = new List<Copy>(); _copies = [];
} }
public void AddCopy(Register dest, Register source, OperandType type) public void AddCopy(Register dest, Register source, OperandType type)
@ -218,7 +218,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
public Operation[] Sequence() public Operation[] Sequence()
{ {
List<Operation> sequence = new(); List<Operation> sequence = [];
if (_spillQueue != null) if (_spillQueue != null)
{ {

View file

@ -799,8 +799,8 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
private void NumberLocals(ControlFlowGraph cfg, int registersCount) private void NumberLocals(ControlFlowGraph cfg, int registersCount)
{ {
_operationNodes = new List<(IntrusiveList<Operation>, Operation)>(); _operationNodes = [];
_intervals = new List<LiveInterval>(); _intervals = [];
for (int index = 0; index < registersCount; index++) for (int index = 0; index < registersCount; index++)
{ {
@ -980,7 +980,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
_blockLiveIn = blkLiveIn; _blockLiveIn = blkLiveIn;
_blockEdges = new HashSet<int>(); _blockEdges = [];
// Compute lifetime intervals. // Compute lifetime intervals.
int operationPos = _operationsCount; int operationPos = _operationsCount;

View file

@ -74,9 +74,9 @@ namespace ARMeilleure.CodeGen.X86
{ {
_stream = stream; _stream = stream;
_labels = new Dictionary<Operand, long>(); _labels = new Dictionary<Operand, long>();
_jumps = new List<Jump>(); _jumps = [];
_relocs = relocatable ? new List<Reloc>() : null; _relocs = relocatable ? [] : null;
} }
public void MarkLabel(Operand label) public void MarkLabel(Operand label)

View file

@ -1748,7 +1748,7 @@ namespace ARMeilleure.CodeGen.X86
private static UnwindInfo WritePrologue(CodeGenContext context) private static UnwindInfo WritePrologue(CodeGenContext context)
{ {
List<UnwindPushEntry> pushEntries = new(); List<UnwindPushEntry> pushEntries = [];
Operand rsp = Register(X86Register.Rsp); Operand rsp = Register(X86Register.Rsp);

View file

@ -31,11 +31,11 @@ namespace ARMeilleure.Common
_pageIndex = -1; _pageIndex = -1;
_page = null; _page = null;
_pages = new List<PageInfo>(); _pages = [];
_pageSize = pageSize; _pageSize = pageSize;
_pageCount = pageCount; _pageCount = pageCount;
_extras = new List<IntPtr>(); _extras = [];
} }
public Span<T> AllocateSpan<T>(ulong count) where T : unmanaged public Span<T> AllocateSpan<T>(ulong count) where T : unmanaged

View file

@ -17,7 +17,7 @@ namespace ARMeilleure.Decoders
public Block() public Block()
{ {
OpCodes = new List<OpCode>(); OpCodes = [];
} }
public Block(ulong address) : this() public Block(ulong address) : this()

View file

@ -20,7 +20,7 @@ namespace ARMeilleure.Decoders
public static Block[] Decode(IMemoryManager memory, ulong address, ExecutionMode mode, bool highCq, DecoderMode dMode) public static Block[] Decode(IMemoryManager memory, ulong address, ExecutionMode mode, bool highCq, DecoderMode dMode)
{ {
List<Block> blocks = new(); List<Block> blocks = [];
Queue<Block> workQueue = new(); Queue<Block> workQueue = new();

View file

@ -12,7 +12,7 @@ namespace ARMeilleure.Decoders
public OpCodeT16IfThen(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode) public OpCodeT16IfThen(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
{ {
List<Condition> conds = new(); List<Condition> conds = [];
int cond = (opCode >> 4) & 0xf; int cond = (opCode >> 4) & 0xf;
int mask = opCode & 0xf; int mask = opCode & 0xf;

View file

@ -29,9 +29,9 @@ namespace ARMeilleure.Decoders
} }
} }
private static readonly List<InstInfo> _allInstA32 = new(); private static readonly List<InstInfo> _allInstA32 = [];
private static readonly List<InstInfo> _allInstT32 = new(); private static readonly List<InstInfo> _allInstT32 = [];
private static readonly List<InstInfo> _allInstA64 = new(); private static readonly List<InstInfo> _allInstA64 = [];
private static readonly InstInfo[][] _instA32FastLookup = new InstInfo[FastLookupSize][]; private static readonly InstInfo[][] _instA32FastLookup = new InstInfo[FastLookupSize][];
private static readonly InstInfo[][] _instT32FastLookup = new InstInfo[FastLookupSize][]; private static readonly InstInfo[][] _instT32FastLookup = new InstInfo[FastLookupSize][];
@ -1330,7 +1330,7 @@ namespace ARMeilleure.Decoders
for (int index = 0; index < temp.Length; index++) for (int index = 0; index < temp.Length; index++)
{ {
temp[index] = new List<InstInfo>(); temp[index] = [];
} }
foreach (InstInfo inst in allInsts) foreach (InstInfo inst in allInsts)

View file

@ -29,7 +29,7 @@ namespace ARMeilleure.Diagnostics
static Symbols() static Symbols()
{ {
_symbols = new ConcurrentDictionary<ulong, string>(); _symbols = new ConcurrentDictionary<ulong, string>();
_rangedSymbols = new List<RangedSymbol>(); _rangedSymbols = [];
} }
public static string Get(ulong address) public static string Get(ulong address)

View file

@ -27,7 +27,7 @@ namespace ARMeilleure.IntermediateRepresentation
{ {
get get
{ {
_domFrontiers ??= new HashSet<BasicBlock>(); _domFrontiers ??= [];
return _domFrontiers; return _domFrontiers;
} }
@ -38,7 +38,7 @@ namespace ARMeilleure.IntermediateRepresentation
public BasicBlock(int index) public BasicBlock(int index)
{ {
Operations = new IntrusiveList<Operation>(); Operations = new IntrusiveList<Operation>();
Predecessors = new List<BasicBlock>(); Predecessors = [];
Index = index; Index = index;
} }

View file

@ -23,7 +23,7 @@ namespace ARMeilleure.Translation.Cache
} }
} }
private readonly List<MemoryBlock> _blocks = new(); private readonly List<MemoryBlock> _blocks = [];
public CacheMemoryAllocator(int capacity) public CacheMemoryAllocator(int capacity)
{ {

View file

@ -26,12 +26,12 @@ namespace ARMeilleure.Translation.Cache
private static List<CacheMemoryAllocator> _cacheAllocators = []; private static List<CacheMemoryAllocator> _cacheAllocators = [];
private static readonly List<CacheEntry> _cacheEntries = new(); private static readonly List<CacheEntry> _cacheEntries = [];
private static readonly Lock _lock = new(); private static readonly Lock _lock = new();
private static bool _initialized; private static bool _initialized;
private static readonly List<ReservedRegion> _jitRegions = new(); private static readonly List<ReservedRegion> _jitRegions = [];
private static int _activeRegionIndex = 0; private static int _activeRegionIndex = 0;
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]

View file

@ -108,7 +108,7 @@ namespace ARMeilleure.Translation
/// <returns>A list of all values sorted by Key Order</returns> /// <returns>A list of all values sorted by Key Order</returns>
public List<TV> AsList() public List<TV> AsList()
{ {
List<TV> list = new(); List<TV> list = [];
AddToList(_root, list); AddToList(_root, list);

View file

@ -50,7 +50,7 @@ namespace ARMeilleure.Translation.PTC
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static List<T> DeserializeList<T>(Stream stream) where T : struct public static List<T> DeserializeList<T>(Stream stream) where T : struct
{ {
List<T> list = new(); List<T> list = [];
int count = DeserializeStructure<int>(stream); int count = DeserializeStructure<int>(stream);

View file

@ -140,7 +140,7 @@ namespace ARMeilleure.Translation.PTC
public List<ulong> GetBlacklistedFunctions() public List<ulong> GetBlacklistedFunctions()
{ {
List<ulong> funcs = new List<ulong>(); List<ulong> funcs = [];
foreach (var profiledFunc in ProfiledFuncs) foreach (var profiledFunc in ProfiledFuncs)
{ {

View file

@ -36,7 +36,7 @@ namespace ARMeilleure.Translation
Sync = new object(); Sync = new object();
_requests = new Stack<RejitRequest>(); _requests = new Stack<RejitRequest>();
_requestAddresses = new HashSet<ulong>(); _requestAddresses = [];
} }
/// <summary> /// <summary>

View file

@ -46,7 +46,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
SampleRate = sampleRate; SampleRate = sampleRate;
BufferCount = mixBufferCount + voiceChannelCountMax; BufferCount = mixBufferCount + voiceChannelCountMax;
Buffers = mixBuffer; Buffers = mixBuffer;
Commands = new List<ICommand>(); Commands = [];
MemoryManager = memoryManager; MemoryManager = memoryManager;
_buffersEntryCount = Buffers.Length; _buffersEntryCount = Buffers.Length;

View file

@ -139,7 +139,7 @@ namespace Ryujinx.Common.Collections
/// <param name="list">List to add the tree pairs into</param> /// <param name="list">List to add the tree pairs into</param>
public List<KeyValuePair<TKey, TValue>> AsLevelOrderList() public List<KeyValuePair<TKey, TValue>> AsLevelOrderList()
{ {
List<KeyValuePair<TKey, TValue>> list = new(); List<KeyValuePair<TKey, TValue>> list = [];
Queue<Node<TKey, TValue>> nodes = new(); Queue<Node<TKey, TValue>> nodes = new();
@ -168,7 +168,7 @@ namespace Ryujinx.Common.Collections
/// <returns>A list of all KeyValuePairs sorted by Key Order</returns> /// <returns>A list of all KeyValuePairs sorted by Key Order</returns>
public List<KeyValuePair<TKey, TValue>> AsList() public List<KeyValuePair<TKey, TValue>> AsList()
{ {
List<KeyValuePair<TKey, TValue>> list = new(); List<KeyValuePair<TKey, TValue>> list = [];
AddToList(Root, list); AddToList(Root, list);

View file

@ -8,7 +8,7 @@ namespace Ryujinx.Common.Configuration
public ModMetadata() public ModMetadata()
{ {
Mods = new List<Mod>(); Mods = [];
} }
} }
} }

View file

@ -131,7 +131,7 @@ namespace Ryujinx.Common.Logging
_enabledClasses[index] = true; _enabledClasses[index] = true;
} }
_logTargets = new List<ILogTarget>(); _logTargets = [];
_time = Stopwatch.StartNew(); _time = Stopwatch.StartNew();

View file

@ -125,8 +125,8 @@ namespace Ryujinx.Common.PreciseSleep
} }
private readonly Lock _lock = new(); private readonly Lock _lock = new();
private readonly List<NanosleepThread> _threads = new(); private readonly List<NanosleepThread> _threads = [];
private readonly List<NanosleepThread> _active = new(); private readonly List<NanosleepThread> _active = [];
private readonly Stack<NanosleepThread> _free = new(); private readonly Stack<NanosleepThread> _free = new();
private readonly AutoResetEvent _signalTarget; private readonly AutoResetEvent _signalTarget;

View file

@ -51,7 +51,7 @@ namespace Ryujinx.Common.SystemInterop
private long _lastId; private long _lastId;
private readonly Lock _lock = new(); private readonly Lock _lock = new();
private readonly List<WaitingObject> _waitingObjects = new(); private readonly List<WaitingObject> _waitingObjects = [];
private WindowsGranularTimer() private WindowsGranularTimer()
{ {

View file

@ -164,7 +164,7 @@ namespace ARMeilleure.Common
_fillBottomLevel = new SparseMemoryBlock(bottomLevelSize, null, _sparseFill); _fillBottomLevel = new SparseMemoryBlock(bottomLevelSize, null, _sparseFill);
_fillBottomLevelPtr = (TEntry*)_fillBottomLevel.Block.Pointer; _fillBottomLevelPtr = (TEntry*)_fillBottomLevel.Block.Pointer;
_sparseReserved = new List<TableSparseBlock>(); _sparseReserved = [];
_sparseLock = new ReaderWriterLockSlim(); _sparseLock = new ReaderWriterLockSlim();
_sparseBlockSize = bottomLevelSize; _sparseBlockSize = bottomLevelSize;

View file

@ -21,7 +21,7 @@ namespace Ryujinx.Cpu.Jit.HostTracked
public AddressSpacePartitioned(MemoryTracking tracking, MemoryBlock backingMemory, NativePageTable nativePageTable, bool useProtectionMirrors) public AddressSpacePartitioned(MemoryTracking tracking, MemoryBlock backingMemory, NativePageTable nativePageTable, bool useProtectionMirrors)
{ {
_backingMemory = backingMemory; _backingMemory = backingMemory;
_partitions = new(); _partitions = [];
_asAllocator = new(tracking, nativePageTable.Read, _partitions); _asAllocator = new(tracking, nativePageTable.Read, _partitions);
_updatePtCallback = nativePageTable.Update; _updatePtCallback = nativePageTable.Update;
_useProtectionMirrors = useProtectionMirrors; _useProtectionMirrors = useProtectionMirrors;

View file

@ -36,7 +36,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
RegisterAllocator = registerAllocator; RegisterAllocator = registerAllocator;
MemoryManagerType = mmType; MemoryManagerType = mmType;
_itConditions = new ArmCondition[4]; _itConditions = new ArmCondition[4];
_pendingBranches = new(); _pendingBranches = [];
IsThumb = isThumb; IsThumb = isThumb;
} }

View file

@ -10,8 +10,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
{ {
public static MultiBlock DecodeMulti(CpuPreset cpuPreset, IMemoryManager memoryManager, ulong address, bool isThumb) public static MultiBlock DecodeMulti(CpuPreset cpuPreset, IMemoryManager memoryManager, ulong address, bool isThumb)
{ {
List<Block> blocks = new(); List<Block> blocks = [];
List<ulong> branchTargets = new(); List<ulong> branchTargets = [];
while (true) while (true)
{ {
@ -202,7 +202,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
{ {
ulong startAddress = address; ulong startAddress = address;
List<InstInfo> insts = new(); List<InstInfo> insts = [];
uint encoding; uint encoding;
InstMeta meta; InstMeta meta;

View file

@ -25,8 +25,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm64
{ {
Debug.Assert((int)((endAddress - address) / 4) == instructions.Count); Debug.Assert((int)((endAddress - address) / 4) == instructions.Count);
_predecessors = new(); _predecessors = [];
_successors = new(); _successors = [];
Address = address; Address = address;
EndAddress = endAddress; EndAddress = endAddress;
Instructions = instructions; Instructions = instructions;

View file

@ -36,8 +36,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm64
{ {
Console.WriteLine($"bb {block.Index}"); Console.WriteLine($"bb {block.Index}");
List<int> predList = new(); List<int> predList = [];
List<int> succList = new(); List<int> succList = [];
for (int index = 0; index < block.PredecessorsCount; index++) for (int index = 0; index < block.PredecessorsCount; index++)
{ {

View file

@ -309,7 +309,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
MultiBlock multiBlock = Decoder.DecodeMulti(cpuPreset, memoryManager, address); MultiBlock multiBlock = Decoder.DecodeMulti(cpuPreset, memoryManager, address);
Dictionary<ulong, int> targets = new(); Dictionary<ulong, int> targets = new();
List<PendingBranch> pendingBranches = new(); List<PendingBranch> pendingBranches = [];
uint gprUseMask = multiBlock.GlobalUseMask.GprMask; uint gprUseMask = multiBlock.GlobalUseMask.GprMask;
uint fpSimdUseMask = multiBlock.GlobalUseMask.FpSimdMask; uint fpSimdUseMask = multiBlock.GlobalUseMask.FpSimdMask;

View file

@ -15,8 +15,8 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
public static MultiBlock DecodeMulti(CpuPreset cpuPreset, IMemoryManager memoryManager, ulong address) public static MultiBlock DecodeMulti(CpuPreset cpuPreset, IMemoryManager memoryManager, ulong address)
{ {
List<Block> blocks = new(); List<Block> blocks = [];
List<ulong> branchTargets = new(); List<ulong> branchTargets = [];
RegisterMask useMask = RegisterMask.Zero; RegisterMask useMask = RegisterMask.Zero;
@ -238,7 +238,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
{ {
ulong startAddress = address; ulong startAddress = address;
List<InstInfo> insts = new(); List<InstInfo> insts = [];
uint gprUseMask = useMask.GprMask; uint gprUseMask = useMask.GprMask;
uint fpSimdUseMask = useMask.FpSimdMask; uint fpSimdUseMask = useMask.FpSimdMask;

View file

@ -24,7 +24,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
} }
} }
private readonly List<MemoryBlock> _blocks = new(); private readonly List<MemoryBlock> _blocks = [];
public CacheMemoryAllocator(int capacity) public CacheMemoryAllocator(int capacity)
{ {

View file

@ -23,11 +23,11 @@ namespace Ryujinx.Cpu.LightningJit.Cache
private static CacheMemoryAllocator _cacheAllocator; private static CacheMemoryAllocator _cacheAllocator;
private static readonly List<CacheEntry> _cacheEntries = new(); private static readonly List<CacheEntry> _cacheEntries = [];
private static readonly Lock _lock = new(); private static readonly Lock _lock = new();
private static bool _initialized; private static bool _initialized;
private static readonly List<ReservedRegion> _jitRegions = new(); private static readonly List<ReservedRegion> _jitRegions = [];
private static int _activeRegionIndex = 0; private static int _activeRegionIndex = 0;
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]

View file

@ -231,7 +231,7 @@ namespace Ryujinx.Cpu.LightningJit.Cache
_sharedCache.Pointer, _sharedCache.Pointer,
SharedCacheSize); SharedCacheSize);
List<(ulong, ThreadLocalCacheEntry)> toDelete = new(); List<(ulong, ThreadLocalCacheEntry)> toDelete = [];
foreach ((ulong address, ThreadLocalCacheEntry entry) in _threadLocalCache) foreach ((ulong address, ThreadLocalCacheEntry entry) in _threadLocalCache)
{ {

View file

@ -35,8 +35,8 @@ namespace Ryujinx.Cpu.LightningJit.Cache
{ {
_alignedRangeAction = alignedRangeAction; _alignedRangeAction = alignedRangeAction;
_alignedFunctionAction = alignedFunctionAction; _alignedFunctionAction = alignedFunctionAction;
_pendingFunctions = new(); _pendingFunctions = [];
_ranges = new(); _ranges = [];
} }
public bool Has(ulong address) public bool Has(ulong address)

View file

@ -26,7 +26,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
public Assembler(CodeWriter writer) public Assembler(CodeWriter writer)
{ {
_code = writer.GetList(); _code = writer.GetList();
_labels = new List<LabelState>(); _labels = [];
} }
public readonly Operand CreateLabel() public readonly Operand CreateLabel()

View file

@ -8,7 +8,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
{ {
public IEnumerable<ulong> GetCallStack(IntPtr framePointer, IntPtr codeRegionStart, int codeRegionSize, IntPtr codeRegion2Start, int codeRegion2Size) public IEnumerable<ulong> GetCallStack(IntPtr framePointer, IntPtr codeRegionStart, int codeRegionSize, IntPtr codeRegion2Start, int codeRegion2Size)
{ {
List<ulong> functionPointers = new(); List<ulong> functionPointers = [];
while (true) while (true)
{ {

View file

@ -16,7 +16,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
public TailMerger() public TailMerger()
{ {
_branchPointers = new(); _branchPointers = [];
} }
public void AddConditionalReturn(CodeWriter writer, in Assembler asm, ArmCondition returnCondition) public void AddConditionalReturn(CodeWriter writer, in Assembler asm, ArmCondition returnCondition)

View file

@ -12,7 +12,7 @@ namespace Ryujinx.Cpu.LightningJit
public CodeWriter() public CodeWriter()
{ {
_instructions = new(); _instructions = [];
} }
public void WriteInstruction(uint instruction) public void WriteInstruction(uint instruction)

View file

@ -34,7 +34,7 @@ namespace Ryujinx.Cpu.LightningJit.Table
{ {
int splitIndex = (int)((insts[index].Encoding >> _shift) & _mask); int splitIndex = (int)((insts[index].Encoding >> _shift) & _mask);
(splitList[splitIndex] ??= new()).Add(insts[index]); (splitList[splitIndex] ??= []).Add(insts[index]);
} }
for (int index = 0; index < count; index++) for (int index = 0; index < count; index++)

View file

@ -140,7 +140,7 @@ namespace Ryujinx.Cpu.LightningJit
/// <returns>Generated <see cref="DispatchStub"/></returns> /// <returns>Generated <see cref="DispatchStub"/></returns>
private IntPtr GenerateDispatchStub() private IntPtr GenerateDispatchStub()
{ {
List<int> branchToFallbackOffsets = new(); List<int> branchToFallbackOffsets = [];
CodeWriter writer = new(); CodeWriter writer = new();

View file

@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
private ulong _bufferHandle = 0; private ulong _bufferHandle = 0;
private readonly Dictionary<BufferHandle, BufferHandle> _bufferMap = new(); private readonly Dictionary<BufferHandle, BufferHandle> _bufferMap = new();
private readonly HashSet<BufferHandle> _inFlight = new(); private readonly HashSet<BufferHandle> _inFlight = [];
private readonly AutoResetEvent _inFlightChanged = new(false); private readonly AutoResetEvent _inFlightChanged = new(false);
internal BufferHandle CreateBufferHandle() internal BufferHandle CreateBufferHandle()

View file

@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources
_renderer = renderer; _renderer = renderer;
_toCompile = new Queue<IProgramRequest>(); _toCompile = new Queue<IProgramRequest>();
_inProgress = new List<ThreadedProgram>(); _inProgress = [];
} }
public void Add(IProgramRequest request) public void Add(IProgramRequest request)

View file

@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading
{ {
class SyncMap : IDisposable class SyncMap : IDisposable
{ {
private readonly HashSet<ulong> _inFlight = new(); private readonly HashSet<ulong> _inFlight = [];
private readonly AutoResetEvent _inFlightChanged = new(false); private readonly AutoResetEvent _inFlightChanged = new(false);
internal void CreateSyncHandle(ulong id) internal void CreateSyncHandle(ulong id)

View file

@ -274,7 +274,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed.Blender
private void Assemble(CC cc, Instruction inst, Dest dest, OpAC srcA, OpBD srcB, OpAC srcC, OpBD srcD) private void Assemble(CC cc, Instruction inst, Dest dest, OpAC srcA, OpBD srcB, OpAC srcC, OpBD srcD)
{ {
(_code ??= new List<uint>()).Add(new UcodeOp(cc, inst, _constantIndex, dest, srcA, srcB, srcC, srcD).Word); (_code ??= []).Add(new UcodeOp(cc, inst, _constantIndex, dest, srcA, srcB, srcC, srcD).Word);
} }
public void SetConstant(int index, float r, float g, float b) public void SetConstant(int index, float r, float g, float b)

View file

@ -126,9 +126,9 @@ namespace Ryujinx.Graphics.Gpu
HostInitalized = new ManualResetEvent(false); HostInitalized = new ManualResetEvent(false);
_gpuReadyEvent = new ManualResetEvent(false); _gpuReadyEvent = new ManualResetEvent(false);
SyncActions = new List<ISyncActionHandler>(); SyncActions = [];
SyncpointActions = new List<ISyncActionHandler>(); SyncpointActions = [];
BufferMigrations = new List<BufferMigration>(); BufferMigrations = [];
DeferredActions = new Queue<Action>(); DeferredActions = new Queue<Action>();

View file

@ -118,10 +118,10 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary> /// </summary>
public AutoDeleteCache() public AutoDeleteCache()
{ {
_textures = new LinkedList<Texture>(); _textures = [];
_shortCacheBuilder = new HashSet<ShortTextureCacheEntry>(); _shortCacheBuilder = [];
_shortCache = new HashSet<ShortTextureCacheEntry>(); _shortCache = [];
_shortCacheLookup = new Dictionary<TextureDescriptor, ShortTextureCacheEntry>(); _shortCacheLookup = new Dictionary<TextureDescriptor, ShortTextureCacheEntry>();
} }

View file

@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Gpu.Image
public PoolCache(GpuContext context) public PoolCache(GpuContext context)
{ {
_context = context; _context = context;
_pools = new LinkedList<T>(); _pools = [];
} }
/// <summary> /// <summary>

View file

@ -260,8 +260,8 @@ namespace Ryujinx.Graphics.Gpu.Image
_viewStorage = this; _viewStorage = this;
_views = new List<Texture>(); _views = [];
_poolOwners = new List<TexturePoolOwner>(); _poolOwners = [];
} }
/// <summary> /// <summary>

View file

@ -549,7 +549,7 @@ namespace Ryujinx.Graphics.Gpu.Image
_channel = channel; _channel = channel;
_cacheFromBuffer = new Dictionary<CacheEntryFromBufferKey, CacheEntryFromBuffer>(); _cacheFromBuffer = new Dictionary<CacheEntryFromBufferKey, CacheEntryFromBuffer>();
_cacheFromPool = new Dictionary<CacheEntryFromPoolKey, CacheEntry>(); _cacheFromPool = new Dictionary<CacheEntryFromPoolKey, CacheEntry>();
_lruCache = new LinkedList<CacheEntryFromBuffer>(); _lruCache = [];
} }
/// <summary> /// <summary>
@ -1116,7 +1116,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{ {
if (key.MatchesPool(pool)) if (key.MatchesPool(pool))
{ {
(keysToRemove ??= new()).Add(key); (keysToRemove ??= []).Add(key);
if (key.IsImage) if (key.IsImage)
{ {

View file

@ -58,15 +58,15 @@ namespace Ryujinx.Graphics.Gpu.Image
_context = context; _context = context;
_physicalMemory = physicalMemory; _physicalMemory = physicalMemory;
_textures = new MultiRangeList<Texture>(); _textures = [];
_partiallyMappedTextures = new HashSet<Texture>(); _partiallyMappedTextures = [];
_texturesLock = new ReaderWriterLockSlim(); _texturesLock = new ReaderWriterLockSlim();
_textureOverlaps = new Texture[OverlapsBufferInitialCapacity]; _textureOverlaps = new Texture[OverlapsBufferInitialCapacity];
_overlapInfo = new OverlapInfo[OverlapsBufferInitialCapacity]; _overlapInfo = new OverlapInfo[OverlapsBufferInitialCapacity];
_cache = new AutoDeleteCache(); _cache = [];
} }
/// <summary> /// <summary>
@ -892,7 +892,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// otherwise we only need the data that is copied from the existing texture, without loading the CPU data. // otherwise we only need the data that is copied from the existing texture, without loading the CPU data.
bool updateNewTexture = texture.Width > overlap.Width || texture.Height > overlap.Height; bool updateNewTexture = texture.Width > overlap.Width || texture.Height > overlap.Height;
texture.InitializeGroup(true, true, new List<TextureIncompatibleOverlap>()); texture.InitializeGroup(true, true, []);
texture.InitializeData(false, updateNewTexture); texture.InitializeData(false, updateNewTexture);
overlap.SynchronizeMemory(); overlap.SynchronizeMemory();

View file

@ -134,8 +134,8 @@ namespace Ryujinx.Graphics.Gpu.Image
Offset = offset; Offset = offset;
Size = (int)size; Size = (int)size;
Overlaps = new List<Texture>(); Overlaps = [];
Dependencies = new List<TextureDependency>(); Dependencies = [];
BaseSlice = baseSlice; BaseSlice = baseSlice;
SliceCount = sliceCount; SliceCount = sliceCount;

View file

@ -97,7 +97,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary> /// </summary>
public TextureAliasList() public TextureAliasList()
{ {
_aliases = new List<Alias>(); _aliases = [];
} }
/// <summary> /// <summary>

View file

@ -799,7 +799,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
try try
{ {
(_virtualDependencies ??= new()).Add(virtualBuffer); (_virtualDependencies ??= []).Add(virtualBuffer);
} }
finally finally
{ {

View file

@ -61,8 +61,8 @@ namespace Ryujinx.Graphics.Gpu.Memory
_context = context; _context = context;
_physicalMemory = physicalMemory; _physicalMemory = physicalMemory;
_buffers = new RangeList<Buffer>(); _buffers = [];
_multiRangeBuffers = new MultiRangeList<MultiRangeBuffer>(); _multiRangeBuffers = [];
_bufferOverlaps = new Buffer[OverlapsBufferInitialCapacity]; _bufferOverlaps = new Buffer[OverlapsBufferInitialCapacity];
@ -395,7 +395,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
ulong dstOffset = 0; ulong dstOffset = 0;
HashSet<Buffer> physicalBuffers = new(); HashSet<Buffer> physicalBuffers = [];
for (int i = 0; i < virtualBuffer.Range.Count; i++) for (int i = 0; i < virtualBuffer.Range.Count; i++)
{ {
@ -1041,7 +1041,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
{ {
if (entry.Value.UnmappedSequence != entry.Value.Buffer.UnmappedSequence) if (entry.Value.UnmappedSequence != entry.Value.Buffer.UnmappedSequence)
{ {
(toDelete ??= new()).Add(entry.Key); (toDelete ??= []).Add(entry.Key);
} }
} }

View file

@ -141,9 +141,9 @@ namespace Ryujinx.Graphics.Gpu.Memory
_gpUniformBuffers[index] = new BuffersPerStage(Constants.TotalGpUniformBuffers); _gpUniformBuffers[index] = new BuffersPerStage(Constants.TotalGpUniformBuffers);
} }
_bufferTextures = new List<BufferTextureBinding>(); _bufferTextures = [];
_bufferTextureArrays = new List<BufferTextureArrayBinding<ITextureArray>>(); _bufferTextureArrays = [];
_bufferImageArrays = new List<BufferTextureArrayBinding<IImageArray>>(); _bufferImageArrays = [];
_ranges = new BufferAssignment[Constants.TotalGpUniformBuffers * Constants.ShaderStages]; _ranges = new BufferAssignment[Constants.TotalGpUniformBuffers * Constants.ShaderStages];
} }

View file

@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// </summary> /// </summary>
public CounterCache() public CounterCache()
{ {
_items = new List<CounterEntry>(); _items = [];
} }
/// <summary> /// <summary>

View file

@ -128,7 +128,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
/// <param name="rangeSize">Size of the range in bytes</param> /// <param name="rangeSize">Size of the range in bytes</param>
public void AddPhysicalDependency(Buffer buffer, ulong rangeAddress, ulong dstOffset, ulong rangeSize) public void AddPhysicalDependency(Buffer buffer, ulong rangeAddress, ulong dstOffset, ulong rangeSize)
{ {
(_dependencies ??= new()).Add(new(buffer, rangeAddress - buffer.Address, dstOffset, rangeSize)); (_dependencies ??= []).Add(new(buffer, rangeAddress - buffer.Address, dstOffset, rangeSize));
buffer.AddVirtualDependency(this); buffer.AddVirtualDependency(this);
} }

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
public void AddRemapAction(Action action) public void AddRemapAction(Action action)
{ {
RemapActions ??= new List<Action>(); RemapActions ??= [];
RemapActions.Add(action); RemapActions.Add(action);
} }
} }

View file

@ -74,7 +74,7 @@ namespace Ryujinx.Graphics.Gpu.Memory
public VirtualRangeCache(MemoryManager memoryManager) public VirtualRangeCache(MemoryManager memoryManager)
{ {
_memoryManager = memoryManager; _memoryManager = memoryManager;
_virtualRanges = new RangeList<VirtualRange>(); _virtualRanges = [];
_virtualRangeOverlaps = new VirtualRange[BufferCache.OverlapsBufferInitialCapacity]; _virtualRangeOverlaps = new VirtualRange[BufferCache.OverlapsBufferInitialCapacity];
_deferredUnmaps = new ConcurrentQueue<VirtualRange>(); _deferredUnmaps = new ConcurrentQueue<VirtualRange>();
} }

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
public ComputeShaderCacheHashTable() public ComputeShaderCacheHashTable()
{ {
_cache = new PartitionedHashTable<ShaderSpecializationList>(); _cache = new PartitionedHashTable<ShaderSpecializationList>();
_shaderPrograms = new List<CachedShaderProgram>(); _shaderPrograms = [];
} }
/// <summary> /// <summary>
@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <param name="program">Program to be added</param> /// <param name="program">Program to be added</param>
public void Add(CachedShaderProgram program) public void Add(CachedShaderProgram program)
{ {
var specList = _cache.GetOrAdd(program.Shaders[0].Code, new ShaderSpecializationList()); var specList = _cache.GetOrAdd(program.Shaders[0].Code, []);
specList.Add(program); specList.Add(program);
_shaderPrograms.Add(program); _shaderPrograms.Add(program);
} }

View file

@ -429,7 +429,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
{ {
if (!_toc.TryGetValue(hash, out var list)) if (!_toc.TryGetValue(hash, out var list))
{ {
_toc.Add(hash, list = new List<TocMemoryEntry>()); _toc.Add(hash, list = []);
} }
list.Add(new TocMemoryEntry(dataOffset, codeSize, cb1DataSize, index)); list.Add(new TocMemoryEntry(dataOffset, codeSize, cb1DataSize, index));

View file

@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
using MemoryStream input = new(code); using MemoryStream input = new(code);
using BinaryReader reader = new(input); using BinaryReader reader = new(input);
List<ShaderSource> output = new(); List<ShaderSource> output = [];
int count = reader.ReadInt32(); int count = reader.ReadInt32();

View file

@ -104,7 +104,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.HashTable
/// </summary> /// </summary>
public PartitionedHashTable() public PartitionedHashTable()
{ {
_sizeTable = new List<SizeEntry>(); _sizeTable = [];
} }
/// <summary> /// <summary>

View file

@ -192,7 +192,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
if (!_shaderPrograms.TryGetValue(idTable, out ShaderSpecializationList specList)) if (!_shaderPrograms.TryGetValue(idTable, out ShaderSpecializationList specList))
{ {
specList = new ShaderSpecializationList(); specList = [];
_shaderPrograms.Add(idTable, specList); _shaderPrograms.Add(idTable, specList);
} }

View file

@ -60,8 +60,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
for (int index = 0; index < totalSets; index++) for (int index = 0; index < totalSets; index++)
{ {
_resourceDescriptors[index] = new(); _resourceDescriptors[index] = [];
_resourceUsages[index] = new(); _resourceUsages[index] = [];
} }
AddDescriptor(SupportBufferStages, ResourceType.UniformBuffer, uniformSetIndex, 0, 1); AddDescriptor(SupportBufferStages, ResourceType.UniformBuffer, uniformSetIndex, 0, 1);
@ -280,7 +280,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
for (int index = oldLength; index <= setIndex; index++) for (int index = oldLength; index <= setIndex; index++)
{ {
_resourceDescriptors[index] = new(); _resourceDescriptors[index] = [];
} }
} }
@ -301,7 +301,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
for (int index = oldLength; index <= setIndex; index++) for (int index = oldLength; index <= setIndex; index++)
{ {
_resourceUsages[index] = new(); _resourceUsages[index] = [];
} }
} }

View file

@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// </summary> /// </summary>
class ShaderSpecializationList : IEnumerable<CachedShaderProgram> class ShaderSpecializationList : IEnumerable<CachedShaderProgram>
{ {
private readonly List<CachedShaderProgram> _entries = new(); private readonly List<CachedShaderProgram> _entries = [];
/// <summary> /// <summary>
/// Adds a program to the list. /// Adds a program to the list.

View file

@ -24,7 +24,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
public Syncpoint(uint id) public Syncpoint(uint id)
{ {
Id = id; Id = id;
_waiters = new List<SyncpointWaiterHandle>(); _waiters = [];
} }
/// <summary> /// <summary>
@ -92,7 +92,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
} }
else else
{ {
expiredList ??= new List<SyncpointWaiterHandle>(); expiredList ??= [];
expiredList.Add(item); expiredList.Add(item);
} }

View file

@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Host1x
} }
} }
private readonly List<SyncptIncr> _incrs = new(); private readonly List<SyncptIncr> _incrs = [];
private uint _currentId; private uint _currentId;

View file

@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
public IntermediatePool(OpenGLRenderer renderer) public IntermediatePool(OpenGLRenderer renderer)
{ {
_renderer = renderer; _renderer = renderer;
_entries = new List<TextureView>(); _entries = [];
} }
public TextureView GetOrCreateWithAtLeast( public TextureView GetOrCreateWithAtLeast(

View file

@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.OpenGL
{ {
if (!_textures.TryGetValue(view.Info, out List<DisposedTexture> list)) if (!_textures.TryGetValue(view.Info, out List<DisposedTexture> list))
{ {
list = new List<DisposedTexture>(); list = [];
_textures.Add(view.Info, list); _textures.Add(view.Info, list);
} }

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.OpenGL
private ulong _firstHandle = 0; private ulong _firstHandle = 0;
private static ClientWaitSyncFlags SyncFlags => HwCapabilities.RequiresSyncFlush ? ClientWaitSyncFlags.None : ClientWaitSyncFlags.SyncFlushCommandsBit; private static ClientWaitSyncFlags SyncFlags => HwCapabilities.RequiresSyncFlush ? ClientWaitSyncFlags.None : ClientWaitSyncFlags.SyncFlushCommandsBit;
private readonly List<SyncHandle> _handles = new(); private readonly List<SyncHandle> _handles = [];
public void Create(ulong id) public void Create(ulong id)
{ {

View file

@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private class BlockState private class BlockState
{ {
private int _entryCount; private int _entryCount;
private readonly List<Instruction> _labels = new(); private readonly List<Instruction> _labels = [];
public Instruction GetNextLabel(CodeGenContext context) public Instruction GetNextLabel(CodeGenContext context)
{ {

View file

@ -81,7 +81,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static void DeclareBuffers(CodeGenContext context, IEnumerable<BufferDefinition> buffers, bool isBuffer) private static void DeclareBuffers(CodeGenContext context, IEnumerable<BufferDefinition> buffers, bool isBuffer)
{ {
HashSet<SpvInstruction> decoratedTypes = new(); HashSet<SpvInstruction> decoratedTypes = [];
foreach (BufferDefinition buffer in buffers) foreach (BufferDefinition buffer in buffers)
{ {

View file

@ -45,11 +45,11 @@ namespace Ryujinx.Graphics.Shader.Decoders
{ {
Address = address; Address = address;
Predecessors = new List<Block>(); Predecessors = [];
Successors = new List<Block>(); Successors = [];
OpCodes = new List<InstOp>(); OpCodes = [];
PushOpCodes = new List<PushOpInfo>(); PushOpCodes = [];
SyncTargets = new Dictionary<ulong, SyncTarget>(); SyncTargets = new Dictionary<ulong, SyncTarget>();
} }

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
public DecodedFunction(ulong address) public DecodedFunction(ulong address)
{ {
Address = address; Address = address;
_callers = new HashSet<DecodedFunction>(); _callers = [];
Type = FunctionType.User; Type = FunctionType.User;
Id = -1; Id = -1;
} }

View file

@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
{ {
MainFunction = mainFunction; MainFunction = mainFunction;
_functions = functions; _functions = functions;
_functionsWithId = new(); _functionsWithId = [];
AttributeUsage = attributeUsage; AttributeUsage = attributeUsage;
UsedFeatures = usedFeatures; UsedFeatures = usedFeatures;
ClipDistancesWritten = clipDistancesWritten; ClipDistancesWritten = clipDistancesWritten;

View file

@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
while (functionsQueue.TryDequeue(out DecodedFunction currentFunction)) while (functionsQueue.TryDequeue(out DecodedFunction currentFunction))
{ {
List<Block> blocks = new(); List<Block> blocks = [];
Queue<Block> workQueue = new(); Queue<Block> workQueue = new();
Dictionary<ulong, Block> visited = new(); Dictionary<ulong, Block> visited = new();
@ -520,7 +520,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
if (lastOp.Name == InstName.Brx && block.Successors.Count == (hasNext ? 1 : 0)) if (lastOp.Name == InstName.Brx && block.Successors.Count == (hasNext ? 1 : 0))
{ {
HashSet<ulong> visited = new(); HashSet<ulong> visited = [];
InstBrx opBrx = new(lastOp.RawOpCode); InstBrx opBrx = new(lastOp.RawOpCode);
ulong baseOffset = lastOp.GetAbsoluteAddress(); ulong baseOffset = lastOp.GetAbsoluteAddress();
@ -566,7 +566,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
// On a successful match, "BaseOffset" is the offset in bytes where the jump offsets are // On a successful match, "BaseOffset" is the offset in bytes where the jump offsets are
// located on the constant buffer, and "UpperBound" is the total number of offsets for the BRX, minus 1. // located on the constant buffer, and "UpperBound" is the total number of offsets for the BRX, minus 1.
HashSet<Block> visited = new(); HashSet<Block> visited = [];
var ldcLocation = FindFirstRegWrite(visited, new BlockLocation(block, block.OpCodes.Count - 1), brxReg); var ldcLocation = FindFirstRegWrite(visited, new BlockLocation(block, block.OpCodes.Count - 1), brxReg);
if (ldcLocation.Block == null || ldcLocation.Block.OpCodes[ldcLocation.Index].Name != InstName.Ldc) if (ldcLocation.Block == null || ldcLocation.Block.OpCodes[ldcLocation.Index].Name != InstName.Ldc)
@ -752,7 +752,7 @@ namespace Ryujinx.Graphics.Shader.Decoders
Block target = blocks[pushOp.GetAbsoluteAddress()]; Block target = blocks[pushOp.GetAbsoluteAddress()];
Stack<PathBlockState> workQueue = new(); Stack<PathBlockState> workQueue = new();
HashSet<Block> visited = new(); HashSet<Block> visited = [];
Stack<(ulong, MergeType)> branchStack = new(); Stack<(ulong, MergeType)> branchStack = new();
void Push(PathBlockState pbs) void Push(PathBlockState pbs)

View file

@ -221,7 +221,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
Operand d = Register(dest, RegisterType.Gpr); Operand d = Register(dest, RegisterType.Gpr);
List<Operand> sourcesList = new(); List<Operand> sourcesList = [];
if (isBindless) if (isBindless)
{ {
@ -328,7 +328,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
return context.Copy(Register(srcA++, RegisterType.Gpr)); return context.Copy(Register(srcA++, RegisterType.Gpr));
} }
List<Operand> sourcesList = new(); List<Operand> sourcesList = [];
if (isBindless) if (isBindless)
{ {
@ -500,7 +500,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
return context.Copy(Register(srcB++, RegisterType.Gpr)); return context.Copy(Register(srcB++, RegisterType.Gpr));
} }
List<Operand> sourcesList = new(); List<Operand> sourcesList = [];
if (isBindless) if (isBindless)
{ {
@ -605,7 +605,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
return context.Copy(Register(srcB++, RegisterType.Gpr)); return context.Copy(Register(srcB++, RegisterType.Gpr));
} }
List<Operand> sourcesList = new(); List<Operand> sourcesList = [];
if (isBindless) if (isBindless)
{ {

View file

@ -34,11 +34,11 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
public BasicBlock() public BasicBlock()
{ {
Operations = new LinkedList<INode>(); Operations = [];
Predecessors = new List<BasicBlock>(); Predecessors = [];
DominanceFrontiers = new HashSet<BasicBlock>(); DominanceFrontiers = [];
} }
public BasicBlock(int index) : this() public BasicBlock(int index) : this()

View file

@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
private Operand() private Operand()
{ {
UseOps = new HashSet<INode>(); UseOps = [];
} }
public Operand(OperandType type) : this() public Operand(OperandType type) : this()

View file

@ -35,9 +35,9 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
public PhiNode(Operand dest) public PhiNode(Operand dest)
{ {
_blocks = new HashSet<BasicBlock>(); _blocks = [];
_sources = new List<PhiSource>(); _sources = [];
dest.AsgOp = this; dest.AsgOp = this;

View file

@ -41,7 +41,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
Type = type; Type = type;
Condition = condition; Condition = condition;
_nodes = new LinkedList<IAstNode>(); _nodes = [];
} }
public void Add(IAstNode node) public void Add(IAstNode node)

View file

@ -17,8 +17,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
private AstOperand() private AstOperand()
{ {
Defs = new HashSet<IAstNode>(); Defs = [];
Uses = new HashSet<IAstNode>(); Uses = [];
VarType = AggregateType.S32; VarType = AggregateType.S32;
} }

View file

@ -429,7 +429,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{ {
AstBlock block = bottom; AstBlock block = bottom;
List<AstBlock> path = new(); List<AstBlock> path = [];
while (block != top) while (block != top)
{ {

View file

@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
InArguments = inArguments; InArguments = inArguments;
OutArguments = outArguments; OutArguments = outArguments;
Locals = new HashSet<AstOperand>(); Locals = [];
} }
public AggregateType GetArgumentType(int index) public AggregateType GetArgumentType(int index)

View file

@ -343,7 +343,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
private static AggregateType GetVarTypeFromUses(Operand dest) private static AggregateType GetVarTypeFromUses(Operand dest)
{ {
HashSet<Operand> visited = new(); HashSet<Operand> visited = [];
Queue<Operand> pending = new(); Queue<Operand> pending = new();

View file

@ -12,9 +12,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
public StructuredProgramInfo() public StructuredProgramInfo()
{ {
Functions = new List<StructuredFunction>(); Functions = [];
IoDefinitions = new HashSet<IoDefinition>(); IoDefinitions = [];
} }
} }
} }

View file

@ -25,8 +25,8 @@ namespace Ryujinx.Graphics.Shader.Translation
{ {
_gpuAccessor = gpuAccessor; _gpuAccessor = gpuAccessor;
UsedInputAttributesPerPatch = new(); UsedInputAttributesPerPatch = [];
UsedOutputAttributesPerPatch = new(); UsedOutputAttributesPerPatch = [];
} }
public void SetInputUserAttribute(int index, int component) public void SetInputUserAttribute(int index, int component)

View file

@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Shader.Translation
{ {
Blocks = blocks; Blocks = blocks;
HashSet<BasicBlock> visited = new(); HashSet<BasicBlock> visited = [];
Stack<BasicBlock> blockStack = new(); Stack<BasicBlock> blockStack = new();
@ -52,7 +52,7 @@ namespace Ryujinx.Graphics.Shader.Translation
{ {
Dictionary<Operand, BasicBlock> labels = new(); Dictionary<Operand, BasicBlock> labels = new();
List<BasicBlock> blocks = new(); List<BasicBlock> blocks = [];
BasicBlock currentBlock = null; BasicBlock currentBlock = null;

View file

@ -128,8 +128,8 @@ namespace Ryujinx.Graphics.Shader.Translation
public static FunctionRegisterUsage RunPass(ControlFlowGraph cfg) public static FunctionRegisterUsage RunPass(ControlFlowGraph cfg)
{ {
List<Register> inArguments = new(); List<Register> inArguments = [];
List<Register> outArguments = new(); List<Register> outArguments = [];
// Compute local register inputs and outputs used inside blocks. // Compute local register inputs and outputs used inside blocks.
RegisterMask[] localInputs = new RegisterMask[cfg.Blocks.Length]; RegisterMask[] localInputs = new RegisterMask[cfg.Blocks.Length];

View file

@ -19,9 +19,9 @@ namespace Ryujinx.Graphics.Vulkan
private readonly NativeArray<BufferMemoryBarrier> _bufferBarrierBatch = new(MaxBarriersPerCall); private readonly NativeArray<BufferMemoryBarrier> _bufferBarrierBatch = new(MaxBarriersPerCall);
private readonly NativeArray<ImageMemoryBarrier> _imageBarrierBatch = new(MaxBarriersPerCall); private readonly NativeArray<ImageMemoryBarrier> _imageBarrierBatch = new(MaxBarriersPerCall);
private readonly List<BarrierWithStageFlags<MemoryBarrier, int>> _memoryBarriers = new(); private readonly List<BarrierWithStageFlags<MemoryBarrier, int>> _memoryBarriers = [];
private readonly List<BarrierWithStageFlags<BufferMemoryBarrier, int>> _bufferBarriers = new(); private readonly List<BarrierWithStageFlags<BufferMemoryBarrier, int>> _bufferBarriers = [];
private readonly List<BarrierWithStageFlags<ImageMemoryBarrier, TextureStorage>> _imageBarriers = new(); private readonly List<BarrierWithStageFlags<ImageMemoryBarrier, TextureStorage>> _imageBarriers = [];
private int _queuedBarrierCount; private int _queuedBarrierCount;
private enum IncoherentBarrierType private enum IncoherentBarrierType

View file

@ -486,7 +486,7 @@ namespace Ryujinx.Graphics.Vulkan
(int keyOffset, int keySize) = FromMirrorKey(key); (int keyOffset, int keySize) = FromMirrorKey(key);
if (!(offset + size <= keyOffset || offset >= keyOffset + keySize)) if (!(offset + size <= keyOffset || offset >= keyOffset + keySize))
{ {
toRemove ??= new List<ulong>(); toRemove ??= [];
toRemove.Add(key); toRemove.Add(key);
} }

View file

@ -249,7 +249,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (entry.DependencyList == null) if (entry.DependencyList == null)
{ {
entry.DependencyList = new List<Dependency>(); entry.DependencyList = [];
entries[i] = entry; entries[i] = entry;
} }
@ -340,7 +340,7 @@ namespace Ryujinx.Graphics.Vulkan
DestroyEntry(entry); DestroyEntry(entry);
} }
(toRemove ??= new List<ulong>()).Add(range.Key); (toRemove ??= []).Add(range.Key);
} }
} }
@ -362,7 +362,7 @@ namespace Ryujinx.Graphics.Vulkan
if (!_ranges.TryGetValue(key, out List<Entry> value)) if (!_ranges.TryGetValue(key, out List<Entry> value))
{ {
value = new List<Entry>(); value = [];
_ranges.Add(key, value); _ranges.Add(key, value);
} }

View file

@ -47,8 +47,8 @@ namespace Ryujinx.Graphics.Vulkan
api.AllocateCommandBuffers(device, in allocateInfo, out CommandBuffer); api.AllocateCommandBuffers(device, in allocateInfo, out CommandBuffer);
Dependants = new List<IAuto>(); Dependants = [];
Waitables = new List<MultiFenceHolder>(); Waitables = [];
} }
} }

View file

@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Vulkan
_hostMemoryApi = hostMemoryApi; _hostMemoryApi = hostMemoryApi;
_device = device; _device = device;
_allocations = new List<HostMemoryAllocation>(); _allocations = [];
_allocationTree = new IntervalTree<ulong, HostMemoryAllocation>(); _allocationTree = new IntervalTree<ulong, HostMemoryAllocation>();
} }

View file

@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Vulkan
public IdList() public IdList()
{ {
_list = new List<T>(); _list = [];
_freeMin = 0; _freeMin = 0;
} }

View file

@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Vulkan
if (storages == null) if (storages == null)
{ {
storages = new HashSet<TextureStorage>(); storages = [];
for (int index = 0; index < _textureRefs.Length; index++) for (int index = 0; index < _textureRefs.Length; index++)
{ {

View file

@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Vulkan
_api = api; _api = api;
_physicalDevice = physicalDevice; _physicalDevice = physicalDevice;
_device = device; _device = device;
_blockLists = new List<MemoryAllocatorBlockList>(); _blockLists = [];
_blockAlignment = (int)Math.Min(int.MaxValue, MaxDeviceMemoryUsageEstimate / _physicalDevice.PhysicalDeviceProperties.Limits.MaxMemoryAllocationCount); _blockAlignment = (int)Math.Min(int.MaxValue, MaxDeviceMemoryUsageEstimate / _physicalDevice.PhysicalDeviceProperties.Limits.MaxMemoryAllocationCount);
_lock = new(LockRecursionPolicy.NoRecursion); _lock = new(LockRecursionPolicy.NoRecursion);
} }

Some files were not shown because too many files have changed in this diff Show more