Some speed optimisation attempts via LLCachedControl

Signed-off-by: PanteraPolnocy <panterapolnocy@gmail.com>
This commit is contained in:
PanteraPolnocy
2026-06-19 21:08:53 +02:00
parent 2584b7692d
commit bf55249dd2
5 changed files with 40 additions and 13 deletions
+14 -3
View File
@@ -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);
// <FS:PP> 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<F32> yaw_from_mouse_position(gSavedSettings, "YawFromMousePosition");
static LLCachedControl<F32> 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);
// </FS:PP>
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);
// <FS:PP> Speed optimisation
// F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, false);
static LLCachedControl<F32> camera_position_smoothing(gSavedSettings, "CameraPositionSmoothing");
F32 smoothing = LLSmoothInterpolation::getInterpolant(camera_position_smoothing() * SMOOTHING_HALF_LIFE, false);
// </FS:PP>
if (mFocusOnAvatar && !mFocusObject) // we differentiate on avatar mode
{
+5 -1
View File
@@ -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"));
// <FS:PP> Speed optimisation
// gNormalMapGenProgram.uniform1f(sNormScale, gSavedSettings.getF32("RenderNormalMapScale"));
static LLCachedControl<F32> RenderNormalMapScale(gSavedSettings, "RenderNormalMapScale");
gNormalMapGenProgram.uniform1f(sNormScale, RenderNormalMapScale());
// </FS:PP>
gNormalMapGenProgram.uniform1f(sStepX, 1.f / bump->getWidth());
gNormalMapGenProgram.uniform1f(sStepY, 1.f / bump->getHeight());
gNormalMapGenProgram.uniform1i(sBumpCode, bump_code);
+4 -3
View File
@@ -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<float> s_nFartouchDist(RLV_MODIFIER_FARTOUCHDIST);
static LLCachedControl<bool> limit_select_distance(gSavedSettings, "LimitSelectDistance");
static LLCachedControl<F32> 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;
+7 -2
View File
@@ -331,7 +331,11 @@ void LLViewerCamera::setPerspective(bool for_selection,
if (limit_select_distance)
{
// ...select distance from control
z_far = gSavedSettings.getF32("MaxSelectDistance");
// <FS:PP> Speed optimisation
// z_far = gSavedSettings.getF32("MaxSelectDistance");
static LLCachedControl<F32> max_select_distance(gSavedSettings, "MaxSelectDistance");
z_far = max_select_distance();
// </FS:PP>
}
else
{
@@ -841,7 +845,8 @@ bool LLViewerCamera::isDefaultFOVChanged()
if(mPrevCameraFOVDefault != mCameraFOVDefault)
{
mPrevCameraFOVDefault = mCameraFOVDefault;
return !gSavedSettings.getBOOL("IgnoreFOVZoomForLODs");
static LLCachedControl<bool> ignore_fov_zoom_for_lods(gSavedSettings, "IgnoreFOVZoomForLODs");
return !ignore_fov_zoom_for_lods();
}
return false;
}
+10 -4
View File
@@ -305,6 +305,12 @@ static void update_tp_display(bool minimized)
static LLCachedControl<F32> teleport_arrival_delay(gSavedSettings, "TeleportArrivalDelay");
static LLCachedControl<F32> teleport_local_delay(gSavedSettings, "TeleportLocalDelay");
// <FS:PP> Speed optimisation
static LLCachedControl<bool> disable_teleport_screens(gSavedSettings, "FSDisableTeleportScreens");
static LLCachedControl<bool> reset_camera_on_tp(gSavedSettings, "FSResetCameraOnTP");
static LLCachedControl<LLVector3> nacl_ml_fov_values(gSavedSettings, "_NACL_MLFovValues");
// </FS:PP>
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()); // <FS:PP> 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()) // <FS:PP> 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(); // <FS:PP> 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()); // <FS:PP> Speed optimisation
gViewerWindow->setProgressPercent(llmin(teleport_percent, 0.0f));
gViewerWindow->setProgressString(msg);
gViewerWindow->setProgressMessage(gAgent.mMOTD);