1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:47:46 +08:00

Change threaded optimisations setting to "Auto" on startup

This commit is contained in:
Dean Herbert 2024-01-03 15:37:24 +09:00
parent 9e8d07d314
commit d38f8d9c78
No known key found for this signature in database
2 changed files with 10 additions and 7 deletions

View File

@ -153,30 +153,30 @@ namespace osu.Desktop
}
}
public static bool ThreadedOptimisations
public static NvThreadControlSetting ThreadedOptimisations
{
get
{
if (!Available)
return false;
return NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;
IntPtr profileHandle;
if (!getProfile(out profileHandle, out _, out bool _))
return false;
return NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;
// Get the threaded optimisations setting
NvSetting setting;
if (!getSetting(NvSettingID.OGL_THREAD_CONTROL_ID, profileHandle, out setting))
return false;
return NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;
return setting.U32CurrentValue != (uint)NvThreadControlSetting.OGL_THREAD_CONTROL_DISABLE;
return (NvThreadControlSetting)setting.U32CurrentValue;
}
set
{
if (!Available)
return;
bool success = setSetting(NvSettingID.OGL_THREAD_CONTROL_ID, (uint)(value ? NvThreadControlSetting.OGL_THREAD_CONTROL_ENABLE : NvThreadControlSetting.OGL_THREAD_CONTROL_DISABLE));
bool success = setSetting(NvSettingID.OGL_THREAD_CONTROL_ID, (uint)value);
Logger.Log(success ? $"Threaded optimizations set to \"{value}\"!" : "Threaded optimizations set failed!");
}

View File

@ -30,7 +30,10 @@ namespace osu.Desktop
[STAThread]
public static void Main(string[] args)
{
NVAPI.ThreadedOptimisations = true;
// NVIDIA profiles are based on the executable name of a process.
// Lazer and stable share the same executable name.
// Stable sets this setting to "Off", which may not be what we want, so let's force it back to the default "Auto" on startup.
NVAPI.ThreadedOptimisations = NvThreadControlSetting.OGL_THREAD_CONTROL_DEFAULT;
// run Squirrel first, as the app may exit after these run
if (OperatingSystem.IsWindows())