Some more caching of frequently called gSavedSettings

meow-7.2.2
Ansariel 2013-09-06 20:31:24 +02:00
parent 55cfd4a81f
commit 3073c750ae
14 changed files with 136 additions and 30 deletions

View File

@ -325,7 +325,12 @@ void LLFolderView::filter( LLFolderViewFilter& filter )
{
// Entry point of inventory filtering (CHUI-849)
LLFastTimer t2(FTM_FILTER);
filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
// <FS:Ansariel> Replace frequently called gSavedSettings
//filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
static LLCachedControl<S32> sFilterItemsMaxTimePerFrameVisible(*LLUI::sSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible");
static LLCachedControl<S32> sFilterItemsMaxTimePerFrameUnvisible(*LLUI::sSettingGroups["config"], "FilterItemsMaxTimePerFrameUnvisible");
filter.resetTime(llclamp((mParentPanel->getVisible() ? sFilterItemsMaxTimePerFrameVisible() : sFilterItemsMaxTimePerFrameUnvisible()), 1, 100));
// </FS:Ansariel>
// Note: we filter the model, not the view
getViewModelItem()->filter(filter);

View File

@ -48,7 +48,11 @@ std::string LLFolderViewModelCommon::getStatusText()
void LLFolderViewModelCommon::filter()
{
getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100));
// <FS:Ansariel> Replace frequently called gSavedSettings
//getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100));
static LLCachedControl<S32> sFilterItemsMaxTimePerFrameVisible(*LLUI::sSettingGroups["config"], "FilterItemsMaxTimePerFrameVisible");
getFilter().resetTime(llclamp(sFilterItemsMaxTimePerFrameVisible(), 1, 100));
// </FS:Ansariel>
mFolderView->getViewModelItem()->filter(getFilter());
}

View File

