From c43336d5ed211ab77f2dc12b6cb7442d7544a2f7 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 27 Jan 2023 01:33:11 +0200 Subject: SL-18930 Update Autotune panel --- indra/newview/llviewercontrol.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewercontrol.cpp') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 0bade93c45..50d48987ed 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -270,6 +270,12 @@ static bool handleVSyncChanged(const LLSD& newvalue) LLPerfStats::tunables.vsyncEnabled = newvalue.asBoolean(); gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean()); + if(newvalue.asBoolean() == true) + { + U32 current_target = gSavedSettings.getU32("TargetFPS"); + gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target)); + } + return true; } @@ -649,13 +655,24 @@ void handleRenderAutoMuteByteLimitChanged(const LLSD& new_value); void handleTargetFPSChanged(const LLSD& newValue) { const auto targetFPS = gSavedSettings.getU32("TargetFPS"); - LLPerfStats::tunables.userTargetFPS = targetFPS; + + U32 frame_rate_limit = gViewerWindow->getWindow()->getRefreshRate(); + if(LLPerfStats::tunables.vsyncEnabled && (targetFPS > frame_rate_limit)) + { + gSavedSettings.setU32("TargetFPS", std::min(frame_rate_limit, targetFPS)); + } + else + { + LLPerfStats::tunables.userTargetFPS = targetFPS; + } } void handleAutoTuneLockChanged(const LLSD& newValue) { const auto newval = gSavedSettings.getBOOL("AutoTuneLock"); LLPerfStats::tunables.userAutoTuneLock = newval; + + gSavedSettings.setBOOL("AutoTuneFPS", newval); } void handleAutoTuneFPSChanged(const LLSD& newValue) -- cgit v1.3