diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-08-29 00:03:07 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-08-29 19:56:04 +0300 |
commit | 479fee984a595cab4fad0aae9157c5e168da692f (patch) | |
tree | ec28f6b279045439d5eb703e306bd78462120608 | |
parent | e23aa060494ea1ae8f01033177ec10c333f01b30 (diff) |
#4604 Warn user off high settings when on low-RAM hardware
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 11 |
3 files changed, 40 insertions, 0 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index b74736a39d..291f22d78f 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -758,6 +758,7 @@ void LLFloaterPreference::onOpen(const LLSD& key) // Forget previous language changes. mLanguageChanged = false; + mLastQualityLevel = gSavedSettings.getU32("RenderQualityPerformance"); // Display selected maturity icons. onChangeMaturity(); @@ -1327,6 +1328,33 @@ void LLFloaterPreference::onCommitWindowedMode() void LLFloaterPreference::onChangeQuality(const LLSD& data) { U32 level = (U32)(data.asReal()); + constexpr U32 LVL_HIGH = 4; + if (level >= LVL_HIGH && mLastQualityLevel < level) + { + constexpr U32 LOW_MEM_THRESHOLD = 4097; + U32 total_mem = (U32Megabytes)LLMemory::getMaxMemKB(); + if (total_mem < LOW_MEM_THRESHOLD) + { + LLSD args; + args["TOTAL_MEM"] = LLSD::Integer(total_mem); + LLNotificationsUtil::add("PreferenceQualityWithLowMemory", args, LLSD(), [this](const LLSD& notification, const LLSD& response) + { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + // If cancel pressed + if (option == 1) + { + constexpr U32 LVL_MED_PLUS = 3; + gSavedSettings.setU32("RenderQualityPerformance", LVL_MED_PLUS); + mLastQualityLevel = LVL_MED_PLUS; + LLFeatureManager::getInstance()->setGraphicsLevel(LVL_MED_PLUS, true); + refreshEnabledGraphics(); + refresh(); + } + } + ); + } + } + mLastQualityLevel = level; LLFeatureManager::getInstance()->setGraphicsLevel(level, true); refreshEnabledGraphics(); refresh(); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index fa9c421a8f..61ac0a4d77 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -218,6 +218,7 @@ private: bool mGotPersonalInfo; bool mLanguageChanged; bool mAvatarDataInitialized; + U32 mLastQualityLevel = 0; std::string mPriorInstantMessageLogPath; bool mOriginalHideOnlineStatus; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index b182a241d8..7fc96af55d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -12147,6 +12147,17 @@ Cannot create large prims that intersect other residents. Please re-try when ot <notification icon="alertmodal.tga" + name="PreferenceQualityWithLowMemory" + type="alert"> +Your system has [TOTAL_MEM]MB of memory, which might not be enough to run viewer at higher settings and might result in issues. + <usetemplate + name="okcancelbuttons" + notext="Cancel" + yestext="Continue"/> + </notification> + + <notification + icon="alertmodal.tga" name="DefaultObjectPermissions" type="alert"> There was a problem saving the default object permissions: [REASON]. Please try setting the default permissions later. |