Automatically switch to SPIR-V if Vulkan is selected

This commit is contained in:
sunshineinabox 2024-02-05 12:51:45 -08:00
parent c77ab1d97f
commit 0b53b418eb
2 changed files with 25 additions and 8 deletions

View file

@ -164,7 +164,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool IsScalingFilterActive => _scalingFilter == (int)Ryujinx.Common.Configuration.ScalingFilter.Fsr; public bool IsScalingFilterActive => _scalingFilter == (int)Ryujinx.Common.Configuration.ScalingFilter.Fsr;
public bool IsVulkanSelected => GraphicsBackendIndex == 0; public bool IsVulkanSelected => GraphicsBackendIndex == 0;
public bool IsSpirVSelected => ShadingLangugeIndex == 0;
public bool IsOGSpirVAvialble => true; public bool IsOGSpirVAvialble => true;
public bool UseHypervisor { get; set; } public bool UseHypervisor { get; set; }
@ -200,7 +200,8 @@ namespace Ryujinx.Ava.UI.ViewModels
_graphicsBackendIndex = value; _graphicsBackendIndex = value;
OnPropertyChanged(); OnPropertyChanged();
OnPropertyChanged(nameof(IsVulkanSelected)); OnPropertyChanged(nameof(IsVulkanSelected));
OnPropertyChanged(nameof(IsOpenGLSelected)); NoGLSLVulkan();
OnPropertyChanged(nameof(ShadingLangugeIndex));
} }
} }
@ -211,13 +212,9 @@ namespace Ryujinx.Ava.UI.ViewModels
{ {
_shadinglanguageBackendIndex = value; _shadinglanguageBackendIndex = value;
OnPropertyChanged(); OnPropertyChanged();
OnPropertyChanged(nameof(IsOpenGLSelected));
} }
} }
public bool IsOpenGLSelected => !IsVulkanSelected;
public int ScalingFilter public int ScalingFilter
{ {
get => _scalingFilter; get => _scalingFilter;
@ -334,6 +331,16 @@ namespace Ryujinx.Ava.UI.ViewModels
}); });
} }
public async Task NoGLSLVulkan()
{
if (IsVulkanSelected & ShadingLangugeIndex == 1 || IsVulkanSelected & _shadinglanguageBackendIndex == 1)
{
_shadinglanguageBackendIndex = 0;
ShadingLangugeIndex = 0;
}
}
private async Task LoadAvailableGpus() private async Task LoadAvailableGpus()
{ {
AvailableGpus.Clear(); AvailableGpus.Clear();
@ -409,6 +416,15 @@ namespace Ryujinx.Ava.UI.ViewModels
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(NetworkInterfaceIndex))); Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(NetworkInterfaceIndex)));
} }
private async Task NoGLSLVUlkan()
{
if (_graphicsBackendIndex == 0)
{
_shadinglanguageBackendIndex = 0;
}
}
public void ValidateAndSetTimeZone(string location) public void ValidateAndSetTimeZone(string location)
{ {
if (_validTzRegions.Contains(location)) if (_validTzRegions.Contains(location))

View file

@ -64,11 +64,12 @@
<ComboBox Width="350" <ComboBox Width="350"
HorizontalContentAlignment="Left" HorizontalContentAlignment="Left"
ToolTip.Tip="{locale:Locale ShadingLanguageTooltip}" ToolTip.Tip="{locale:Locale ShadingLanguageTooltip}"
SelectedIndex="{Binding ShadingLangugeIndex}"> SelectedIndex="{Binding ShadingLangugeIndex}"
AutoScrollToSelectedItem="True">
<ComboBoxItem IsEnabled="{Binding IsOGSpirVAvialble}"> <ComboBoxItem IsEnabled="{Binding IsOGSpirVAvialble}">
<TextBlock Text="SPIR-V" /> <TextBlock Text="SPIR-V" />
</ComboBoxItem> </ComboBoxItem>
<ComboBoxItem IsEnabled="{Binding IsOpenGLSelected}"> <ComboBoxItem IsEnabled="{Binding !IsVulkanSelected}">
<TextBlock Text="GLSL" /> <TextBlock Text="GLSL" />
</ComboBoxItem> </ComboBoxItem>
</ComboBox> </ComboBox>