Keep OGL threading specific path and adjust warning to info log.

This commit is contained in:
MutantAura 2024-04-25 18:00:49 +01:00
parent 7e3f6af6c6
commit 811c2651f2
5 changed files with 13 additions and 11 deletions

View file

@ -6,21 +6,23 @@ namespace Ryujinx.Common.GraphicsDriver
{ {
public static class DriverUtilities public static class DriverUtilities
{ {
public static void ToggleOglThreading(bool enabled)
{
Environment.SetEnvironmentVariable("mesa_glthread", enabled.ToString().ToLower());
Environment.SetEnvironmentVariable("__GL_THREADED_OPTIMIZATIONS", enabled ? "1" : "0");
ToggleNvDriverSetting(NvapiSettingId.OglThreadControlId, enabled);
}
public static void ToggleNvDriverSetting(NvapiSettingId id, bool enabled) public static void ToggleNvDriverSetting(NvapiSettingId id, bool enabled)
{ {
try try
{ {
if (id == NvapiSettingId.OglThreadControlId)
{
Environment.SetEnvironmentVariable("mesa_glthread", enabled.ToString().ToLower());
Environment.SetEnvironmentVariable("__GL_THREADED_OPTIMIZATIONS", enabled ? "1" : "0");
}
NVDriverHelper.SetControlOption(id, enabled); NVDriverHelper.SetControlOption(id, enabled);
} }
catch catch
{ {
Logger.Warning?.Print(LogClass.Application, "Failed to set NVIDIA driver settings. NVAPI may be unavailable."); Logger.Info?.Print(LogClass.Application, "NVAPI was unreachable, no changes were made.");
} }
} }
} }

View file

@ -236,7 +236,7 @@ namespace Ryujinx
// Enable OGL multithreading on the driver, when available. // Enable OGL multithreading on the driver, when available.
BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading; BackendThreading threadingMode = ConfigurationState.Instance.Graphics.BackendThreading;
DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglThreadControlId, threadingMode == BackendThreading.Off); DriverUtilities.ToggleOglThreading(threadingMode == BackendThreading.Off);
// Enable DXGI present mode on the driver, when available. // Enable DXGI present mode on the driver, when available.
DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglCplPreferDxPresentId, true); DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglCplPreferDxPresentId, true);

View file

@ -611,7 +611,7 @@ namespace Ryujinx.UI.Windows
BackendThreading backendThreading = Enum.Parse<BackendThreading>(_galThreading.ActiveId); BackendThreading backendThreading = Enum.Parse<BackendThreading>(_galThreading.ActiveId);
if (ConfigurationState.Instance.Graphics.BackendThreading != backendThreading) if (ConfigurationState.Instance.Graphics.BackendThreading != backendThreading)
{ {
DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglThreadControlId, backendThreading == BackendThreading.Off); DriverUtilities.ToggleOglThreading(backendThreading == BackendThreading.Off);
} }
ConfigurationState.Instance.Logger.EnableError.Value = _errorLogToggle.Active; ConfigurationState.Instance.Logger.EnableError.Value = _errorLogToggle.Active;

View file

@ -113,7 +113,7 @@ namespace Ryujinx.Ava
PrintSystemInfo(); PrintSystemInfo();
// Enable OGL multithreading on the driver, when available. // Enable OGL multithreading on the driver, when available.
DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglThreadControlId, ConfigurationState.Instance.Graphics.BackendThreading == BackendThreading.Off); DriverUtilities.ToggleOglThreading(ConfigurationState.Instance.Graphics.BackendThreading == BackendThreading.Off);
// Enable Dxgi present on the driver, when available. // Enable Dxgi present on the driver, when available.
DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglCplPreferDxPresentId, true); DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglCplPreferDxPresentId, true);

View file

@ -530,7 +530,7 @@ namespace Ryujinx.Ava.UI.ViewModels
if (ConfigurationState.Instance.Graphics.BackendThreading != (BackendThreading)GraphicsBackendMultithreadingIndex) if (ConfigurationState.Instance.Graphics.BackendThreading != (BackendThreading)GraphicsBackendMultithreadingIndex)
{ {
DriverUtilities.ToggleNvDriverSetting(NvapiSettingId.OglThreadControlId, GraphicsBackendMultithreadingIndex == (int)BackendThreading.Off); DriverUtilities.ToggleOglThreading(GraphicsBackendMultithreadingIndex == (int)BackendThreading.Off);
} }
config.Graphics.BackendThreading.Value = (BackendThreading)GraphicsBackendMultithreadingIndex; config.Graphics.BackendThreading.Value = (BackendThreading)GraphicsBackendMultithreadingIndex;