From 486aaf8e5e3b4de3fb915b201ed0cae26150ae93 Mon Sep 17 00:00:00 2001 From: sunshineinabox Date: Mon, 14 Aug 2023 16:05:48 -0700 Subject: [PATCH] Fix checking and some clean up log if Spir-V is not available --- .../UI/ViewModels/SettingsViewModel.cs | 2 -- src/Ryujinx.Graphics.Gpu/GraphicsConfig.cs | 2 +- .../Shader/ShaderCache.cs | 31 +++++-------------- src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs | 6 ---- 4 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs index 45b118501..ebe26acb0 100644 --- a/src/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx.Ava/UI/ViewModels/SettingsViewModel.cs @@ -112,8 +112,6 @@ namespace Ryujinx.Ava.UI.ViewModels OnPropertyChanged(); } } - - public bool IsOpenGLAvailable => !OperatingSystem.IsMacOS(); diff --git a/src/Ryujinx.Graphics.Gpu/GraphicsConfig.cs b/src/Ryujinx.Graphics.Gpu/GraphicsConfig.cs index f6d24b558..a8bede37c 100644 --- a/src/Ryujinx.Graphics.Gpu/GraphicsConfig.cs +++ b/src/Ryujinx.Graphics.Gpu/GraphicsConfig.cs @@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Gpu public static bool EnableShaderCache; /// - /// Enables or disables color space passthrough, if available. + /// Enables or disables Spir-V on OpenGL. /// public static bool EnableOGLSpirV = false; diff --git a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs index bd72ca1cc..76a2bf218 100644 --- a/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Shader/ShaderCache.cs @@ -101,9 +101,7 @@ namespace Ryujinx.Graphics.Gpu.Shader _programsToSaveQueue = new Queue(); string diskCacheTitleId = GetDiskCachePath(); - - _isSpirVCapable = OpenGlSpirVCapable(); - + _computeShaderCache = new ComputeShaderCacheHashTable(); _graphicsShaderCache = new ShaderCacheHashTable(); _diskCacheHostStorage = new DiskCacheHostStorage(diskCacheTitleId); @@ -157,6 +155,12 @@ namespace Ryujinx.Graphics.Gpu.Shader /// Cancellation token to cancel the shader cache initialization process internal void Initialize(CancellationToken cancellationToken) { + _isSpirVCapable = _context.Capabilities.SupportsSpirV; + if (!_isSpirVCapable) + { + Logger.Warning?.PrintMsg(LogClass.Gpu, $"Spir-V Not Available on OpenGL for your GPU"); + } + if (_diskCacheHostStorage.CacheEnabled) { ParallelDiskCacheLoader loader = new( @@ -720,27 +724,6 @@ namespace Ryujinx.Graphics.Gpu.Shader _ => 0, }; } - - - /// - /// Checks if SpirV is available on OpenGL - /// - /// - /// True or false - /// - private bool OpenGlSpirVCapable() - { - bool spirV = _context.Capabilities.SupportsSpirV; - if (!spirV) - { - Logger.Warning?.PrintMsg(LogClass.Gpu, $"Spir-V Not Available on OpenGL for your GPU"); - } - else - { - Logger.Warning?.PrintMsg(LogClass.Gpu, $"Spir-V !Available! on OpenGL for your GPU"); - } - return spirV; - } /// /// Creates shader translation options with the requested graphics API and flags. diff --git a/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs b/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs index 5636f2713..df12de600 100644 --- a/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs +++ b/src/Ryujinx.Graphics.OpenGL/HwCapabilities.cs @@ -140,10 +140,4 @@ namespace Ryujinx.Graphics.OpenGL return GL.GetError() == ErrorCode.NoError; } } - - public static class HwCapabilitiesFacade - { - public static bool SupportsSpirV => HwCapabilities.SupportsSpirV; - } - }