Use LLCachedControl in llviewerwindow and llappviewer

Getting from gSavedSettings is expensive to do so often
meow-7.2.2
Andrey Kleshchev 2025-03-26 21:05:36 +02:00 committed by Andrey Kleshchev
parent 7d5a5e939a
commit d67859e483
3 changed files with 30 additions and 18 deletions

View File

@ -645,9 +645,10 @@ void LLWearable::addVisualParam(LLVisualParam *param)
void LLWearable::setVisualParamWeight(S32 param_index, F32 value)
{
if( is_in_map(mVisualParamIndexMap, param_index ) )
visual_param_index_map_t::iterator found = mVisualParamIndexMap.find(param_index);
if(found != mVisualParamIndexMap.end())
{
LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
LLVisualParam *wearable_param = found->second;
wearable_param->setWeight(value);
}
else
@ -658,10 +659,10 @@ void LLWearable::setVisualParamWeight(S32 param_index, F32 value)
F32 LLWearable::getVisualParamWeight(S32 param_index) const
{
if( is_in_map(mVisualParamIndexMap, param_index ) )
visual_param_index_map_t::const_iterator found = mVisualParamIndexMap.find(param_index);
if(found != mVisualParamIndexMap.end())
{
const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
return wearable_param->getWeight();
return found->second->getWeight();
}
else
{
@ -726,7 +727,7 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
if (!avatarp) return;
// Pull params
for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
for( const LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
{
// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.

View File

@ -445,8 +445,8 @@ void idle_afk_check()
{
// check idle timers
F32 current_idle = gAwayTriggerTimer.getElapsedTimeF32();
F32 afk_timeout = (F32)gSavedSettings.getS32("AFKTimeout");
if (afk_timeout && (current_idle > afk_timeout) && ! gAgent.getAFK())
static LLCachedControl<S32> afk_timeout(gSavedSettings, "AFKTimeout", 300);
if (afk_timeout() && (current_idle > (F32)afk_timeout()) && !gAgent.getAFK())
{
LL_INFOS("IdleAway") << "Idle more than " << afk_timeout << " seconds: automatically changing to Away status" << LL_ENDL;
gAgent.setAFK();
@ -5376,7 +5376,8 @@ void LLAppViewer::idleNetwork()
gObjectList.mNumNewObjects = 0;
S32 total_decoded = 0;
if (!gSavedSettings.getBOOL("SpeedTest"))
static LLCachedControl<bool> speed_test(gSavedSettings, "SpeedTest", false);
if (!speed_test())
{
LL_PROFILE_ZONE_NAMED_CATEGORY_NETWORK("idle network"); //LL_RECORD_BLOCK_TIME(FTM_IDLE_NETWORK); // decode
@ -5435,7 +5436,9 @@ void LLAppViewer::idleNetwork()
}
// Handle per-frame message system processing.
lmc.processAcks(gSavedSettings.getF32("AckCollectTime"));
static LLCachedControl<F32> ack_collection_time(gSavedSettings, "AckCollectTime", 0.1f);
lmc.processAcks(ack_collection_time());
}
}
add(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects);

View File

@ -489,7 +489,8 @@ public:
clearText();
if (gSavedSettings.getBOOL("DebugShowTime"))
static LLCachedControl<bool> debug_show_time(gSavedSettings, "DebugShowTime", false);
if (debug_show_time())
{
F32 time = gFrameTimeSeconds;
S32 hours = (S32)(time / (60*60));
@ -498,7 +499,8 @@ public:
addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc;
}
if (gSavedSettings.getBOOL("DebugShowMemory"))
static LLCachedControl<bool> debug_show_memory(gSavedSettings, "DebugShowMemory", false);
if (debug_show_memory())
{
addText(xpos, ypos,
STRINGIZE("Memory: " << (LLMemory::getCurrentRSS() / 1024) << " (KB)"));
@ -591,7 +593,8 @@ public:
ypos += y_inc;
}*/
if (gSavedSettings.getBOOL("DebugShowRenderInfo"))
static LLCachedControl<bool> debug_show_render_info(gSavedSettings, "DebugShowRenderInfo", false);
if (debug_show_render_info())
{
LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
@ -730,7 +733,8 @@ public:
gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0;
}
if (gSavedSettings.getBOOL("DebugShowAvatarRenderInfo"))
static LLCachedControl<bool> debug_show_avatar_render_info(gSavedSettings, "DebugShowAvatarRenderInfo", false);
if (debug_show_avatar_render_info())
{
std::map<std::string, LLVOAvatar*> sorted_avs;
{
@ -763,7 +767,8 @@ public:
av_iter++;
}
}
if (gSavedSettings.getBOOL("DebugShowRenderMatrices"))
static LLCachedControl<bool> debug_show_render_matrices(gSavedSettings, "DebugShowRenderMatrices", false);
if (debug_show_render_matrices())
{
char camera_lines[8][32];
memset(camera_lines, ' ', sizeof(camera_lines));
@ -789,7 +794,8 @@ public:
ypos += y_inc;
}
// disable use of glReadPixels which messes up nVidia nSight graphics debugging
if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport)
static LLCachedControl<bool> debug_show_color(gSavedSettings, "DebugShowColor", false);
if (debug_show_color() && !LLRender::sNsightDebugSupport)
{
U8 color[4];
LLCoordGL coord = gViewerWindow->getCurrentMouse();
@ -881,7 +887,8 @@ public:
}
}
if (gSavedSettings.getBOOL("DebugShowTextureInfo"))
static LLCachedControl<bool> debug_show_texture_info(gSavedSettings, "DebugShowTextureInfo", false);
if (debug_show_texture_info())
{
LLViewerObject* objectp = NULL ;
@ -1600,7 +1607,8 @@ bool LLViewerWindow::handleActivate(LLWindow *window, bool activated)
mActive = false;
// if the user has chosen to go Away automatically after some time, then go Away when minimizing
if (gSavedSettings.getS32("AFKTimeout"))
static LLCachedControl<S32> afk_time(gSavedSettings, "AFKTimeout", 300);
if (afk_time())
{
gAgent.setAFK();
}