From c10d601ce8d2a6ca7e354772a217a998cd9865b3 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 20 Sep 2021 13:19:20 +0100
Subject: [PATCH] SL-15999 - track --noninteractive state with gNonInteractive
 flag

---
 indra/llrender/llgl.cpp              | 1 +
 indra/llrender/llgl.h                | 1 +
 indra/newview/llappviewer.cpp        | 4 ++--
 indra/newview/llviewermedia.cpp      | 2 +-
 indra/newview/llviewerobject.cpp     | 7 +++----
 indra/newview/llviewerobjectlist.cpp | 3 +--
 indra/newview/pipeline.cpp           | 3 +--
 7 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 43fedeca640..fe399ad8820 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -62,6 +62,7 @@
 BOOL gDebugSession = FALSE;
 BOOL gClothRipple = FALSE;
 BOOL gHeadlessClient = FALSE;
+BOOL gNonInteractive = FALSE;
 BOOL gGLActive = FALSE;
 BOOL gGLDebugLoggingEnabled = TRUE;
 
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index a07e2d9bb02..53d077b9946 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -488,6 +488,7 @@ void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor
 
 extern BOOL gClothRipple;
 extern BOOL gHeadlessClient;
+extern BOOL gNonInteractive;
 extern BOOL gGLActive;
 
 // Deal with changing glext.h definitions for newer SDK versions, specifically
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 6ff9b2b2eb9..970bc0a83df 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1557,8 +1557,7 @@ bool LLAppViewer::doFrame()
 				ms_sleep(yield_time);
 			}
 
-			static LLCachedControl<bool> s_non_interactive(gSavedSettings, "NonInteractive", false);
-			if (s_non_interactive)
+			if (gNonInteractive)
 			{
 				S32 non_interactive_ms_sleep_time = 1000;
 				LLAppViewer::getTextureCache()->pause();
@@ -2979,6 +2978,7 @@ bool LLAppViewer::initWindow()
 
 	// store setting in a global for easy access and modification
 	gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient");
+	gNonInteractive = gSavedSettings.getBOOL("NonInteractive");
 
 	// always start windowed
 	BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth");
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 82152a6cf50..8064e998f1c 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1687,7 +1687,7 @@ void LLViewerMediaImpl::setMediaType(const std::string& media_type)
 /*static*/
 LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height, F64 zoom_factor, const std::string target, bool clean_browser)
 {
-    if (gSavedSettings.getBOOL("NonInteractive"))
+	if (gNonInteractive)
     {
         return NULL;
     }
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 1852d4980ff..528448c4774 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -107,6 +107,7 @@
 #include "llcleanup.h"
 #include "llcallstack.h"
 #include "llmeshrepository.h"
+#include "llgl.h"
 
 //#define DEBUG_UPDATE_TYPE
 
@@ -153,8 +154,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
     LL_DEBUGS("ObjectUpdate") << "creating " << id << LL_ENDL;
     dumpStack("ObjectUpdateStack");
     
-	static LLCachedControl<bool> s_non_interactive(gSavedSettings, "NonInteractive", false);
-	
 	LLViewerObject *res = NULL;
 	LL_RECORD_BLOCK_TIME(FTM_CREATE_OBJECT);
 	
@@ -162,7 +161,7 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
 	{
 	case LL_PCODE_VOLUME:
 	{
-		if (!s_non_interactive)
+		if (!gNonInteractive)
 		{
 			res = new LLVOVolume(id, pcode, regionp); break;
 		}
@@ -201,7 +200,7 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
         }
 		else
 		{
-			if (!s_non_interactive)
+			if (!gNonInteractive)
 			{
 				LLVOAvatar *avatar = new LLVOAvatar(id, pcode, regionp); 
 				avatar->initInstance();
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 9fe80b38d64..fbd44c198b1 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -304,10 +304,9 @@ static LLTrace::BlockTimerStatHandle FTM_PROCESS_OBJECTS("Process Objects");
 
 LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* entry, LLViewerRegion* regionp)
 {
-	static LLCachedControl<bool> s_non_interactive(gSavedSettings, "NonInteractive", false);
 	LLDataPacker *cached_dpp = entry->getDP();
 
-	if (!cached_dpp || s_non_interactive)
+	if (!cached_dpp || gNonInteractive)
 	{
 		return NULL; //nothing cached.
 	}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 43ae0c2e763..30703426ce0 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1158,8 +1158,7 @@ void LLPipeline::refreshCachedSettings()
 	RenderSpotLight = nullptr;
 	updateRenderDeferred();
 
-	bool non_interactive = gSavedSettings.getBOOL("NonInteractive");
-	if (non_interactive)
+	if (gNonInteractive)
 	{
 		LLVOAvatar::sMaxNonImpostors = 1;
 		LLVOAvatar::updateImpostorRendering(LLVOAvatar::sMaxNonImpostors);
-- 
GitLab