From bf55249dd2000798b48968b8f2b54fd284405753 Mon Sep 17 00:00:00 2001 From: PanteraPolnocy Date: Fri, 19 Jun 2026 21:08:53 +0200 Subject: [PATCH] Some speed optimisation attempts via LLCachedControl Signed-off-by: PanteraPolnocy --- indra/newview/llagentcamera.cpp | 17 ++++++++++++++--- indra/newview/lldrawpoolbump.cpp | 6 +++++- indra/newview/llselectmgr.cpp | 7 ++++--- indra/newview/llviewercamera.cpp | 9 +++++++-- indra/newview/llviewerdisplay.cpp | 14 ++++++++++---- 5 files changed, 40 insertions(+), 13 deletions(-) diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 4322f52d7a..09150f2827 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1271,8 +1271,15 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) F32 y_from_center = ((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f; - frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); - frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); + // Speed optimisation + // frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); + // frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); + static LLCachedControl yaw_from_mouse_position(gSavedSettings, "YawFromMousePosition"); + static LLCachedControl pitch_from_mouse_position(gSavedSettings, "PitchFromMousePosition"); + frameCamera.yaw( - x_from_center * yaw_from_mouse_position() * DEG_TO_RAD); + frameCamera.pitch( - y_from_center * pitch_from_mouse_position() * DEG_TO_RAD); + // + lookAtType = LOOKAT_TARGET_FREELOOK; } @@ -1569,7 +1576,11 @@ void LLAgentCamera::updateCamera() { const F32 SMOOTHING_HALF_LIFE = 0.02f; - F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, false); + // Speed optimisation + // F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, false); + static LLCachedControl camera_position_smoothing(gSavedSettings, "CameraPositionSmoothing"); + F32 smoothing = LLSmoothInterpolation::getInterpolant(camera_position_smoothing() * SMOOTHING_HALF_LIFE, false); + // if (mFocusOnAvatar && !mFocusObject) // we differentiate on avatar mode { diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 488f52a7d4..6bc2294f0b 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -935,7 +935,11 @@ void LLBumpImageList::onSourceUpdated(LLViewerTexture* src, EBumpEffect bump_cod static LLStaticHashedString sStepY("stepY"); static LLStaticHashedString sBumpCode("bump_code"); - gNormalMapGenProgram.uniform1f(sNormScale, gSavedSettings.getF32("RenderNormalMapScale")); + // Speed optimisation + // gNormalMapGenProgram.uniform1f(sNormScale, gSavedSettings.getF32("RenderNormalMapScale")); + static LLCachedControl RenderNormalMapScale(gSavedSettings, "RenderNormalMapScale"); + gNormalMapGenProgram.uniform1f(sNormScale, RenderNormalMapScale()); + // gNormalMapGenProgram.uniform1f(sStepX, 1.f / bump->getWidth()); gNormalMapGenProgram.uniform1f(sStepY, 1.f / bump->getHeight()); gNormalMapGenProgram.uniform1i(sBumpCode, bump_code); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 916eef6b94..414f4a79df 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5209,9 +5209,10 @@ void LLSelectMgr::deselectAllIfTooFar() // if (gSavedSettings.getBOOL("LimitSelectDistance") // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-0.2.0f static RlvCachedBehaviourModifier s_nFartouchDist(RLV_MODIFIER_FARTOUCHDIST); - + static LLCachedControl limit_select_distance(gSavedSettings, "LimitSelectDistance"); + static LLCachedControl max_select_distance(gSavedSettings, "MaxSelectDistance"); bool fRlvFartouch = gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH) && LLToolMgr::instance().inEdit(); - if ( (gSavedSettings.getBOOL("LimitSelectDistance") || (fRlvFartouch) ) + if ( (limit_select_distance() || (fRlvFartouch) ) // [/RLVa:KB] && (!mSelectedObjects->getPrimaryObject() || !mSelectedObjects->getPrimaryObject()->isAvatar()) && (mSelectedObjects->getPrimaryObject() != LLViewerMediaFocus::getInstance()->getFocusedObject()) @@ -5220,7 +5221,7 @@ void LLSelectMgr::deselectAllIfTooFar() { // F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance"); // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-0.2.0f - F32 deselect_dist = (!fRlvFartouch) ? gSavedSettings.getF32("MaxSelectDistance") : s_nFartouchDist; + F32 deselect_dist = (!fRlvFartouch) ? (F32)max_select_distance() : s_nFartouchDist; // [/RLVa:KB] F32 deselect_dist_sq = deselect_dist * deselect_dist; diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index a86309754b..80c79336a9 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -331,7 +331,11 @@ void LLViewerCamera::setPerspective(bool for_selection, if (limit_select_distance) { // ...select distance from control - z_far = gSavedSettings.getF32("MaxSelectDistance"); + // Speed optimisation + // z_far = gSavedSettings.getF32("MaxSelectDistance"); + static LLCachedControl max_select_distance(gSavedSettings, "MaxSelectDistance"); + z_far = max_select_distance(); + // } else { @@ -841,7 +845,8 @@ bool LLViewerCamera::isDefaultFOVChanged() if(mPrevCameraFOVDefault != mCameraFOVDefault) { mPrevCameraFOVDefault = mCameraFOVDefault; - return !gSavedSettings.getBOOL("IgnoreFOVZoomForLODs"); + static LLCachedControl ignore_fov_zoom_for_lods(gSavedSettings, "IgnoreFOVZoomForLODs"); + return !ignore_fov_zoom_for_lods(); } return false; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index bdec5ad327..71db931afd 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -305,6 +305,12 @@ static void update_tp_display(bool minimized) static LLCachedControl teleport_arrival_delay(gSavedSettings, "TeleportArrivalDelay"); static LLCachedControl teleport_local_delay(gSavedSettings, "TeleportLocalDelay"); + // Speed optimisation + static LLCachedControl disable_teleport_screens(gSavedSettings, "FSDisableTeleportScreens"); + static LLCachedControl reset_camera_on_tp(gSavedSettings, "FSResetCameraOnTP"); + static LLCachedControl nacl_ml_fov_values(gSavedSettings, "_NACL_MLFovValues"); + // + S32 attach_count = 0; if (isAgentAvatarValid()) { @@ -337,7 +343,7 @@ static void update_tp_display(bool minimized) const std::string& msg = LLAgent::sTeleportProgressMessages["pending"]; if (!minimized) { - gViewerWindow->setShowProgress(true, !gSavedSettings.getBOOL("FSDisableTeleportScreens")); + gViewerWindow->setShowProgress(true, !disable_teleport_screens()); // Speed optimisation gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f)); gViewerWindow->setProgressString(msg); } @@ -356,12 +362,12 @@ static void update_tp_display(bool minimized) // If someone knows how to call "View.ZoomDefault" by hand, we should do that instead of // replicating the behavior here. -Zi LLViewerCamera::instance().setDefaultFOV(DEFAULT_FIELD_OF_VIEW); - if (gSavedSettings.getBOOL("FSResetCameraOnTP")) + if (reset_camera_on_tp()) // Speed optimisation { gSavedSettings.setF32("CameraAngle", LLViewerCamera::instance().getView()); // FS:LO Dont reset rightclick zoom when we teleport however. Fixes FIRE-6246. } // also, reset the marker for "currently zooming" in the mouselook zoom settings. -Zi - LLVector3 vTemp = gSavedSettings.getVector3("_NACL_MLFovValues"); + LLVector3 vTemp = nacl_ml_fov_values(); // Speed optimisation vTemp.mV[VZ] = 0.0f; gSavedSettings.setVector3("_NACL_MLFovValues", vTemp); } @@ -374,7 +380,7 @@ static void update_tp_display(bool minimized) FSData::instance().selectNextMOTD(); if (!minimized) { - gViewerWindow->setShowProgress(true, !gSavedSettings.getBOOL("FSDisableTeleportScreens")); + gViewerWindow->setShowProgress(true, !disable_teleport_screens()); // Speed optimisation gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f)); gViewerWindow->setProgressString(msg); gViewerWindow->setProgressMessage(gAgent.mMOTD);