mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-19 07:43:35 +00:00
Use selected gpu from config for avalonia (#7)
* use configured device * address review
This commit is contained in:
parent
0860e208b2
commit
002bfc65ae
4 changed files with 6 additions and 5 deletions
|
@ -97,6 +97,7 @@ namespace Ryujinx.Ava
|
|||
VulkanVersion = new Version(1, 2),
|
||||
MaxQueueCount = 2,
|
||||
PreferDiscreteGpu = true,
|
||||
PreferredDevice = !PreviewerDetached ? "" : ConfigurationState.Instance.Graphics.PreferredGpu.Value,
|
||||
UseDebug = !PreviewerDetached ? false : ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value != GraphicsDebugLevel.None,
|
||||
})
|
||||
.With(new SkiaOptions()
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||
/// <summary>
|
||||
/// Sets the device to use if available and suitable.
|
||||
/// </summary>
|
||||
public uint? PreferredDevice { get; set; }
|
||||
public string PreferredDevice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Max number of device queues to request
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||
public Version ApiVersion { get; }
|
||||
|
||||
internal static unsafe VulkanPhysicalDevice FindSuitablePhysicalDevice(VulkanInstance instance,
|
||||
VulkanSurface surface, bool preferDiscreteGpu, uint? preferredDevice)
|
||||
VulkanSurface surface, bool preferDiscreteGpu, string preferredDevice)
|
||||
{
|
||||
uint physicalDeviceCount;
|
||||
|
||||
|
@ -58,9 +58,9 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||
physicalDeviceProperties.Add(physicalDevice, properties);
|
||||
}
|
||||
|
||||
if (preferredDevice.HasValue && preferredDevice != 0)
|
||||
if (!string.IsNullOrWhiteSpace(preferredDevice))
|
||||
{
|
||||
var physicalDevice = physicalDeviceProperties.FirstOrDefault(x => x.Value.DeviceID == preferredDevice);
|
||||
var physicalDevice = physicalDeviceProperties.FirstOrDefault(x => VulkanInitialization.StringFromIdPair(x.Value.VendorID, x.Value.DeviceID) == preferredDevice);
|
||||
if (physicalDevice.Key.Handle != 0 && IsSuitableDevice(instance.Api, physicalDevice.Key,
|
||||
physicalDevice.Value, surface.ApiHandle, out var queueCount,
|
||||
out var queueFamilyIndex))
|
||||
|
|
|
@ -280,7 +280,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
return devices;
|
||||
}
|
||||
|
||||
private static string StringFromIdPair(uint vendorId, uint deviceId)
|
||||
public static string StringFromIdPair(uint vendorId, uint deviceId)
|
||||
{
|
||||
return $"0x{vendorId:X}_0x{deviceId:X}";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue