misc: chore: Use explicit types & fix object creation

This commit is contained in:
KeatonTheBot
2026-05-30 16:26:50 -05:00
parent 9d3fecf334
commit 76a123b81d
454 changed files with 3042 additions and 2961 deletions
+15 -14
View File
@@ -11,6 +11,7 @@ using Silk.NET.Vulkan.Extensions.KHR;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using Format = Ryujinx.Graphics.GAL.Format;
using PrimitiveTopology = Ryujinx.Graphics.GAL.PrimitiveTopology;
@@ -166,7 +167,7 @@ namespace Ryujinx.Graphics.Vulkan
if (maxQueueCount >= 2)
{
Api.GetDeviceQueue(_device, queueFamilyIndex, 1, out var backgroundQueue);
Api.GetDeviceQueue(_device, queueFamilyIndex, 1, out Queue backgroundQueue);
BackgroundQueue = backgroundQueue;
BackgroundQueueLock = new();
}
@@ -334,7 +335,7 @@ namespace Ryujinx.Graphics.Vulkan
Api.GetPhysicalDeviceProperties2(_physicalDevice.PhysicalDevice, &properties2);
Api.GetPhysicalDeviceFeatures2(_physicalDevice.PhysicalDevice, &features2);
var portabilityFlags = PortabilitySubsetFlags.None;
PortabilitySubsetFlags portabilityFlags = PortabilitySubsetFlags.None;
uint vertexBufferAlignment = 1;
if (usePortability)
@@ -351,9 +352,9 @@ namespace Ryujinx.Graphics.Vulkan
featuresCustomBorderColor.CustomBorderColors &&
featuresCustomBorderColor.CustomBorderColorWithoutFormat;
ref var properties = ref properties2.Properties;
ref PhysicalDeviceProperties properties = ref properties2.Properties;
var hasDriverProperties = _physicalDevice.TryGetPhysicalDeviceDriverPropertiesKHR(Api, out var driverProperties);
bool hasDriverProperties = _physicalDevice.TryGetPhysicalDeviceDriverPropertiesKHR(Api, out PhysicalDeviceDriverPropertiesKHR driverProperties);
Vendor = VendorUtils.FromId(properties.VendorID);
@@ -384,7 +385,7 @@ namespace Ryujinx.Graphics.Vulkan
if (Vendor == Vendor.Nvidia)
{
var match = VendorUtils.NvidiaConsumerClassRegex().Match(GpuRenderer);
Match match = VendorUtils.NvidiaConsumerClassRegex().Match(GpuRenderer);
if (match != null && int.TryParse(match.Groups[2].Value, out int gpuNumber))
{
@@ -494,7 +495,7 @@ namespace Ryujinx.Graphics.Vulkan
_surface = _getSurface(_instance.Instance, Api);
_physicalDevice = VulkanInitialization.FindSuitablePhysicalDevice(Api, _instance, _surface, _preferredGpuId);
var queueFamilyIndex = VulkanInitialization.FindSuitableQueueFamily(Api, _physicalDevice, _surface, out uint maxQueueCount);
uint queueFamilyIndex = VulkanInitialization.FindSuitableQueueFamily(Api, _physicalDevice, _surface, out uint maxQueueCount);
_device = VulkanInitialization.CreateDevice(Api, _physicalDevice, queueFamilyIndex, maxQueueCount);
@@ -503,7 +504,7 @@ namespace Ryujinx.Graphics.Vulkan
SwapchainApi = swapchainApi;
}
Api.GetDeviceQueue(_device, queueFamilyIndex, 0, out var queue);
Api.GetDeviceQueue(_device, queueFamilyIndex, 0, out Queue queue);
Queue = queue;
QueueLock = new();
@@ -597,7 +598,7 @@ namespace Ryujinx.Graphics.Vulkan
internal TextureView CreateTextureView(TextureCreateInfo info)
{
// This should be disposed when all views are destroyed.
var storage = CreateTextureStorage(info);
TextureStorage storage = CreateTextureStorage(info);
return storage.CreateView(info, 0, 0);
}
@@ -720,8 +721,8 @@ namespace Ryujinx.Graphics.Vulkan
Api.GetPhysicalDeviceFeatures2(_physicalDevice.PhysicalDevice, &features2);
var limits = _physicalDevice.PhysicalDeviceProperties.Limits;
var mainQueueProperties = _physicalDevice.QueueFamilyProperties[QueueFamilyIndex];
PhysicalDeviceLimits limits = _physicalDevice.PhysicalDeviceProperties.Limits;
QueueFamilyProperties mainQueueProperties = _physicalDevice.QueueFamilyProperties[QueueFamilyIndex];
SystemMemoryType memoryType;
@@ -811,7 +812,7 @@ namespace Ryujinx.Graphics.Vulkan
for (int i = 0; i < memoryProperties.MemoryHeapCount; i++)
{
var heap = memoryProperties.MemoryHeaps[i];
MemoryHeap heap = memoryProperties.MemoryHeaps[i];
if ((heap.Flags & MemoryHeapFlags.DeviceLocalBit) == MemoryHeapFlags.DeviceLocalBit)
{
totalMemory += heap.Size;
@@ -1035,17 +1036,17 @@ namespace Ryujinx.Graphics.Vulkan
MemoryAllocator.Dispose();
foreach (var shader in Shaders)
foreach (ShaderCollection shader in Shaders)
{
shader.Dispose();
}
foreach (var texture in Textures)
foreach (ITexture texture in Textures)
{
texture.Release();
}
foreach (var sampler in Samplers)
foreach (SamplerHolder sampler in Samplers)
{
sampler.Dispose();
}