From d00f764e2a78e0d03db7030e703416bc5f22d5dd Mon Sep 17 00:00:00 2001 From: PanteraPolnocy Date: Sun, 13 Jan 2013 23:08:22 +0100 Subject: [PATCH] Attempt to speed up things a little --- indra/newview/fslslbridge.cpp | 36 ++++++++++++++++++++----- indra/newview/fsmoneytracker.cpp | 7 ++++- indra/newview/lggbeammaps.cpp | 24 ++++++++++++++--- indra/newview/llbreastmotion.cpp | 12 +++++++-- indra/newview/llcallingcard.cpp | 41 ++++++++++++++++++++++++----- indra/newview/lldrawpoolalpha.cpp | 6 ++++- indra/newview/lldrawpoolbump.cpp | 18 ++++++++++--- indra/newview/lldrawpoolground.cpp | 6 ++++- indra/newview/lldrawpoolterrain.cpp | 12 +++++++-- indra/newview/lldrawpooltree.cpp | 23 +++++++++++----- indra/newview/llviewerwindow.cpp | 14 ++++++++-- 11 files changed, 165 insertions(+), 34 deletions(-) diff --git a/indra/newview/fslslbridge.cpp b/indra/newview/fslslbridge.cpp index df3c4a2a67..03153679f5 100644 --- a/indra/newview/fslslbridge.cpp +++ b/indra/newview/fslslbridge.cpp @@ -127,7 +127,11 @@ FSLSLBridge :: ~FSLSLBridge() bool FSLSLBridge :: lslToViewer(std::string message, LLUUID fromID, LLUUID ownerID) { - if (!gSavedSettings.getBOOL("UseLSLBridge")) + // Attempt to speed up things a little + // if (!gSavedSettings.getBOOL("UseLSLBridge")) + static LLCachedControl UseLSLBridge(gSavedSettings, "UseLSLBridge"); + if (!UseLSLBridge) + // return false; lldebugs << message << llendl; @@ -249,7 +253,11 @@ bool FSLSLBridge :: lslToViewer(std::string message, LLUUID fromID, LLUUID owner bool FSLSLBridge :: viewerToLSL(std::string message, FSLSLBridgeRequestResponder *responder) { - if (!gSavedSettings.getBOOL("UseLSLBridge")) + // Attempt to speed up things a little + // if (!gSavedSettings.getBOOL("UseLSLBridge")) + static LLCachedControl UseLSLBridge(gSavedSettings, "UseLSLBridge"); + if (!UseLSLBridge) + // return false; if (responder == NULL) @@ -284,10 +292,18 @@ bool FSLSLBridge :: updateBoolSettingValue(std::string msgVal, bool contentVal) // void FSLSLBridge :: recreateBridge() { - if (!gSavedSettings.getBOOL("UseLSLBridge")) + // Attempt to speed up things a little + // if (!gSavedSettings.getBOOL("UseLSLBridge")) + static LLCachedControl UseLSLBridge(gSavedSettings, "UseLSLBridge"); + if (!UseLSLBridge) + // return; - if (gSavedSettings.getBOOL("NoInventoryLibrary")) + // Attempt to speed up things a little + // if (gSavedSettings.getBOOL("NoInventoryLibrary")) + static LLCachedControl NoInventoryLibrary(gSavedSettings, "NoInventoryLibrary"); + if (NoInventoryLibrary) + // { llwarns << "Asked to create bridge, but we don't have a library. Aborting." << llendl; reportToNearbyChat(LLTrans::getString("fsbridge_no_library")); @@ -320,10 +336,18 @@ void FSLSLBridge :: recreateBridge() void FSLSLBridge :: initBridge() { - if (!gSavedSettings.getBOOL("UseLSLBridge")) + // Attempt to speed up things a little + // if (!gSavedSettings.getBOOL("UseLSLBridge")) + static LLCachedControl UseLSLBridge(gSavedSettings, "UseLSLBridge"); + if (!UseLSLBridge) + // return; - if (gSavedSettings.getBOOL("NoInventoryLibrary")) + // Attempt to speed up things a little + // if (gSavedSettings.getBOOL("NoInventoryLibrary")) + static LLCachedControl NoInventoryLibrary(gSavedSettings, "NoInventoryLibrary"); + if (NoInventoryLibrary) + // { llwarns << "Asked to create bridge, but we don't have a library. Aborting." << llendl; reportToNearbyChat(LLTrans::getString("fsbridge_no_library")); diff --git a/indra/newview/fsmoneytracker.cpp b/indra/newview/fsmoneytracker.cpp index 1d10a12479..c5b584e849 100644 --- a/indra/newview/fsmoneytracker.cpp +++ b/indra/newview/fsmoneytracker.cpp @@ -70,7 +70,12 @@ std::string FSMoneyTracker::appendTime() time_t utc_time; utc_time = time_corrected(); std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:[" + LLTrans::getString("TimeMin")+"]"; - if (gSavedSettings.getBOOL("FSSecondsinChatTimestamps")) + + // Attempt to speed up things a little + // if (gSavedSettings.getBOOL("FSSecondsinChatTimestamps")) + static LLCachedControl FSSecondsinChatTimestamps(gSavedSettings, "FSSecondsinChatTimestamps"); + if (FSSecondsinChatTimestamps) + // { timeStr += ":[" + LLTrans::getString("TimeSec")+"]"; } diff --git a/indra/newview/lggbeammaps.cpp b/indra/newview/lggbeammaps.cpp index 57a360db19..35b028c788 100644 --- a/indra/newview/lggbeammaps.cpp +++ b/indra/newview/lggbeammaps.cpp @@ -216,13 +216,21 @@ F32 lggBeamMaps::setUpAndGetDuration() lggBeamData dot; dot.p = LLVector3d(beamData["offset"]); - dot.p *= (gSavedSettings.getF32("FSBeamShapeScale")*2.0f); + // Attempt to speed up things a little + // dot.p *= (gSavedSettings.getF32("FSBeamShapeScale")*2.0f); + static LLCachedControl FSBeamShapeScale(gSavedSettings, "FSBeamShapeScale"); + dot.p *= (FSBeamShapeScale*2.0f); + // LLColor4 color = LLColor4(beamData["color"]); dot.c = LLColor4U(color); dots.push_back(dot); } - F32 maxBPerQS = gSavedSettings.getF32("FSMaxBeamsPerSecond") / 4.0f; + // Attempt to speed up things a little + // F32 maxBPerQS = gSavedSettings.getF32("FSMaxBeamsPerSecond") / 4.0f; + static LLCachedControl FSMaxBeamsPerSecond(gSavedSettings, "FSMaxBeamsPerSecond"); + F32 maxBPerQS = FSMaxBeamsPerSecond / 4.0f; + // duration = llceil((F32)(myPicture.size()) / maxBPerQS) * 0.25f; llinfos << "reading it all now size is " << myPicture.size() << " and duration is " << duration << llendl; @@ -354,7 +362,11 @@ std::vector lggBeamMaps::getColorsFileNames() } void lggBeamMaps::stopBeamChat() { - if(gSavedSettings.getBOOL("FSParticleChat")) + // Attempt to speed up things a little + // if(gSavedSettings.getBOOL("FSParticleChat")) + static LLCachedControl FSParticleChat(gSavedSettings, "FSParticleChat"); + if(FSParticleChat) + // { if(sPartsNow != FALSE) { @@ -376,7 +388,11 @@ void lggBeamMaps::stopBeamChat() } void lggBeamMaps::updateBeamChat(LLVector3d currentPos) { - if(gSavedSettings.getBOOL("FSParticleChat")) + // Attempt to speed up things a little + // if(gSavedSettings.getBOOL("FSParticleChat")) + static LLCachedControl FSParticleChat(gSavedSettings, "FSParticleChat"); + if(FSParticleChat) + // { if(sPartsNow != TRUE) { diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp index 9a8cd5ceae..9d09b8799f 100644 --- a/indra/newview/llbreastmotion.cpp +++ b/indra/newview/llbreastmotion.cpp @@ -198,7 +198,11 @@ LLVector3 LLBreastMotion::calculateAcceleration_local(const LLVector3 &new_char_ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) { // Skip if disabled globally. - if (!gSavedSettings.getBOOL("AvatarPhysics")) + // Attempt to speed up things a little + // if (!gSavedSettings.getBOOL("AvatarPhysics")) + static LLCachedControl AvatarPhysics(gSavedSettings, "AvatarPhysics"); + if (!AvatarPhysics) + // { return TRUE; } @@ -320,7 +324,11 @@ BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask) mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam*100.0, mBreastMaxVelocityParam*100.0); // Temporary debugging setting to cause all avatars to move, for profiling purposes. - if (gSavedSettings.getBOOL("AvatarPhysicsTest")) + // Attempt to speed up things a little + // if (gSavedSettings.getBOOL("AvatarPhysicsTest")) + static LLCachedControl AvatarPhysicsTest(gSavedSettings, "AvatarPhysicsTest"); + if (AvatarPhysicsTest) + // { mBreastVelocity_local_vec[0] = sin(mTimer.getElapsedTimeF32()*4.0)*5.0; mBreastVelocity_local_vec[1] = sin(mTimer.getElapsedTimeF32()*3.0)*5.0; diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 45e2b02817..1177b279ed 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -746,7 +746,12 @@ void LLAvatarTracker::processChangeUserRights(LLMessageSystem* msg, void**) void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) { S32 count = msg->getNumberOfBlocksFast(_PREHASH_AgentBlock); - BOOL chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification"); + + // Attempt to speed up things a little + // BOOL chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification"); + static LLCachedControl ChatOnlineNotification(gSavedSettings, "ChatOnlineNotification"); + BOOL chat_notify = ChatOnlineNotification; + // lldebugs << "Received " << count << " online notifications **** " << llendl; if(count > 0) @@ -783,7 +788,12 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) gInventory.addChangedMask(LLInventoryObserver::CALLING_CARD, LLUUID::null); } //[FIX FIRE-3522 : SJ] Notify Online/Offline to Nearby Chat even if chat_notify isnt true - if(chat_notify||LGGContactSets::getInstance()->notifyForFriend(agent_id)||gSavedSettings.getBOOL("OnlineOfflinetoNearbyChat")) + + // Attempt to speed up things a little + // if(chat_notify||LGGContactSets::getInstance()->notifyForFriend(agent_id)||gSavedSettings.getBOOL("OnlineOfflinetoNearbyChat")) + static LLCachedControl OnlineOfflinetoNearbyChat(gSavedSettings, "OnlineOfflinetoNearbyChat"); + if(chat_notify||LGGContactSets::getInstance()->notifyForFriend(agent_id)||OnlineOfflinetoNearbyChat) + // { // Look up the name of this agent for the notification LLAvatarNameCache::get(agent_id, @@ -807,11 +817,19 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, // Ansariel: No please! Take preference settings into account! LLSD args; - if ((gSavedSettings.getBOOL("NameTagShowUsernames")) && (gSavedSettings.getBOOL("UseDisplayNames"))) + // Attempt to speed up things a little + // if ((gSavedSettings.getBOOL("NameTagShowUsernames")) && (gSavedSettings.getBOOL("UseDisplayNames"))) + static LLCachedControl NameTagShowUsernames(gSavedSettings, "NameTagShowUsernames"); + static LLCachedControl UseDisplayNames(gSavedSettings, "UseDisplayNames"); + if ((NameTagShowUsernames) && (UseDisplayNames)) + // { args["NAME"] = av_name.getCompleteName(); } - else if (gSavedSettings.getBOOL("UseDisplayNames")) + // Attempt to speed up things a little + // else if (gSavedSettings.getBOOL("UseDisplayNames")) + else if (UseDisplayNames) + // { args["NAME"] = av_name.mDisplayName; } @@ -856,7 +874,13 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, // online/offline times to be referenced in chat & logged. // [FIRE-3522 : SJ] Only show Online/Offline toast for groups which have enabled "Show notice for this set" and in the settingpage of CS is checked that the messages need to be in Toasts // or for groups which have enabled "Show notice for this set" and in the settingpage of CS is checked that the messages need to be in Nearby Chat - if ((gSavedSettings.getBOOL("OnlineOfflinetoNearbyChat")) || (gSavedSettings.getBOOL("FSContactSetsNotificationNearbyChat") && LGGContactSets::getInstance()->notifyForFriend(agent_id))) + + // Attempt to speed up things a little + // if ((gSavedSettings.getBOOL("OnlineOfflinetoNearbyChat")) || (gSavedSettings.getBOOL("FSContactSetsNotificationNearbyChat") && LGGContactSets::getInstance()->notifyForFriend(agent_id))) + static LLCachedControl OnlineOfflinetoNearbyChat(gSavedSettings, "OnlineOfflinetoNearbyChat"); + static LLCachedControl FSContactSetsNotificationNearbyChat(gSavedSettings, "FSContactSetsNotificationNearbyChat"); + if ((OnlineOfflinetoNearbyChat) || (FSContactSetsNotificationNearbyChat && LGGContactSets::getInstance()->notifyForFriend(agent_id))) + // { static LLCachedControl history_only(gSavedSettings, "OnlineOfflinetoNearbyChatHistory"); // LO - Adding a setting to show online/offline notices only in chat history. Helps prevent your screen from being filled with online notices on login. LLChat chat; @@ -1021,7 +1045,12 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship { // Friend names on worldmap should respect display name settings //mMappable.insert(value); - if (LLAvatarNameCache::useDisplayNames() && gSavedSettings.getBOOL("NameTagShowUsernames")) + + // Attempt to speed up things a little + // if (LLAvatarNameCache::useDisplayNames() && gSavedSettings.getBOOL("NameTagShowUsernames")) + static LLCachedControl NameTagShowUsernames(gSavedSettings, "NameTagShowUsernames"); + if (LLAvatarNameCache::useDisplayNames() && NameTagShowUsernames) + // { buddy_map_t::value_type value(av_name.getCompleteName(), buddy_id); mMappable.insert(value); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 5199fc4cec..9232bda6a3 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -100,11 +100,15 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass) S32 LLDrawPoolAlpha::getNumPostDeferredPasses() { + static LLCachedControl RenderDepthOfField(gSavedSettings, "RenderDepthOfField"); // Attempt to speed up things a little if (LLPipeline::sImpostorRender) { //skip depth buffer filling pass when rendering impostors return 1; } - else if (gSavedSettings.getBOOL("RenderDepthOfField")) + // Attempt to speed up things a little + // else if (gSavedSettings.getBOOL("RenderDepthOfField")) + else if (RenderDepthOfField) + // { return 2; } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 165a9d6070..e132beaf59 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -803,7 +803,11 @@ void LLDrawPoolBump::endBump(U32 pass) S32 LLDrawPoolBump::getNumDeferredPasses() { - if (gSavedSettings.getBOOL("RenderObjectBump")) + // Attempt to speed up things a little + // if (gSavedSettings.getBOOL("RenderObjectBump")) + static LLCachedControl RenderObjectBump(gSavedSettings, "RenderObjectBump"); + if (RenderObjectBump) + // { return 1; } @@ -1144,7 +1148,11 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr S32 src_cmp = src->getComponents(); - F32 norm_scale = gSavedSettings.getF32("RenderNormalMapScale"); + // Attempt to speed up things a little + // F32 norm_scale = gSavedSettings.getF32("RenderNormalMapScale"); + static LLCachedControl RenderNormalMapScale(gSavedSettings, "RenderNormalMapScale"); + F32 norm_scale = RenderNormalMapScale; + // U32 idx = 0; //generate normal map from pseudo-heightfield @@ -1373,7 +1381,11 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI LLGLDisable blend(GL_BLEND); gGL.setColorMask(TRUE, TRUE); gNormalMapGenProgram.bind(); - gNormalMapGenProgram.uniform1f("norm_scale", gSavedSettings.getF32("RenderNormalMapScale")); + // Attempt to speed up things a little + // gNormalMapGenProgram.uniform1f("norm_scale", gSavedSettings.getF32("RenderNormalMapScale")); + static LLCachedControl RenderNormalMapScale(gSavedSettings, "RenderNormalMapScale"); + gNormalMapGenProgram.uniform1f("norm_scale", RenderNormalMapScale); + // gNormalMapGenProgram.uniform1f("stepX", 1.f/bump->getWidth()); gNormalMapGenProgram.uniform1f("stepY", 1.f/bump->getHeight()); diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp index 59c3fbf7a1..0ebbaf0810 100644 --- a/indra/newview/lldrawpoolground.cpp +++ b/indra/newview/lldrawpoolground.cpp @@ -58,7 +58,11 @@ void LLDrawPoolGround::prerender() void LLDrawPoolGround::render(S32 pass) { - if (mDrawFace.empty() || !gSavedSettings.getBOOL("RenderGround")) + // Attempt to speed up things a little + // if (mDrawFace.empty() || !gSavedSettings.getBOOL("RenderGround")) + static LLCachedControl RenderGround(gSavedSettings, "RenderGround"); + if (mDrawFace.empty() || !RenderGround) + // { return; } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 6108af33d2..8592c03165 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -66,8 +66,16 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : U32 int_format = GL_ALPHA; // Hack! - sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); - sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); + + // Attempt to speed up things a little + // sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale"); + // sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); + static LLCachedControl RenderTerrainScale(gSavedSettings, "RenderTerrainScale"); + static LLCachedControl RenderTerrainDetail(gSavedSettings, "RenderTerrainDetail"); + sDetailScale = 1.f/RenderTerrainScale; + sDetailMode = RenderTerrainDetail; + // + mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga", TRUE, LLViewerTexture::BOOST_UI, LLViewerTexture::FETCHED_TEXTURE, diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index fedbd782dc..2cd6d8000d 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -174,9 +174,14 @@ void LLDrawPoolTree::endDeferredPass(S32 pass) void LLDrawPoolTree::beginShadowPass(S32 pass) { LLFastTimer t(FTM_SHADOW_TREE); - - glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"), - gSavedSettings.getF32("RenderDeferredTreeShadowBias")); + + // Attempt to speed up things a little + // glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"), + // gSavedSettings.getF32("RenderDeferredTreeShadowBias")); + static LLCachedControl RenderDeferredTreeShadowOffset(gSavedSettings, "RenderDeferredTreeShadowOffset"); + static LLCachedControl RenderDeferredTreeShadowBias(gSavedSettings, "RenderDeferredTreeShadowBias"); + glPolygonOffset(RenderDeferredTreeShadowOffset, RenderDeferredTreeShadowBias); + // gDeferredTreeShadowProgram.bind(); gDeferredTreeShadowProgram.setMinimumAlpha(0.5f); @@ -190,9 +195,15 @@ void LLDrawPoolTree::renderShadow(S32 pass) void LLDrawPoolTree::endShadowPass(S32 pass) { LLFastTimer t(FTM_SHADOW_TREE); - - glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"), - gSavedSettings.getF32("RenderDeferredSpotShadowBias")); + + // Attempt to speed up things a little + // glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"), + // gSavedSettings.getF32("RenderDeferredSpotShadowBias")); + static LLCachedControl RenderDeferredSpotShadowOffset(gSavedSettings, "RenderDeferredSpotShadowOffset"); + static LLCachedControl RenderDeferredSpotShadowBias(gSavedSettings, "RenderDeferredSpotShadowBias"); + glPolygonOffset(RenderDeferredSpotShadowOffset, RenderDeferredSpotShadowBias); + // + gDeferredTreeShadowProgram.unbind(); } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index cc386bff5c..efb24247a3 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2711,6 +2711,8 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Traverses up the hierarchy if( keyboard_focus ) { + static LLCachedControl ArrowKeysAlwaysMove(gSavedSettings, "ArrowKeysAlwaysMove"); // Attempt to speed up things a little + // Remove floating chat bar // LLNearbyChatBar* nearby_chat = LLFloaterReg::findTypedInstance("chat_bar"); @@ -2728,7 +2730,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // || gSavedSettings.getBOOL("ArrowKeysAlwaysMove")) if(LLNearbyChat::instance().defaultChatBarHasFocus() && (LLNearbyChat::instance().defaultChatBarIsIdle() || - gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))) + // Attempt to speed up things a little + // gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))) + ArrowKeysAlwaysMove)) + // // { // let Control-Up and Control-Down through for chat line history, @@ -2783,7 +2788,12 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook, // no view has keyboard focus, this is a printable character key (and no modifier key is // pressed except shift), then give focus to nearby chat (STORM-560) - if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && + + // Attempt to speed up things a little + // if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && + static LLCachedControl LetterKeysFocusChatBar(gSavedSettings, "LetterKeysFocusChatBar"); + if ( LetterKeysFocusChatBar && !gAgentCamera.cameraMouselook() && + // !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { // Remove floating chat bar