@ -1920,7 +1920,11 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
camera_position_global = focusPosGlobal + mCameraFocusOffset;
}
if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike())
// <FS:Ansariel> Replace frequently called gSavedSettings
//if (!gSavedSettings.getBOOL("DisableCameraConstraints") && !gAgent.isGodlike())
static LLCachedControl<bool> sDisableCameraConstraints(gSavedSettings, "DisableCameraConstraints");
if (!sDisableCameraConstraints && !gAgent.isGodlike())
// </FS:Ansariel>
{
LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global);
bool constrain = true;
@ -2068,7 +2072,11 @@ F32 LLAgentCamera::getCameraMinOffGround()
}
else
{
if (gSavedSettings.getBOOL("DisableCameraConstraints"))
// <FS:Ansariel> Replace frequently called gSavedSettings
//if (gSavedSettings.getBOOL("DisableCameraConstraints"))
static LLCachedControl<bool> sDisableCameraConstraints(gSavedSettings, "DisableCameraConstraints");
if (sDisableCameraConstraints)
// </FS:Ansariel>
{
return -1000.f;
}

View File

@ -6114,7 +6114,11 @@ void LLAppViewer::setMasterSystemAudioMute(bool mute)
//virtual
bool LLAppViewer::getMasterSystemAudioMute()
{
return gSavedSettings.getBOOL("MuteAudio");
// <FS:Ansariel> Replace frequently called gSavedSettings
//return gSavedSettings.getBOOL("MuteAudio");
static LLCachedControl<bool> sMuteAudio(gSavedSettings, "MuteAudio");
return sMuteAudio;
// </FS:Ansariel>
}
//----------------------------------------------------------------------------

View File

@ -174,7 +174,11 @@ void LLFirstUse::firstUseNotification(const std::string& control_var, bool enabl
if (enable)
{
if (gSavedSettings.getBOOL("EnableUIHints"))
// <FS:Ansariel> Replace frequently called gSavedSettings
//if (gSavedSettings.getBOOL("EnableUIHints"))
static LLCachedControl<bool> sEnableUIHints(gSavedSettings, "EnableUIHints");
if (sEnableUIHints)
// </FS:Ansariel>
{
LL_DEBUGS("LLFirstUse") << "Trigger first use notification " << notification_name << LL_ENDL;

View File

@ -770,7 +770,11 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
// If we're in freeze-frame mode and camera has moved, update snapshot.
LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin();
LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion();
if (gSavedSettings.getBOOL("FreezeTime") &&
// <FS:Ansariel> Replace frequently called gSavedSettings
//if (gSavedSettings.getBOOL("FreezeTime") &&
static LLCachedControl<bool> sFreezeTime(gSavedSettings, "FreezeTime");
if (sFreezeTime &&
// </FS:Ansariel>
(new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f))
{
previewp->mCameraPos = new_camera_pos;
@ -2681,7 +2685,11 @@ BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask)
BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask)
{
// use default handler when not in freeze-frame mode
if(!gSavedSettings.getBOOL("FreezeTime"))
// <FS:Ansariel> Replace frequently called gSavedSettings
//if(!gSavedSettings.getBOOL("FreezeTime"))
static LLCachedControl<bool> sFreezeTime(gSavedSettings, "FreezeTime");
if(!sFreezeTime)
// </FS:Ansariel>
{
return LLFloaterView::handleHover(x, y, mask);
}

View File

@ -198,7 +198,8 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
// <FS:AW>
// if (gSavedSettings.getBOOL("UseHTTPInventory"))
std::string url = region->getCapability("FetchInventory2");
if (gSavedSettings.getBOOL("UseHTTPInventory") && !url.empty())
static LLCachedControl<bool> sUseHTTPInventory(gSavedSettings, "UseHTTPInventory");
if (sUseHTTPInventory && !url.empty())
// </FS:AW>
{
bulkFetch();

View File

@ -448,8 +448,14 @@ void LLAvatarTexBar::draw()
text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT);
line_num++;
}
const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout");
const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
// <FS:Ansariel> Replace frequently called gSavedSettings
//const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout");
//const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
static LLCachedControl<U32> sAvatarBakedTextureUploadTimeout(gSavedSettings, "AvatarBakedTextureUploadTimeout");
static LLCachedControl<U32> sTextureDiscardLevel(gSavedSettings, "TextureDiscardLevel");
const U32 texture_timeout = sAvatarBakedTextureUploadTimeout();
const U32 override_tex_discard_level = sTextureDiscardLevel();
// </FS:Ansariel>
LLColor4 header_color(1.f, 1.f, 1.f, 0.9f);

View File

@ -211,10 +211,16 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
gAgentCamera.setFocusGlobal(pick_info);
}
// <FS:Ansariel> Replace frequently called gSavedSettings
static LLCachedControl<bool> sFreezeTime(gSavedSettings, "FreezeTime");
// </FS:Ansariel>
if (!(pick_info.mKeyMask & MASK_ALT) &&
gAgentCamera.cameraThirdPerson() &&
gViewerWindow->getLeftMouseDown() &&
!gSavedSettings.getBOOL("FreezeTime") &&
// <FS:Ansariel> Replace frequently called gSavedSettings
//!gSavedSettings.getBOOL("FreezeTime") &&
!sFreezeTime &&
// </FS:Ansariel>
(hit_obj == gAgentAvatarp ||
(hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf())))
{

View File

@ -428,8 +428,14 @@ void init_audio()
void audio_update_volume(bool force_update)
{
F32 master_volume = gSavedSettings.getF32("AudioLevelMaster");
BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
// <FS:Ansariel> Replace frequently called gSavedSettings
//F32 master_volume = gSavedSettings.getF32("AudioLevelMaster");
//BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
static LLCachedControl<F32> sAudioLevelMaster(gSavedSettings, "AudioLevelMaster");
static LLCachedControl<bool> sMuteAudio(gSavedSettings, "MuteAudio");
F32 master_volume = sAudioLevelMaster();
BOOL mute_audio = (BOOL)sMuteAudio;
// </FS:Ansariel>
LLProgressView* progress = gViewerWindow->getProgressView();
BOOL progress_view_visible = FALSE;
@ -450,12 +456,25 @@ void audio_update_volume(bool force_update)
{
gAudiop->setMasterGain ( master_volume );
gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler"));
// <FS:Ansariel> Replace frequently called gSavedSettings
//gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler"));
//if(!LLViewerCamera::getInstance()->cameraUnderWater())
//gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff"));
//else
// gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelUnderwaterRolloff"));
static LLCachedControl<F32> sAudioLevelDoppler(gSavedSettings, "AudioLevelDoppler");
static LLCachedControl<bool> sAudioLevelRolloff(gSavedSettings, "AudioLevelRolloff");
static LLCachedControl<bool> sAudioLevelUnderwaterRolloff(gSavedSettings, "AudioLevelUnderwaterRolloff");
gAudiop->setDopplerFactor(sAudioLevelDoppler);
if(!LLViewerCamera::getInstance()->cameraUnderWater())
gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff"));
gAudiop->setRolloffFactor(sAudioLevelRolloff);
else
gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelUnderwaterRolloff"));
gAudiop->setRolloffFactor(sAudioLevelUnderwaterRolloff);
// </FS:Ansariel>
gAudiop->setMuted(mute_audio || progress_view_visible);

View File

@ -791,7 +791,11 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
LLFastTimer t1(FTM_MEDIA_UPDATE);
// Enable/disable the plugin read thread
LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread"));
// <FS:Ansariel> Replace frequently called gSavedSettings
//LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread"));
static LLCachedControl<bool> sPluginUseReadThread(gSavedSettings, "PluginUseReadThread");
LLPluginProcessParent::setUseReadThread(sPluginUseReadThread);
// </FS:Ansariel>
// HACK: we always try to keep a spare running webkit plugin around to improve launch times.
createSpareBrowserMediaSource();
@ -840,13 +844,29 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
int impl_count_interest_normal = 0;
std::vector<LLViewerMediaImpl*> proximity_order;
bool inworld_media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
bool inworld_audio_enabled = gSavedSettings.getBOOL("AudioStreamingMusic");
U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal");
U32 max_normal = gSavedSettings.getU32("PluginInstancesNormal");
U32 max_low = gSavedSettings.getU32("PluginInstancesLow");
F32 max_cpu = gSavedSettings.getF32("PluginInstancesCPULimit");
// <FS:Ansariel> Replace frequently called gSavedSettings
//bool inworld_media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
//bool inworld_audio_enabled = gSavedSettings.getBOOL("AudioStreamingMusic");
//U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal");
//U32 max_normal = gSavedSettings.getU32("PluginInstancesNormal");
//U32 max_low = gSavedSettings.getU32("PluginInstancesLow");
//F32 max_cpu = gSavedSettings.getF32("PluginInstancesCPULimit");
static LLCachedControl<bool> sAudioStreamingMedia(gSavedSettings, "AudioStreamingMedia");
static LLCachedControl<bool> sAudioStreamingMusic(gSavedSettings, "AudioStreamingMusic");
static LLCachedControl<U32> sPluginInstancesTotal(gSavedSettings, "PluginInstancesTotal");
static LLCachedControl<U32> sPluginInstancesNormal(gSavedSettings, "PluginInstancesNormal");
static LLCachedControl<U32> sPluginInstancesLow(gSavedSettings, "PluginInstancesLow");
static LLCachedControl<F32> sPluginInstancesCPULimit(gSavedSettings, "PluginInstancesCPULimit");
bool inworld_media_enabled = sAudioStreamingMedia;
bool inworld_audio_enabled = sAudioStreamingMusic;
U32 max_instances = sPluginInstancesTotal();
U32 max_normal = sPluginInstancesNormal();
U32 max_low = sPluginInstancesLow();
F32 max_cpu = sPluginInstancesCPULimit();
// </FS:Ansariel>
// Setting max_cpu to 0.0 disables CPU usage checking.
bool check_cpu_usage = (max_cpu != 0.0f);
@ -1018,7 +1038,11 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
}
if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug"))
// <FS:Ansariel> Replace frequently called gSavedSettings
//if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug"))
static LLCachedControl<bool> sMediaPerformanceManagerDebug(gSavedSettings, "MediaPerformanceManagerDebug");
if(sMediaPerformanceManagerDebug)
// </FS:Ansariel>
{
// Give impls the same ordering as the priority list
// they're already in the right order for this.

View File

@ -2049,7 +2049,11 @@ bool LLViewerFetchedTexture::updateFetch()
c = mComponents;
}
const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
// <FS:Ansariel> Replace frequently called gSavedSettings
//const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
static LLCachedControl<U32> sTextureDiscardLevel(gSavedSettings, "TextureDiscardLevel");
const U32 override_tex_discard_level = sTextureDiscardLevel();
// </FS:Ansariel>
if (override_tex_discard_level != 0)
{
desired_discard = override_tex_discard_level;

View File

@ -1756,7 +1756,11 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLViewerTexLayerSet* laye
//-----------------------------------------------------------------------------
BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset) const
{
const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
// <FS:Ansariel> Replace frequently called gSavedSettings
//const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
static LLCachedControl<U32> sTextureDiscardLevel(gSavedSettings, "TextureDiscardLevel");
const U32 desired_tex_discard_level = sTextureDiscardLevel();
// </FS:Ansariel>
// const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels.
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
@ -1791,7 +1795,11 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset
BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const
{
const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
// <FS:Ansariel> Replace frequently called gSavedSettings
//const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
static LLCachedControl<U32> sTextureDiscardLevel(gSavedSettings, "TextureDiscardLevel");
const U32 desired_tex_discard_level = sTextureDiscardLevel();
// </FS:Ansariel>
// const U32 desired_tex_discard_level = 0; // hack to not bake textures on lower discard levels
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)

View File

@ -4676,7 +4676,12 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
bool LLVivoxVoiceClient::voiceEnabled()
{
return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
// <FS:Ansariel> Replace frequently called gSavedSettings
//return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
static LLCachedControl<bool> sEnableVoiceChat(gSavedSettings, "EnableVoiceChat");
static LLCachedControl<bool> sCmdLineDisableVoice(gSavedSettings, "CmdLineDisableVoice");
return sEnableVoiceChat && !sCmdLineDisableVoice;
// </FS:Ansariel>
}
void LLVivoxVoiceClient::setLipSyncEnabled(BOOL enabled)