diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-04-02 00:05:57 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-04-05 09:28:26 +0300 |
commit | cc54e206c3ea390a3a14829a4ac40ce5d98f5965 (patch) | |
tree | 775e75eae5c384334b6c08b76754317b9d03a685 | |
parent | 0c056c77f4eddb13e3e7a2a1d3d4b881dc07ea46 (diff) |
#3575 Shrink draw distance when VRAM is very low
-rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 4 |
4 files changed, 8 insertions, 10 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 95f96e85d6..90ee95d424 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -491,7 +491,6 @@ void LLDrawPoolAvatar::beginImpostor() if (!LLPipeline::sReflectionRender) { - LLVOAvatar::sRenderDistance = llclamp(LLVOAvatar::sRenderDistance, 16.f, 256.f); LLVOAvatar::sNumVisibleAvatars = 0; } @@ -547,7 +546,6 @@ void LLDrawPoolAvatar::beginDeferredImpostor() if (!LLPipeline::sReflectionRender) { - LLVOAvatar::sRenderDistance = llclamp(LLVOAvatar::sRenderDistance, 16.f, 256.f); LLVOAvatar::sNumVisibleAvatars = 0; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 32019f860d..27718782ee 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -215,11 +215,15 @@ void display_update_camera() final_far = gSavedSettings.getF32("RenderReflectionProbeDrawDistance"); } else if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode()) - { final_far *= 0.5f; } + else if (LLViewerTexture::sDesiredDiscardBias > 2.f) + { + final_far = llmax(32.f, final_far / (LLViewerTexture::sDesiredDiscardBias - 1.f)); + } LLViewerCamera::getInstance()->setFar(final_far); + LLVOAvatar::sRenderDistance = llclamp(final_far, 16.f, 256.f); gViewerWindow->setup3DRender(); if (!gCubeSnapshot) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index de530976ea..3306289f51 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -10963,8 +10963,7 @@ void LLVOAvatar::idleUpdateRenderComplexity() bool autotune = LLPerfStats::tunables.userAutoTuneEnabled && !mIsControlAvatar && !isSelf(); if (autotune && !isDead()) { - static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64); - F32 radius = render_far_clip * render_far_clip; + F32 radius = sRenderDistance * sRenderDistance; bool is_nearby = true; if ((dist_vec_squared(getPositionGlobal(), gAgent.getPositionGlobal()) > radius) && @@ -10996,8 +10995,7 @@ void LLVOAvatar::updateNearbyAvatarCount() if (agent_update_timer.getElapsedTimeF32() > 1.0f) { S32 avs_nearby = 0; - static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64); - F32 radius = render_far_clip * render_far_clip; + F32 radius = sRenderDistance * sRenderDistance; for (LLCharacter* character : LLCharacter::sInstances) { LLVOAvatar* avatar = (LLVOAvatar*)character; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 899733ccc3..47e1815bc2 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -1372,10 +1372,8 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi F32 LLWorld::getNearbyAvatarsAndMaxGPUTime(std::vector<LLVOAvatar*> &valid_nearby_avs) { - static LLCachedControl<F32> render_far_clip(gSavedSettings, "RenderFarClip", 64); - F32 nearby_max_complexity = 0; - F32 radius = render_far_clip * render_far_clip; + F32 radius = LLVOAvatar::sRenderDistance * LLVOAvatar::sRenderDistance; for (LLCharacter* character : LLCharacter::sInstances) { |