diff options
author | Emmanuel Hansen <emmausssss@gmail.com> | 2022-08-16 16:32:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 16:32:37 +0000 |
commit | c8f9292babd5aa6021ce1bd6a977130baebb7de3 (patch) | |
tree | e6e62d79d08726129485476078732f9b89f6ab5c /Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs | |
parent | 0ec933a6152ebb7724da1e3a05a5ae1c2ea07b2f (diff) |
Avalonia - Couple fixes and improvements to vulkan (#3483)1.1.219
* drop split devices, rebase
* add fallback to opengl if vulkan is not available
* addressed review
* ensure present image references are incremented and decremented when necessary
* allow changing vsync for vulkan
* fix screenshot on avalonia vulkan
* save favorite when toggled
* improve sync between popups
* use separate devices for each new window
* fix crash when closing window
* addressed review
* don't create the main window with immediate mode
* change skia vk delegate to method
* update vulkan throwonerror
* addressed review
Diffstat (limited to 'Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs')
-rw-r--r-- | Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs b/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs index 7b08923e..a7cf710e 100644 --- a/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs +++ b/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs @@ -48,6 +48,10 @@ namespace Ryujinx.Ava.Ui.ViewModels private int _graphicsBackendMultithreadingIndex; private float _previousVolumeLevel; private float _volume; + private bool _isVulkanAvailable = true; + private List<string> _gpuIds = new List<string>(); + private KeyboardHotkeys _keyboardHotkeys; + private int _graphicsBackendIndex; public int ResolutionScale { @@ -97,6 +101,17 @@ namespace Ryujinx.Ava.Ui.ViewModels } } + public bool IsVulkanAvailable + { + get => _isVulkanAvailable; + set + { + _isVulkanAvailable = value; + + OnPropertyChanged(); + } + } + public bool EnableDiscordIntegration { get; set; } public bool CheckUpdatesOnStart { get; set; } public bool ShowConfirmExit { get; set; } @@ -143,10 +158,10 @@ namespace Ryujinx.Ava.Ui.ViewModels public int BaseStyleIndex { get; set; } public int GraphicsBackendIndex { - get => graphicsBackendIndex; + get => _graphicsBackendIndex; set { - graphicsBackendIndex = value; + _graphicsBackendIndex = value; OnPropertyChanged(); OnPropertyChanged(nameof(IsVulkanSelected)); } @@ -170,14 +185,9 @@ namespace Ryujinx.Ava.Ui.ViewModels public DateTimeOffset DateOffset { get; set; } public TimeSpan TimeOffset { get; set; } public AvaloniaList<TimeZone> TimeZones { get; set; } - public AvaloniaList<string> GameDirectories { get; set; } public ObservableCollection<ComboBoxItem> AvailableGpus { get; set; } - private KeyboardHotkeys _keyboardHotkeys; - private int graphicsBackendIndex; - private List<string> _gpuIds = new List<string>(); - public KeyboardHotkeys KeyboardHotkeys { get => _keyboardHotkeys; @@ -233,20 +243,31 @@ namespace Ryujinx.Ava.Ui.ViewModels if (!Program.UseVulkan) { var devices = VulkanRenderer.GetPhysicalDevices(); - foreach (var device in devices) + + if (devices.Length == 0) { - _gpuIds.Add(device.Id); - names.Add($"{device.Name} {(device.IsDiscrete ? "(dGpu)" : "")}"); + IsVulkanAvailable = false; + GraphicsBackendIndex = 1; + } + else + { + foreach (var device in devices) + { + _gpuIds.Add(device.Id); + names.Add($"{device.Name} {(device.IsDiscrete ? "(dGPU)" : "")}"); + } } } else { foreach (var device in VulkanPhysicalDevice.SuitableDevices) { - _gpuIds.Add(VulkanInitialization.StringFromIdPair(device.Value.VendorID, device.Value.DeviceID)); + _gpuIds.Add( + VulkanInitialization.StringFromIdPair(device.Value.VendorID, device.Value.DeviceID)); var value = device.Value; var name = value.DeviceName; - names.Add($"{Marshal.PtrToStringAnsi((IntPtr)name)} {(device.Value.DeviceType == PhysicalDeviceType.DiscreteGpu ? "(dGpu)" : "")}"); + names.Add( + $"{Marshal.PtrToStringAnsi((IntPtr)name)} {(device.Value.DeviceType == PhysicalDeviceType.DiscreteGpu ? "(dGPU)" : "")}"); } } |