Skip to content

Commit eab4a57

Browse files
committed
#4604 Warn user off high settings when on low-RAM hardware
1 parent 75b0d09 commit eab4a57

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

indra/newview/llfloaterpreference.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ void LLFloaterPreference::onOpen(const LLSD& key)
758758

759759
// Forget previous language changes.
760760
mLanguageChanged = false;
761+
mLastQualityLevel = gSavedSettings.getU32("RenderQualityPerformance");
761762

762763
// Display selected maturity icons.
763764
onChangeMaturity();
@@ -1327,6 +1328,33 @@ void LLFloaterPreference::onCommitWindowedMode()
13271328
void LLFloaterPreference::onChangeQuality(const LLSD& data)
13281329
{
13291330
U32 level = (U32)(data.asReal());
1331+
constexpr U32 LVL_HIGH = 4;
1332+
if (level >= LVL_HIGH && mLastQualityLevel < level)
1333+
{
1334+
constexpr U32 LOW_MEM_TRESHOLD = 4097;
1335+
U32 total_mem = (U32Megabytes)LLMemory::getMaxMemKB();
1336+
if (total_mem < LOW_MEM_TRESHOLD)
1337+
{
1338+
LLSD args;
1339+
args["TOTAL_MEM"] = LLSD::Integer(total_mem);
1340+
LLNotificationsUtil::add("PreferenceQualityWithLowMemory", args, LLSD(), [this](const LLSD& notification, const LLSD& response)
1341+
{
1342+
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
1343+
// If cancel pressed
1344+
if (option == 1)
1345+
{
1346+
constexpr U32 LVL_MED_PLUS = 3;
1347+
gSavedSettings.setU32("RenderQualityPerformance", LVL_MED_PLUS);
1348+
mLastQualityLevel = LVL_MED_PLUS;
1349+
LLFeatureManager::getInstance()->setGraphicsLevel(LVL_MED_PLUS, true);
1350+
refreshEnabledGraphics();
1351+
refresh();
1352+
}
1353+
}
1354+
);
1355+
}
1356+
}
1357+
mLastQualityLevel = level;
13301358
LLFeatureManager::getInstance()->setGraphicsLevel(level, true);
13311359
refreshEnabledGraphics();
13321360
refresh();

indra/newview/llfloaterpreference.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver,
218218
bool mGotPersonalInfo;
219219
bool mLanguageChanged;
220220
bool mAvatarDataInitialized;
221+
U32 mLastQualityLevel = 0;
221222
std::string mPriorInstantMessageLogPath;
222223

223224
bool mOriginalHideOnlineStatus;

indra/newview/skins/default/xui/en/notifications.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12145,6 +12145,17 @@ Cannot create large prims that intersect other residents. Please re-try when ot
1214512145
yestext="OK"/>
1214612146
</notification>
1214712147

12148+
<notification
12149+
icon="alertmodal.tga"
12150+
name="PreferenceQualityWithLowMemory"
12151+
type="alert">
12152+
Your system has [TOTAL_MEM]MB of memory, which might be not enough to run viewer at higher settings and might result in issues.
12153+
<usetemplate
12154+
name="okcancelbuttons"
12155+
notext="Cancel"
12156+
yestext="Continue"/>
12157+
</notification>
12158+
1214812159
<notification
1214912160
icon="alertmodal.tga"
1215012161
name="DefaultObjectPermissions"

0 commit comments

Comments
 (0)