diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /Ryujinx.Graphics.Vulkan/VulkanPhysicalDevice.cs | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/VulkanPhysicalDevice.cs')
| -rw-r--r-- | Ryujinx.Graphics.Vulkan/VulkanPhysicalDevice.cs | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/Ryujinx.Graphics.Vulkan/VulkanPhysicalDevice.cs b/Ryujinx.Graphics.Vulkan/VulkanPhysicalDevice.cs deleted file mode 100644 index 547f3654..00000000 --- a/Ryujinx.Graphics.Vulkan/VulkanPhysicalDevice.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Ryujinx.Common.Utilities; -using Ryujinx.Graphics.GAL; -using Silk.NET.Vulkan; -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Runtime.InteropServices; - -namespace Ryujinx.Graphics.Vulkan -{ - readonly struct VulkanPhysicalDevice - { - public readonly PhysicalDevice PhysicalDevice; - public readonly PhysicalDeviceFeatures PhysicalDeviceFeatures; - public readonly PhysicalDeviceProperties PhysicalDeviceProperties; - public readonly PhysicalDeviceMemoryProperties PhysicalDeviceMemoryProperties; - public readonly QueueFamilyProperties[] QueueFamilyProperties; - public readonly string DeviceName; - public readonly IReadOnlySet<string> DeviceExtensions; - - public VulkanPhysicalDevice(Vk api, PhysicalDevice physicalDevice) - { - PhysicalDevice = physicalDevice; - PhysicalDeviceFeatures = api.GetPhysicalDeviceFeature(PhysicalDevice); - - api.GetPhysicalDeviceProperties(PhysicalDevice, out var physicalDeviceProperties); - PhysicalDeviceProperties = physicalDeviceProperties; - - api.GetPhysicalDeviceMemoryProperties(PhysicalDevice, out PhysicalDeviceMemoryProperties); - - unsafe - { - DeviceName = Marshal.PtrToStringAnsi((IntPtr)physicalDeviceProperties.DeviceName); - } - - uint propertiesCount = 0; - - api.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, SpanHelpers.AsSpan(ref propertiesCount), Span<QueueFamilyProperties>.Empty); - - QueueFamilyProperties = new QueueFamilyProperties[propertiesCount]; - - api.GetPhysicalDeviceQueueFamilyProperties(physicalDevice, SpanHelpers.AsSpan(ref propertiesCount), QueueFamilyProperties); - - api.EnumerateDeviceExtensionProperties(PhysicalDevice, Span<byte>.Empty, SpanHelpers.AsSpan(ref propertiesCount), Span<ExtensionProperties>.Empty).ThrowOnError(); - - ExtensionProperties[] extensionProperties = new ExtensionProperties[propertiesCount]; - - api.EnumerateDeviceExtensionProperties(PhysicalDevice, Span<byte>.Empty, SpanHelpers.AsSpan(ref propertiesCount), extensionProperties).ThrowOnError(); - - unsafe - { - DeviceExtensions = extensionProperties.Select(x => Marshal.PtrToStringAnsi((IntPtr)x.ExtensionName)).ToImmutableHashSet(); - } - } - - public string Id => $"0x{PhysicalDeviceProperties.VendorID:X}_0x{PhysicalDeviceProperties.DeviceID:X}"; - - public bool IsDeviceExtensionPresent(string extension) => DeviceExtensions.Contains(extension); - - public DeviceInfo ToDeviceInfo() - { - return new DeviceInfo( - Id, - VendorUtils.GetNameFromId(PhysicalDeviceProperties.VendorID), - DeviceName, - PhysicalDeviceProperties.DeviceType == PhysicalDeviceType.DiscreteGpu); - } - } -} |
