Make checkbox conditional

This commit is contained in:
sunshineinabox 2023-08-14 13:34:27 -07:00
parent ef9f05bdbc
commit 1e50368a30
3 changed files with 18 additions and 3 deletions

View file

@ -25,6 +25,7 @@ using System.Net.NetworkInformation;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using TimeZone = Ryujinx.Ava.UI.Models.TimeZone; using TimeZone = Ryujinx.Ava.UI.Models.TimeZone;
using Ryujinx.Graphics.OpenGL;
namespace Ryujinx.Ava.UI.ViewModels namespace Ryujinx.Ava.UI.ViewModels
{ {
@ -112,6 +113,8 @@ namespace Ryujinx.Ava.UI.ViewModels
} }
} }
public bool IsOpenGLAvailable => !OperatingSystem.IsMacOS(); public bool IsOpenGLAvailable => !OperatingSystem.IsMacOS();
public bool IsHypervisorAvailable => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64; public bool IsHypervisorAvailable => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64;
@ -212,11 +215,17 @@ namespace Ryujinx.Ava.UI.ViewModels
_graphicsBackendIndex = value; _graphicsBackendIndex = value;
OnPropertyChanged(); OnPropertyChanged();
OnPropertyChanged(nameof(IsVulkanSelected)); OnPropertyChanged(nameof(IsVulkanSelected));
OnPropertyChanged(nameof(IsOGLSelected)); OnPropertyChanged(nameof(IsSpirVAvailable));
} }
} }
public bool IsOGLSelected => !IsVulkanSelected; public bool SpirVCapability()
{
bool isSpirVSupported = HwCapabilitiesFacade.SupportsSpirV;
return isSpirVSupported;
}
public bool IsSpirVAvailable => !IsVulkanSelected && SpirVCapability();
public int ScalingFilter public int ScalingFilter
{ {

View file

@ -64,7 +64,7 @@
ToolTip.Tip="{locale:Locale ShaderCacheToggleTooltip}"> ToolTip.Tip="{locale:Locale ShaderCacheToggleTooltip}">
<TextBlock Text="{locale:Locale SettingsTabGraphicsEnableShaderCache}" /> <TextBlock Text="{locale:Locale SettingsTabGraphicsEnableShaderCache}" />
</CheckBox> </CheckBox>
<CheckBox IsChecked="{Binding EnableOGLSpirV}" IsVisible="{Binding IsOGLSelected}" <CheckBox IsChecked="{Binding EnableOGLSpirV}" IsVisible="{Binding IsSpirVAvailable}"
ToolTip.Tip="{locale:Locale OGLSpirVTooltip}"> ToolTip.Tip="{locale:Locale OGLSpirVTooltip}">
<TextBlock Text="{locale:Locale SettingsTabGraphicsEnableOGLSpirV}" /> <TextBlock Text="{locale:Locale SettingsTabGraphicsEnableOGLSpirV}" />
</CheckBox> </CheckBox>

View file

@ -140,4 +140,10 @@ namespace Ryujinx.Graphics.OpenGL
return GL.GetError() == ErrorCode.NoError; return GL.GetError() == ErrorCode.NoError;
} }
} }
public static class HwCapabilitiesFacade
{
public static bool SupportsSpirV => HwCapabilities.SupportsSpirV;
}
} }