From 4ab77cdb60465d655a05cf7f1e9de73867284ac1 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Thu, 16 Sep 2021 18:39:02 +0100
Subject: [PATCH] SL-15999 - throttle frame rate even more when noninteractive

---
 indra/newview/llappviewer.cpp |  9 +++++++++
 indra/newview/pipeline.cpp    | 11 +++++++++++
 2 files changed, 20 insertions(+)

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 891722e1bd1..6ff9b2b2eb9 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1557,6 +1557,15 @@ bool LLAppViewer::doFrame()
 				ms_sleep(yield_time);
 			}
 
+			static LLCachedControl<bool> s_non_interactive(gSavedSettings, "NonInteractive", false);
+			if (s_non_interactive)
+			{
+				S32 non_interactive_ms_sleep_time = 1000;
+				LLAppViewer::getTextureCache()->pause();
+				LLAppViewer::getImageDecodeThread()->pause();
+				ms_sleep(non_interactive_ms_sleep_time);
+			}
+
 			// yield cooperatively when not running as foreground window
 			// and when not quiting (causes trouble at mac's cleanup stage)
 			if (!LLApp::isExiting()
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index cd1b9c7c694..6d2eafd7c00 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -487,6 +487,10 @@ void LLPipeline::init()
 	{
 		clearAllRenderTypes();
 	}
+	else if (gSavedSettings.getBOOL("NonInteractive"))
+	{
+		clearAllRenderTypes();
+	}
 	else
 	{
 		setAllRenderTypes(); // By default, all rendering types start enabled
@@ -1153,6 +1157,13 @@ void LLPipeline::refreshCachedSettings()
 	RenderAutoHideSurfaceAreaLimit = gSavedSettings.getF32("RenderAutoHideSurfaceAreaLimit");
 	RenderSpotLight = nullptr;
 	updateRenderDeferred();
+
+	bool non_interactive = gSavedSettings.getBOOL("NonInteractive");
+	if (non_interactive)
+	{
+		LLVOAvatar::sMaxNonImpostors = 1;
+		LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
+	}
 }
 
 void LLPipeline::releaseGLBuffers()
-- 
GitLab