From 81170e9fc138232f94c12a3cdd9e7f10e35868dd Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 8 Sep 2021 15:32:10 +0300 Subject: [PATCH 01/99] SL-15954 FIXED 'Hide avatars completely' doesn't hide attached animeshes --- indra/newview/lldrawpoolavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 687b13d2c8..eb0bd0de4e 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1526,7 +1526,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) } LLVOAvatar *attached_av = avatarp->getAttachedAvatar(); - if (attached_av && LLVOAvatar::AOA_NORMAL != attached_av->getOverallAppearance()) + if (attached_av && (LLVOAvatar::AOA_NORMAL != attached_av->getOverallAppearance() || !gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR))) { // Animesh attachment of a jellydolled or invisible parent - don't show return; From f145d0dbe1d1f28c3e874b77b965e6e07066f39a Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 21 Jan 2022 16:18:54 -0600 Subject: [PATCH 02/99] SL-16447 Adjust default graphics preferences based on modern memory bandwidth levels and bias settings based on CPU speed. --- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ indra/newview/llfeaturemanager.cpp | 17 ++++++++++++----- indra/newview/llglsandbox.cpp | 1 + 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0ccf74e923..60c415bc9e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8770,6 +8770,28 @@ Value 1 + RenderClass0MemoryBandwidth + + Comment + Memory bandwidth at which to default to Class 0 in gigabytes per second. Used as basis for other classes. + Persist + 1 + Type + F32 + Value + 16.0 + + RenderCPUBasis + + Comment + Reference CPU clockspeed to use to bias GPU class (in MHz). + Persist + 1 + Type + F32 + Value + 3000.0 + RenderComplexityColorMin Comment diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 3240f169b3..c3780e42c6 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -402,6 +402,7 @@ bool LLFeatureManager::loadGPUClass() { if (!gSavedSettings.getBOOL("SkipBenchmark")) { + F32 class0_gbps = gSavedSettings.getF32("RenderClass0MemoryBandwidth"); //get memory bandwidth from benchmark F32 gbps; try @@ -418,6 +419,12 @@ bool LLFeatureManager::loadGPUClass() LL_WARNS("RenderInit") << "GPU benchmark failed: " << e.what() << LL_ENDL; } + // bias by CPU speed + F32 cpu_basis_mhz = gSavedSettings.getF32("RenderCPUBasis"); + F32 cpu_mhz = (F32) gSysCPU.getMHz(); + F32 cpu_bias = llclamp(cpu_mhz / cpu_basis_mhz, 0.5f, 1.f); + gbps *= cpu_bias; + if (gbps < 0.f) { //couldn't bench, use GLVersion #if LL_DARWIN @@ -460,23 +467,23 @@ bool LLFeatureManager::loadGPUClass() { mGPUClass = GPU_CLASS_1; } - else if (gbps <= 5.f) + else if (gbps <= class0_gbps) { mGPUClass = GPU_CLASS_0; } - else if (gbps <= 8.f) + else if (gbps <= class0_gbps*2.f) { mGPUClass = GPU_CLASS_1; } - else if (gbps <= 16.f) + else if (gbps <= class0_gbps*4.f) { mGPUClass = GPU_CLASS_2; } - else if (gbps <= 40.f) + else if (gbps <= class0_gbps*8.f) { mGPUClass = GPU_CLASS_3; } - else if (gbps <= 80.f) + else if (gbps <= class0_gbps*16.f) { mGPUClass = GPU_CLASS_4; } diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 175f1849cf..0c8e248538 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -984,6 +984,7 @@ private: //----------------------------------------------------------------------------- // gpu_benchmark() +// returns measured memory bandwidth of GPU in gigabytes per second //----------------------------------------------------------------------------- F32 gpu_benchmark() { From 374a516d97af2255206374c001ba20c8069685b6 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Fri, 21 Jan 2022 16:43:49 -0600 Subject: [PATCH 03/99] SL-16683 Adjust max number of non-impostored avatars and mesh geometry detail based on graphics settings preset. --- indra/newview/featuretable.txt | 14 ++++++++++---- indra/newview/featuretable_mac.txt | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 4e56141fde..a5e0e395de 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -113,6 +113,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 RenderAvatarMaxComplexity 1 100000 RenderAvatarPhysicsLODFactor 1 0.75 +RenderAvatarMaxNonImpostors 1 5 RenderFarClip 1 96 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 8 @@ -142,6 +143,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 200000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 7 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -153,7 +155,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.25 WindLightUseAtmosShaders 1 1 RenderDeferred 1 0 RenderDeferredSSAO 1 0 @@ -171,6 +173,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 250000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 9 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -182,7 +185,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.375 WindLightUseAtmosShaders 1 1 RenderDeferred 1 1 RenderDeferredSSAO 1 0 @@ -200,6 +203,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 300000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 11 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -211,7 +215,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.5 WindLightUseAtmosShaders 1 1 RenderDeferred 1 1 RenderDeferredSSAO 1 1 @@ -229,6 +233,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 350000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -240,7 +245,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.75 WindLightUseAtmosShaders 1 1 RenderDeferred 1 1 RenderDeferredSSAO 1 1 @@ -256,6 +261,7 @@ list Ultra RenderAnisotropic 1 1 RenderAvatarCloth 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 256 RenderFlexTimeFactor 1 1.0 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 13ede23a91..5140614bab 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -112,6 +112,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 RenderAvatarMaxComplexity 1 100000 RenderAvatarPhysicsLODFactor 1 0.75 +RenderAvatarMaxNonImpostors 1 5 RenderFarClip 1 96 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 8 @@ -141,6 +142,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 200000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 7 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -152,7 +154,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.25 WindLightUseAtmosShaders 1 1 RenderDeferred 1 0 RenderDeferredSSAO 1 0 @@ -170,6 +172,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 250000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 9 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -181,7 +184,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.375 WindLightUseAtmosShaders 1 1 RenderDeferred 1 1 RenderDeferredSSAO 1 0 @@ -199,6 +202,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 300000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 11 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -210,7 +214,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.5 WindLightUseAtmosShaders 1 1 RenderDeferred 1 1 RenderDeferredSSAO 1 1 @@ -226,6 +230,7 @@ list HighUltra RenderAnisotropic 1 1 RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarMaxComplexity 1 350000 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 128 @@ -239,7 +244,7 @@ RenderTerrainDetail 1 1 RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 0.5 -RenderVolumeLODFactor 1 1.125 +RenderVolumeLODFactor 1 1.75 WindLightUseAtmosShaders 1 1 RenderDeferred 1 1 RenderDeferredSSAO 1 1 @@ -256,6 +261,7 @@ RenderAnisotropic 1 1 RenderAvatarCloth 1 1 RenderAvatarLODFactor 1 1.0 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderFarClip 1 256 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 From 8e928652c71e250c3e1dff43edab60807277ca22 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 22 Jan 2022 11:39:55 +0100 Subject: [PATCH 04/99] Adjust LL standard LOD --- indra/newview/llpanelobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 85760d5fe2..bda3bb356b 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -1546,7 +1546,7 @@ void LLPanelObject::activateMeshFields(LLViewerObject * objectp) childSetVisible("ObjectLODbehaviourLabel", true); // Setup the LL defaults - factor = 1.125f; // LL default for most people http://wiki.firestormviewer.org/support:whirly_fizzle#lod_comparison + factor = 1.25f; // LL default for most people http://wiki.firestormviewer.org/support:whirly_fizzle#lod_comparison args["FACTOR"] = llformat("%.3f", factor); tb = getChild("LOD_swap_ll_default"); tb->setToolTip(getString("ll_lod_tooltip_msg",args)); From 3a33828706a5fe746a9a8da3bec7d94332732bf0 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 22 Jan 2022 11:43:32 +0100 Subject: [PATCH 05/99] Adjust Linux feature table --- indra/newview/featuretable_linux.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 56b766e993..b7ab89aaa4 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -4,7 +4,7 @@ version 29 // resetting the graphics preferences of all users to the recommended // defaults. This should be as rare an event as we can manage. -// NOTE: This is mostly identical to featuretable_mac.txt with a few differences +// NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table // @@ -113,6 +113,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 0.5 RenderAvatarMaxComplexity 1 100000 RenderAvatarPhysicsLODFactor 1 0.75 +RenderAvatarMaxNonImpostors 1 5 RenderFarClip 1 96 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 8 @@ -142,6 +143,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 200000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 7 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -171,6 +173,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 250000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 9 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -200,6 +203,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 300000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 11 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -229,6 +233,7 @@ RenderAvatarCloth 1 0 RenderAvatarLODFactor 1 1.0 RenderAvatarMaxComplexity 1 350000 RenderAvatarPhysicsLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderFarClip 1 128 RenderFlexTimeFactor 1 1.0 RenderGlowResolutionPow 1 9 @@ -256,6 +261,7 @@ list Ultra RenderAnisotropic 1 1 RenderAvatarCloth 1 1 RenderAvatarLODFactor 1 1.0 +RenderAvatarMaxNonImpostors 1 16 RenderAvatarPhysicsLODFactor 1 1.0 RenderFarClip 1 256 RenderFlexTimeFactor 1 1.0 From d7603ffc9c94a6cdab94bc23745903c7fff25ff1 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 24 Jan 2022 16:33:44 +0200 Subject: [PATCH 06/99] SL-16627 AutoFPS first pass --- indra/newview/app_settings/settings.xml | 57 +++++++++ indra/newview/llagent.cpp | 4 + indra/newview/llfloaterperformance.cpp | 50 ++++---- indra/newview/llfloaterperformance.h | 4 +- indra/newview/llfloaterpreference.cpp | 18 +++ indra/newview/llfloaterpreference.h | 2 + .../llfloaterpreferencesgraphicsadvanced.cpp | 37 +++++- .../llfloaterpreferencesgraphicsadvanced.h | 2 + indra/newview/llviewerdisplay.cpp | 2 + indra/newview/llworld.cpp | 27 ++++ indra/newview/llworld.h | 3 + indra/newview/pipeline.cpp | 120 +++++++++++++++++- indra/newview/pipeline.h | 6 +- .../floater_preferences_graphics_advanced.xml | 9 +- .../skins/default/xui/en/notifications.xml | 13 ++ .../xui/en/panel_performance_preferences.xml | 5 +- .../xui/en/panel_preferences_graphics1.xml | 19 ++- 17 files changed, 337 insertions(+), 41 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0ccf74e923..442ac8895c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16620,6 +16620,63 @@ Value 0 + AutoFPS + + Comment + + Allow dynamic adjustment of graphics preferences + + Persist + 1 + Type + Boolean + Value + 0 + + AutoAdjustmentTimeout + + Comment + Time before next iteration of automatic adjustments + Persist + 1 + Type + F32 + Value + 5 + + InitialAdjustmentTimeout + + Comment + Time before first iteration of automatic adjustments after login to the world, teleporting, maximizing Viewer etc. + Persist + 1 + Type + F32 + Value + 10 + + AutoFPSLowerBoundary + + Comment + FPS lower boundary when automatic adjustments are occured to reduce graphics quality to increase FPS + Persist + 1 + Type + S32 + Value + 30 + + AutoFPSUpperBoundary + + Comment + FPS upper boundary when automatic adjustments are occured to increase graphics quality + Persist + 1 + Type + S32 + Value + 50 + CameraOpacity Comment diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index de382d4e23..b377d099be 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4078,6 +4078,8 @@ void LLAgent::handleTeleportFinished() mRegionp->setCapabilitiesReceivedCallback(boost::bind(&LLAgent::onCapabilitiesReceivedAfterTeleport)); } } + + gPipeline.setAdjustmentTimerExpiry(gSavedSettings.getF32("InitialAdjustmentTimeout")); } void LLAgent::handleTeleportFailed() @@ -4109,6 +4111,8 @@ void LLAgent::handleTeleportFailed() } mTPNeedsNeabyChatSeparator = false; + + gPipeline.setAdjustmentTimerExpiry(gSavedSettings.getF32("InitialAdjustmentTimeout")); } /*static*/ diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index e53154dd75..e44c161b27 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -36,13 +36,15 @@ #include "llfloaterpreference.h" // LLAvatarComplexityControls #include "llfloaterreg.h" #include "llnamelistctrl.h" +#include "llnotificationsutil.h" #include "llradiogroup.h" #include "llsliderctrl.h" #include "lltextbox.h" #include "lltrans.h" #include "llviewerobjectlist.h" #include "llvoavatar.h" -#include "llvoavatarself.h" +#include "llvoavatarself.h" +#include "llworld.h" #include "pipeline.h" const F32 REFRESH_INTERVAL = 1.0f; @@ -77,6 +79,8 @@ LLFloaterPerformance::LLFloaterPerformance(const LLSD& key) mNearbyMaxComplexity(0) { mContextMenu = new LLExceptionsContextMenu(this); + + mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPerformance::onUICtrlMouseDown, this)); } LLFloaterPerformance::~LLFloaterPerformance() @@ -328,7 +332,7 @@ void LLFloaterPerformance::populateNearbyList() static LLCachedControl max_render_cost(gSavedSettings, "RenderAvatarMaxComplexity", 0); std::vector valid_nearby_avs; - getNearbyAvatars(valid_nearby_avs); + mNearbyMaxComplexity = LLWorld::getInstance()->getNearbyAvatarsAndCompl(valid_nearby_avs); std::vector::iterator char_iter = valid_nearby_avs.begin(); while (char_iter != valid_nearby_avs.end()) @@ -401,31 +405,6 @@ void LLFloaterPerformance::populateNearbyList() mNearbyList->selectByID(prev_selected_id); } -void LLFloaterPerformance::getNearbyAvatars(std::vector &valid_nearby_avs) -{ - static LLCachedControl render_far_clip(gSavedSettings, "RenderFarClip", 64); - mNearbyMaxComplexity = 0; - F32 radius = render_far_clip * render_far_clip; - std::vector::iterator char_iter = LLCharacter::sInstances.begin(); - while (char_iter != LLCharacter::sInstances.end()) - { - LLVOAvatar* avatar = dynamic_cast(*char_iter); - if (avatar && !avatar->isDead() && !avatar->isControlAvatar()) - { - if ((dist_vec_squared(avatar->getPositionGlobal(), gAgent.getPositionGlobal()) > radius) && - (dist_vec_squared(avatar->getPositionGlobal(), gAgentCamera.getCameraPositionGlobal()) > radius)) - { - char_iter++; - continue; - } - avatar->calculateUpdateRenderComplexity(); - mNearbyMaxComplexity = llmax(mNearbyMaxComplexity, (S32)avatar->getVisualComplexity()); - valid_nearby_avs.push_back(*char_iter); - } - char_iter++; - } -} - void LLFloaterPerformance::detachItem(const LLUUID& item_id) { LLAppearanceMgr::instance().removeItemFromAvatar(item_id); @@ -561,4 +540,21 @@ void LLFloaterPerformance::onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y) } } +void LLFloaterPerformance::onUICtrlMouseDown() +{ + static LLCachedControl use_auto_adjust(gSavedSettings,"AutoFPS"); + if (use_auto_adjust) + { + LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), + [this](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + gSavedSettings.setBOOL("AutoFPS", FALSE); + } + }); + } +} + // EOF diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index a5549685f6..7a1394c51b 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -63,11 +63,11 @@ private: void onClickHideAvatars(); void onClickExceptions(); + void onUICtrlMouseDown(); + void updateMaxComplexity(); void updateComplexityText(); - void getNearbyAvatars(std::vector &valid_nearby_avs); - LLPanel* mMainPanel; LLPanel* mNearbyPanel; LLPanel* mComplexityPanel; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 8ea5519929..fbc3275b1e 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -304,6 +304,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.RememberedUsernames", boost::bind(&LLFloaterPreference::onClickRememberedUsernames, this)); mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); + mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPreference::onUICtrlMouseDown, this)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -1782,6 +1783,23 @@ void LLFloaterPreference::updateSearchableItems() mSearchDataDirty = true; } +void LLFloaterPreference::onUICtrlMouseDown() +{ + static LLCachedControl use_auto_adjust(gSavedSettings,"AutoFPS"); + if (use_auto_adjust) + { + LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), + [this](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + gSavedSettings.setBOOL("AutoFPS", FALSE); + } + }); + } +} + void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 788db960f0..8a68f9f279 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -110,6 +110,8 @@ public: void updateClickActionViews(); void updateSearchableItems(); + void onUICtrlMouseDown(); + void onBtnOK(const LLSD& userdata); void onBtnCancel(const LLSD& userdata); diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index af5296117b..fdc36077a8 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -32,6 +32,7 @@ #include "llfeaturemanager.h" #include "llfloaterpreference.h" #include "llfloaterreg.h" +#include "llnotificationsutil.h" #include "llsliderctrl.h" #include "lltextbox.h" #include "lltrans.h" @@ -48,8 +49,12 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); + mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onUICtrlMouseDown, this)); + mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnCancel, this, _2)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnOK, this, _2)); + + gSavedSettings.getControl("RenderAvatarMaxNonImpostors")->getSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateIndirectMaxNonImpostors, this, _2)); } LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() @@ -190,6 +195,23 @@ void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, L } } +void LLFloaterPreferenceGraphicsAdvanced::onUICtrlMouseDown() +{ + static LLCachedControl use_auto_adjust(gSavedSettings,"AutoFPS"); + if (use_auto_adjust) + { + LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), + [this](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + gSavedSettings.setBOOL("AutoFPS", FALSE); + } + }); + } +} + void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors() { // Called when the IndirectMaxNonImpostors control changes @@ -206,6 +228,16 @@ void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors() setMaxNonImpostorsText(value, getChild("IndirectMaxNonImpostorsText")); } +void LLFloaterPreferenceGraphicsAdvanced::updateIndirectMaxNonImpostors(const LLSD& newvalue) +{ + U32 value = newvalue.asInteger(); + if ((value != 0) && (value != gSavedSettings.getU32("IndirectMaxNonImpostors"))) + { + gSavedSettings.setU32("IndirectMaxNonImpostors", value); + setMaxNonImpostorsText(value, getChild("IndirectMaxNonImpostorsText")); + } +} + void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTextBox* text_box) { if (0 == value) @@ -340,9 +372,6 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() ctrl_reflections->setEnabled(reflections); reflections_text->setEnabled(reflections); - // Transparent Water - LLCheckBoxCtrl* transparent_water_ctrl = getChild("TransparentWater"); - // Bump & Shiny LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); @@ -393,9 +422,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() BOOL enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? TRUE : FALSE) && - ((transparent_water_ctrl && transparent_water_ctrl->get()) ? TRUE : FALSE) && gGLManager.mHasFramebufferObject && - gSavedSettings.getBOOL("RenderAvatarVP") && (ctrl_wind_light->get()) ? TRUE : FALSE; ctrl_deferred->setEnabled(enabled); diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.h b/indra/newview/llfloaterpreferencesgraphicsadvanced.h index c5d21ba35b..cf3ed02614 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.h +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.h @@ -45,6 +45,8 @@ public: void refreshEnabledState(); void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); void updateMaxNonImpostors(); + void updateIndirectMaxNonImpostors(const LLSD& newvalue); + void onUICtrlMouseDown(); void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); void updateMaxComplexity(); void updateComplexityText(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index b5d3dc5d30..a26331251c 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1024,6 +1024,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gPipeline.clearReferences(); gPipeline.rebuildGroups(); + + gPipeline.autoAdjustSettings(); } LLAppViewer::instance()->pingMainloopTimeout("Display:FrameStats"); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 6746a3a902..0a2ad82354 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -33,6 +33,7 @@ #include "llstl.h" #include "llagent.h" +#include "llagentcamera.h" #include "llviewercontrol.h" #include "lldrawpool.h" #include "llglheaders.h" @@ -1396,6 +1397,32 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positi } } +S32 LLWorld::getNearbyAvatarsAndCompl(std::vector &valid_nearby_avs) +{ + static LLCachedControl render_far_clip(gSavedSettings, "RenderFarClip", 64); + S32 nearby_max_complexity = 0; + F32 radius = render_far_clip * render_far_clip; + std::vector::iterator char_iter = LLCharacter::sInstances.begin(); + while (char_iter != LLCharacter::sInstances.end()) + { + LLVOAvatar* avatar = dynamic_cast(*char_iter); + if (avatar && !avatar->isDead() && !avatar->isControlAvatar()) + { + if ((dist_vec_squared(avatar->getPositionGlobal(), gAgent.getPositionGlobal()) > radius) && + (dist_vec_squared(avatar->getPositionGlobal(), gAgentCamera.getCameraPositionGlobal()) > radius)) + { + char_iter++; + continue; + } + avatar->calculateUpdateRenderComplexity(); + nearby_max_complexity = llmax(nearby_max_complexity, (S32)avatar->getVisualComplexity()); + valid_nearby_avs.push_back(*char_iter); + } + char_iter++; + } + return nearby_max_complexity; +} + bool LLWorld::isRegionListed(const LLViewerRegion* region) const { region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 69f2df4203..1c12ad0e2c 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -51,6 +51,7 @@ class LLHost; class LLViewerObject; class LLSurfacePatch; +class LLCharacter; class LLCloudPuff; class LLCloudGroup; class LLVOAvatar; @@ -172,6 +173,8 @@ public: // or if the circuit to this simulator had been lost. bool isRegionListed(const LLViewerRegion* region) const; + S32 getNearbyAvatarsAndCompl(std::vector &valid_nearby_avs); + private: region_list_t mActiveRegionList; region_list_t mRegionList; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index dd9999d73a..96dd0b895d 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -43,6 +43,7 @@ #include "llui.h" #include "llglheaders.h" #include "llrender.h" +#include "llstartup.h" #include "llwindow.h" // swapBuffers() // newview includes @@ -405,7 +406,8 @@ LLPipeline::LLPipeline() : mLightMovingMask(0), mLightingDetail(0), mScreenWidth(0), - mScreenHeight(0) + mScreenHeight(0), + mUpdateTimer(new LLTimer()) { mNoiseMap = 0; mTrueNoiseMap = 0; @@ -613,7 +615,7 @@ void LLPipeline::init() LLPipeline::~LLPipeline() { - + delete mUpdateTimer; } void LLPipeline::cleanup() @@ -11428,3 +11430,117 @@ void LLPipeline::restoreHiddenObject( const LLUUID& id ) } } +const F32 MIN_DRAW_DISTANCE = 64; +const F32 MAX_DRAW_DISTANCE = 256; + +void update_far_clip(F32 fps_dif) +{ + F32 DIST_PER_FRAME_DIF = 16; + + F32 new_far_clip = llclamp(LLPipeline::RenderFarClip - llmin(fps_dif * DIST_PER_FRAME_DIF, (F32)128), MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE); + gSavedSettings.setF32("RenderFarClip", new_far_clip); +} + +void update_max_non_impostors(F32 fps_dif, S32 max_avatars) +{ + const F32 IMPOSTORS_PER_FRAME_DIF = 0.5; + + U32 new_non_imp = (U32)llclamp((S32)(LLVOAvatar::sMaxNonImpostors - llmin((S32)(fps_dif / IMPOSTORS_PER_FRAME_DIF), 10)), 1, max_avatars); + gSavedSettings.setU32("RenderAvatarMaxNonImpostors", new_non_imp); +} + +void LLPipeline::autoAdjustSettings() +{ + static LLCachedControl use_auto_adjustment(gSavedSettings,"AutoFPS"); + if (!use_auto_adjustment) + { + return; + } + + if (LLStartUp::getStartupState() < STATE_STARTED || LLApp::isExiting()) + { + return; + } + + static LLCachedControl adjustment_timeout(gSavedSettings, "AutoAdjustmentTimeout"); + static LLCachedControl initial_adjustment_timeout(gSavedSettings, "InitialAdjustmentTimeout"); + + static LLCachedControl fps_lower_boundary(gSavedSettings, "AutoFPSLowerBoundary"); + static LLCachedControl fps_upper_boundary(gSavedSettings, "AutoFPSUpperBoundary"); + + if (gViewerWindow && gViewerWindow->getWindow()->getVisible() + && gFocusMgr.getAppHasFocus() && !gTeleportDisplay) + { + static bool is_init = false; + if (!is_init) + { + //wait for FPS to stabilize after login in-world + mUpdateTimer->setTimerExpirySec((F32)initial_adjustment_timeout); + is_init = true; + } + if (mUpdateTimer->hasExpired()) + { + mUpdateTimer->setTimerExpirySec((F32)adjustment_timeout); + + const S32 FPS_STAT_PERIODS = 50; + S32 fps = (S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, FPS_STAT_PERIODS)); + if (fps < fps_lower_boundary) + { + S32 fps_dif = fps_lower_boundary - fps; + + if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0) + { + S32 shadow_detail = RenderShadowDetail - 1; + gSavedSettings.setS32("RenderShadowDetail", shadow_detail); + return; + } + + if (RenderFarClip > MIN_DRAW_DISTANCE) + { + update_far_clip(fps_dif); + } + + std::vector valid_nearby_avs; + LLWorld::getInstance()->getNearbyAvatarsAndCompl(valid_nearby_avs); + + if (valid_nearby_avs.size() > 1 && LLVOAvatar::sMaxNonImpostors > 1) + { + update_max_non_impostors(fps_dif, valid_nearby_avs.size()); + } + } + else if (fps > fps_upper_boundary) + { + S32 fps_dif = fps_upper_boundary - fps; + + std::vector valid_nearby_avs; + LLWorld::getInstance()->getNearbyAvatarsAndCompl(valid_nearby_avs); + if (valid_nearby_avs.size() > 1 && (LLVOAvatar::sMaxNonImpostors < valid_nearby_avs.size())) + { + update_max_non_impostors(fps_dif, valid_nearby_avs.size()); + return; + } + + if (RenderFarClip < MAX_DRAW_DISTANCE) + { + update_far_clip(fps_dif); + } + + if (LLPipeline::sRenderDeferred && RenderShadowDetail < 2) + { + S32 shadow_detail = RenderShadowDetail + 1; + gSavedSettings.setS32("RenderShadowDetail", shadow_detail); + } + } + } + } + else + { + //wait for FPS to stabilize if the window was minimized or not focused before + mUpdateTimer->setTimerExpirySec((F32)initial_adjustment_timeout); + } +} + +void LLPipeline::setAdjustmentTimerExpiry(F32 expiration) +{ + mUpdateTimer->setTimerExpirySec(expiration); +} diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index fdc3738472..7eff573a34 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -424,6 +424,9 @@ public: void hideObject( const LLUUID& id ); void restoreHiddenObject( const LLUUID& id ); + void autoAdjustSettings(); + void setAdjustmentTimerExpiry(F32 expiration); + private: void unloadShaders(); void addToQuickLookup( LLDrawPool* new_poolp ); @@ -715,7 +718,8 @@ protected: U64 mOldRenderDebugMask; std::stack mRenderDebugFeatureStack; - + LLTimer* mUpdateTimer; + ///////////////////////////////////////////// // // diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index d1e167df64..5978ae685a 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -39,7 +39,10 @@ max_val="512" name="DrawDistance" top_delta="16" - width="330" /> + width="330"> + + + + fail + + Changing this setting will disable automatic adjustment and turn off 'Auto FPS' setting. +Are you sure you want to continue? + confirm + + + + width="250"> + + + width="330"> + + + + + Date: Mon, 24 Jan 2022 18:38:25 +0200 Subject: [PATCH 07/99] SL-16627 build fix --- indra/newview/llfloaterperformance.cpp | 2 +- indra/newview/llfloaterpreference.cpp | 2 +- indra/newview/llfloaterpreferencesgraphicsadvanced.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index e44c161b27..316b9ab1b6 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -546,7 +546,7 @@ void LLFloaterPerformance::onUICtrlMouseDown() if (use_auto_adjust) { LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), - [this](const LLSD¬if, const LLSD&resp) + [](const LLSD¬if, const LLSD&resp) { S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); if (opt == 0) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index fbc3275b1e..b655a04b14 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1789,7 +1789,7 @@ void LLFloaterPreference::onUICtrlMouseDown() if (use_auto_adjust) { LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), - [this](const LLSD¬if, const LLSD&resp) + [](const LLSD¬if, const LLSD&resp) { S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); if (opt == 0) diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index fdc36077a8..548a6eb769 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -201,7 +201,7 @@ void LLFloaterPreferenceGraphicsAdvanced::onUICtrlMouseDown() if (use_auto_adjust) { LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), - [this](const LLSD¬if, const LLSD&resp) + [](const LLSD¬if, const LLSD&resp) { S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); if (opt == 0) From 9c7ec66d248369ebfb589a9c84cf951f8d4b93b5 Mon Sep 17 00:00:00 2001 From: Runitai Linden Date: Mon, 24 Jan 2022 11:04:11 -0600 Subject: [PATCH 08/99] SL-16691 Add GPU memory bandwidth to ViewerStats --- indra/newview/llfeaturemanager.cpp | 2 ++ indra/newview/llfeaturemanager.h | 5 +++++ indra/newview/llviewerstats.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index c3780e42c6..0813057714 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -419,6 +419,8 @@ bool LLFeatureManager::loadGPUClass() LL_WARNS("RenderInit") << "GPU benchmark failed: " << e.what() << LL_ENDL; } + mGPUMemoryBandwidth = gbps; + // bias by CPU speed F32 cpu_basis_mhz = gSavedSettings.getF32("RenderCPUBasis"); F32 cpu_mhz = (F32) gSysCPU.getMHz(); diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index 42a226cd18..651404d890 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -111,6 +111,10 @@ public: EGPUClass getGPUClass() { return mGPUClass; } std::string& getGPUString() { return mGPUString; } + + // get the measured GPU memory bandwidth in GB/sec + // may return 0 of benchmark has not been run or failed to run + F32 getGPUMemoryBandwidth() { return mGPUMemoryBandwidth; } BOOL isGPUSupported() { return mGPUSupported; } F32 getExpectedGLVersion() { return mExpectedGLVersion; } @@ -162,6 +166,7 @@ protected: S32 mTableVersion; BOOL mSafe; // Reinitialize everything to the "safe" mask EGPUClass mGPUClass; + F32 mGPUMemoryBandwidth = 0.f; // measured memory bandwidth of GPU in GB/second F32 mExpectedGLVersion; //expected GL version according to gpu table std::string mGPUString; BOOL mGPUSupported; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 5ce97c086d..a560778ef4 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -512,6 +512,7 @@ void send_viewer_stats(bool include_preferences) system["gpu"] = gpu_desc; system["gpu_class"] = (S32)LLFeatureManager::getInstance()->getGPUClass(); + system["gpu_memory_bandwidth"] = LLFeatureManager::getInstance()->getGPUMemoryBandwidth(); system["gpu_vendor"] = gGLManager.mGLVendorShort; system["gpu_version"] = gGLManager.mDriverVersionVendorString; system["opengl_version"] = gGLManager.mGLVersionString; From b50de181623874ab799fdc31532dffe8f7bc610a Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 25 Jan 2022 19:43:32 +0200 Subject: [PATCH 09/99] SL-16627 add auto-adjustment warning for affected settings --- indra/llui/llcombobox.cpp | 18 +++++++++++++++++- indra/llui/llcombobox.h | 5 +++++ indra/newview/llfloaterperformance.cpp | 19 +------------------ indra/newview/llfloaterperformance.h | 2 -- indra/newview/llfloaterpreference.cpp | 4 ++-- indra/newview/llfloaterpreference.h | 2 +- .../llfloaterpreferencesgraphicsadvanced.cpp | 19 +------------------ .../llfloaterpreferencesgraphicsadvanced.h | 1 - .../floater_preferences_graphics_advanced.xml | 6 +++--- .../xui/en/panel_performance_preferences.xml | 2 +- .../xui/en/panel_preferences_graphics1.xml | 2 +- 11 files changed, 32 insertions(+), 48 deletions(-) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index bcc653a602..5768686659 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -78,6 +78,7 @@ LLComboBox::Params::Params() combo_button("combo_button"), combo_list("combo_list"), combo_editor("combo_editor"), + mouse_down_callback("mouse_down_callback"), drop_down_button("drop_down_button") { addSynonym(items, "combo_item"); @@ -97,7 +98,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mTextChangedCallback(p.text_changed_callback()), mListPosition(p.list_position), mLastSelectedIndex(-1), - mLabel(p.label) + mLabel(p.label), + mMouseDownSignal(NULL) { // Text label button @@ -153,6 +155,11 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) createLineEditor(p); + if (p.mouse_down_callback.isProvided()) + { + setMouseDownCallback(initCommitCallback(p.mouse_down_callback)); + } + mTopLostSignalConnection = setTopLostCallback(boost::bind(&LLComboBox::hideList, this)); } @@ -183,6 +190,7 @@ LLComboBox::~LLComboBox() // explicitly disconect this signal, since base class destructor might fire top lost mTopLostSignalConnection.disconnect(); + delete mMouseDownSignal; } @@ -709,6 +717,9 @@ void LLComboBox::hideList() void LLComboBox::onButtonMouseDown() { + if (mMouseDownSignal) + (*mMouseDownSignal)( this, 0 ); + if (!mList->getVisible()) { // this might change selection, so do it first @@ -1183,6 +1194,11 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last ) return mList->selectItemRange(first, last); } +boost::signals2::connection LLComboBox::setMouseDownCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); +} static LLDefaultChildRegistry::Register register_icons_combo_box("icons_combo_box"); diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index e17d6cdfb4..49a55c98a3 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -78,6 +78,8 @@ public: text_entry_callback, text_changed_callback; + Optional mouse_down_callback; + Optional list_position; // components @@ -207,6 +209,8 @@ public: void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; } void setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; } + boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); + /** * Connects callback to signal called when Return key is pressed. */ @@ -244,6 +248,7 @@ private: commit_callback_t mTextChangedCallback; commit_callback_t mSelectionCallback; boost::signals2::connection mTopLostSignalConnection; + commit_signal_t* mMouseDownSignal; commit_signal_t mOnReturnSignal; S32 mLastSelectedIndex; }; diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 316b9ab1b6..9cb3c4ce66 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -80,7 +80,7 @@ LLFloaterPerformance::LLFloaterPerformance(const LLSD& key) { mContextMenu = new LLExceptionsContextMenu(this); - mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPerformance::onUICtrlMouseDown, this)); + mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); } LLFloaterPerformance::~LLFloaterPerformance() @@ -540,21 +540,4 @@ void LLFloaterPerformance::onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y) } } -void LLFloaterPerformance::onUICtrlMouseDown() -{ - static LLCachedControl use_auto_adjust(gSavedSettings,"AutoFPS"); - if (use_auto_adjust) - { - LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), - [](const LLSD¬if, const LLSD&resp) - { - S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); - if (opt == 0) - { - gSavedSettings.setBOOL("AutoFPS", FALSE); - } - }); - } -} - // EOF diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 7a1394c51b..d8288b0728 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -63,8 +63,6 @@ private: void onClickHideAvatars(); void onClickExceptions(); - void onUICtrlMouseDown(); - void updateMaxComplexity(); void updateComplexityText(); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index b655a04b14..41ae39152b 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -304,7 +304,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.RememberedUsernames", boost::bind(&LLFloaterPreference::onClickRememberedUsernames, this)); mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); - mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPreference::onUICtrlMouseDown, this)); + mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -1783,7 +1783,7 @@ void LLFloaterPreference::updateSearchableItems() mSearchDataDirty = true; } -void LLFloaterPreference::onUICtrlMouseDown() +void LLFloaterPreference::showAutoAdjustWarning() { static LLCachedControl use_auto_adjust(gSavedSettings,"AutoFPS"); if (use_auto_adjust) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 8a68f9f279..3e4c853a08 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -110,7 +110,7 @@ public: void updateClickActionViews(); void updateSearchableItems(); - void onUICtrlMouseDown(); + static void showAutoAdjustWarning(); void onBtnOK(const LLSD& userdata); void onBtnCancel(const LLSD& userdata); diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index 548a6eb769..85a0fee143 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -49,7 +49,7 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); - mCommitCallbackRegistrar.add("Pref.MouseDown", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onUICtrlMouseDown, this)); + mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnCancel, this, _2)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnOK, this, _2)); @@ -195,23 +195,6 @@ void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, L } } -void LLFloaterPreferenceGraphicsAdvanced::onUICtrlMouseDown() -{ - static LLCachedControl use_auto_adjust(gSavedSettings,"AutoFPS"); - if (use_auto_adjust) - { - LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), - [](const LLSD¬if, const LLSD&resp) - { - S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); - if (opt == 0) - { - gSavedSettings.setBOOL("AutoFPS", FALSE); - } - }); - } -} - void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors() { // Called when the IndirectMaxNonImpostors control changes diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.h b/indra/newview/llfloaterpreferencesgraphicsadvanced.h index cf3ed02614..7f26ff8b00 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.h +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.h @@ -46,7 +46,6 @@ public: void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); void updateMaxNonImpostors(); void updateIndirectMaxNonImpostors(const LLSD& newvalue); - void onUICtrlMouseDown(); void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); void updateMaxComplexity(); void updateComplexityText(); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 5978ae685a..65b96d3694 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -41,7 +41,7 @@ top_delta="16" width="330"> + function="Pref.AutoAdjustWarning" /> + function="Pref.AutoAdjustWarning" /> + function="Pref.AutoAdjustWarning" /> + function="Pref.AutoAdjustWarning" /> + function="Pref.AutoAdjustWarning" /> Date: Tue, 25 Jan 2022 13:22:45 -0600 Subject: [PATCH 10/99] SL-16699 Increase default cache size to 4GB --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8712aa7b6e..184ee8daff 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1426,7 +1426,7 @@ Type U32 Value - 1024 + 4096 CacheValidateCounter From c5f9dc913e09af5c420f379cbcc7b6707f13de8f Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 2 Feb 2022 10:24:15 +0100 Subject: [PATCH 11/99] Fix copy&paste error --- .../skins/default/xui/de/panel_preferences_graphics1.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/de/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/de/panel_preferences_graphics1.xml index 420b83a69c..63c71c367b 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_graphics1.xml @@ -108,7 +108,7 @@ - + S3TC aktivieren: From 7af2d51f57416cb68b435cecfd4eacf5d1a4c9fc Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 4 Feb 2022 12:46:23 +0200 Subject: [PATCH 12/99] SL-15923 increase the shortcut level to the minimum required when clicking advanced lighting or shadows settings --- indra/newview/llfloaterperformance.cpp | 55 +++++++++++++++++++ indra/newview/llfloaterperformance.h | 4 ++ .../skins/default/xui/en/notifications.xml | 28 +++++++++- 3 files changed, 84 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 9cb3c4ce66..e45d7a0c73 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -32,6 +32,7 @@ #include "llavataractions.h" #include "llavatarrendernotifier.h" #include "llcheckboxctrl.h" +#include "llcombobox.h" #include "llfeaturemanager.h" #include "llfloaterpreference.h" // LLAvatarComplexityControls #include "llfloaterreg.h" @@ -120,6 +121,8 @@ BOOL LLFloaterPerformance::postBuild() mSettingsPanel->getChild("advanced_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickAdvanced, this)); mSettingsPanel->getChild("graphics_quality")->setCommitCallback(boost::bind(&LLFloaterPerformance::onChangeQuality, this, _2)); + mSettingsPanel->getChild("advanced_lighting_model")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickAdvancedLighting, this)); + mSettingsPanel->getChild("ShadowDetail")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickShadows, this)); mNearbyPanel->getChild("exceptions_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickExceptions, this)); mNearbyPanel->getChild("hide_avatars")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickHideAvatars, this)); @@ -540,4 +543,56 @@ void LLFloaterPerformance::onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y) } } +const U32 RENDER_QUALITY_LEVEL = 3; +void LLFloaterPerformance::changeQualityLevel(const std::string& notif) +{ + LLNotificationsUtil::add(notif, LLSD(), LLSD(), + [](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + LLFloaterPreference* instance = LLFloaterReg::getTypedInstance("preferences"); + if (instance) + { + gSavedSettings.setU32("RenderQualityPerformance", RENDER_QUALITY_LEVEL); + instance->onChangeQuality(LLSD((S32)RENDER_QUALITY_LEVEL)); + } + } + }); +} + +bool is_ALM_available() +{ + bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump") && gSavedSettings.getBOOL("RenderObjectBump"); + bool shaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders"); + + return LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + bumpshiny && + shaders && + gGLManager.mHasFramebufferObject; +} + +void LLFloaterPerformance::onClickAdvancedLighting() +{ + if (!is_ALM_available()) + { + changeQualityLevel("AdvancedLightingConfirm"); + } +} + +void LLFloaterPerformance::onClickShadows() +{ + if (gSavedSettings.getBOOL("AutoFPS")) + { + LLFloaterPreference::showAutoAdjustWarning(); + } + else + { + if (!is_ALM_available() || !gSavedSettings.getBOOL("RenderDeferred")) + { + changeQualityLevel("ShadowsConfirm"); + } + } +} // EOF diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index d8288b0728..9ccb29cd7b 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -62,10 +62,14 @@ private: void onChangeQuality(const LLSD& data); void onClickHideAvatars(); void onClickExceptions(); + void onClickShadows(); + void onClickAdvancedLighting(); void updateMaxComplexity(); void updateComplexityText(); + static void changeQualityLevel(const std::string& notif); + LLPanel* mMainPanel; LLPanel* mNearbyPanel; LLPanel* mComplexityPanel; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 2fed214d69..e01865a5ea 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -1848,9 +1848,9 @@ Graphics Quality can be raised in Preferences > Graphics. + icon="alertmodal.tga" + name="AutoFPSConfirmDisable" + type="alertmodal"> Changing this setting will disable automatic adjustment and turn off 'Auto FPS' setting. Are you sure you want to continue? confirm @@ -1859,6 +1859,28 @@ Are you sure you want to continue? notext="Cancel" yestext="Continue"/> + +To turn on advanced lighting, we need to increase quality to level 4. + confirm + + + +To enable shadows, we need to increase quality to level 4. + confirm + + Date: Mon, 14 Feb 2022 18:59:55 +0200 Subject: [PATCH 13/99] SL-16841 Skip rendering shadows when decreasing shadow detail setting to avoid stalls --- indra/newview/llviewercontrol.cpp | 8 +++++++- indra/newview/pipeline.cpp | 33 +++++++++++++++++++++++-------- indra/newview/pipeline.h | 2 ++ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index e53f988c6e..4d86da5f78 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -166,6 +166,12 @@ static bool handleSetShaderChanged(const LLSD& newvalue) return true; } +static bool handleShadowDetailChanged(const LLSD& newvalue) +{ + gPipeline.handleShadowDetailChanged(); + return true; +} + static bool handleRenderPerfTestChanged(const LLSD& newvalue) { bool status = !newvalue.asBoolean(); @@ -695,7 +701,7 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderDebugPipeline")->getSignal()->connect(boost::bind(&handleRenderDebugPipelineChanged, _2)); gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _2)); gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleRenderDeferredChanged, _2)); - gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); + gSavedSettings.getControl("RenderShadowDetail")->getSignal()->connect(boost::bind(&handleShadowDetailChanged, _2)); gSavedSettings.getControl("RenderDeferredSSAO")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderPerformanceTest")->getSignal()->connect(boost::bind(&handleRenderPerfTestChanged, _2)); gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _2)); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 96dd0b895d..c895c8a227 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -10215,14 +10215,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) if (mSunDiffuse == LLColor4::black) { //sun diffuse is totally black, shadows don't matter - LLGLDepthTest depth(GL_TRUE); - - for (S32 j = 0; j < 4; j++) - { - mShadow[j].bindTarget(); - mShadow[j].clear(); - mShadow[j].flush(); - } + skipRenderingShadows(); } else { @@ -11430,6 +11423,30 @@ void LLPipeline::restoreHiddenObject( const LLUUID& id ) } } +void LLPipeline::skipRenderingShadows() +{ + LLGLDepthTest depth(GL_TRUE); + + for (S32 j = 0; j < 4; j++) + { + mShadow[j].bindTarget(); + mShadow[j].clear(); + mShadow[j].flush(); + } +} + +void LLPipeline::handleShadowDetailChanged() +{ + if (RenderShadowDetail > gSavedSettings.getS32("RenderShadowDetail")) + { + skipRenderingShadows(); + } + else + { + LLViewerShaderMgr::instance()->setShaders(); + } +} + const F32 MIN_DRAW_DISTANCE = 64; const F32 MAX_DRAW_DISTANCE = 256; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 7eff573a34..3e5899d973 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -423,6 +423,7 @@ public: void skipRenderingOfTerrain( bool flag ); void hideObject( const LLUUID& id ); void restoreHiddenObject( const LLUUID& id ); + void handleShadowDetailChanged(); void autoAdjustSettings(); void setAdjustmentTimerExpiry(F32 expiration); @@ -437,6 +438,7 @@ private: void connectRefreshCachedSettingsSafe(const std::string name); void hideDrawable( LLDrawable *pDrawable ); void unhideDrawable( LLDrawable *pDrawable ); + void skipRenderingShadows(); public: enum {GPU_CLASS_MAX = 3 }; From 808684ee4fe0d9ed3868d0ee86d9cc28f32fcfcb Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 18 Feb 2022 12:34:38 +0200 Subject: [PATCH 14/99] SL-16841 Disable shadow splits one by one to improve FPS instead of disabling all shadows at once --- indra/newview/app_settings/settings.xml | 11 ++++++++++ indra/newview/pipeline.cpp | 29 +++++++++++++++++++------ indra/newview/pipeline.h | 3 +++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 184ee8daff..43e554e532 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9049,6 +9049,17 @@ Value 0.5 + RenderShadowSplits + + Comment + Amount of shadow map splits to render (0 - 3). + Persist + 1 + Type + S32 + Value + 3 + RenderSSAOScale Comment diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c895c8a227..d3936fabcf 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -150,6 +150,7 @@ U32 LLPipeline::RenderFSAASamples; U32 LLPipeline::RenderResolutionDivisor; bool LLPipeline::RenderUIBuffer; S32 LLPipeline::RenderShadowDetail; +S32 LLPipeline::RenderShadowSplits; bool LLPipeline::RenderDeferredSSAO; F32 LLPipeline::RenderShadowResolutionScale; bool LLPipeline::RenderLocalLights; @@ -544,6 +545,7 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("RenderResolutionDivisor"); connectRefreshCachedSettingsSafe("RenderUIBuffer"); connectRefreshCachedSettingsSafe("RenderShadowDetail"); + connectRefreshCachedSettingsSafe("RenderShadowSplits"); connectRefreshCachedSettingsSafe("RenderDeferredSSAO"); connectRefreshCachedSettingsSafe("RenderShadowResolutionScale"); connectRefreshCachedSettingsSafe("RenderLocalLights"); @@ -611,6 +613,7 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("CameraDoFResScale"); connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit"); gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("AutoFPS")->getCommitSignal()->connect(boost::bind(&LLPipeline::onToggleAutoFPS)); } LLPipeline::~LLPipeline() @@ -1073,6 +1076,7 @@ void LLPipeline::refreshCachedSettings() RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor"); RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer"); RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail"); + RenderShadowSplits = gSavedSettings.getS32("RenderShadowSplits"); RenderDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO"); RenderShadowResolutionScale = gSavedSettings.getF32("RenderShadowResolutionScale"); RenderLocalLights = gSavedSettings.getBOOL("RenderLocalLights"); @@ -10270,7 +10274,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) std::vector fp; - if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir)) + if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir) + || j > RenderShadowSplits) { //no possible shadow receivers if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) @@ -11505,10 +11510,10 @@ void LLPipeline::autoAdjustSettings() { S32 fps_dif = fps_lower_boundary - fps; - if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0) + if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0 && RenderShadowSplits > 0) { - S32 shadow_detail = RenderShadowDetail - 1; - gSavedSettings.setS32("RenderShadowDetail", shadow_detail); + S32 shadow_splits = llclamp(RenderShadowSplits - 1, 0, 3); + gSavedSettings.setS32("RenderShadowSplits", shadow_splits); return; } @@ -11542,10 +11547,10 @@ void LLPipeline::autoAdjustSettings() update_far_clip(fps_dif); } - if (LLPipeline::sRenderDeferred && RenderShadowDetail < 2) + if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0 && RenderShadowSplits < 3) { - S32 shadow_detail = RenderShadowDetail + 1; - gSavedSettings.setS32("RenderShadowDetail", shadow_detail); + S32 shadow_splits = llclamp(RenderShadowSplits + 1, 0, 3); + gSavedSettings.setS32("RenderShadowSplits", shadow_splits); } } } @@ -11561,3 +11566,13 @@ void LLPipeline::setAdjustmentTimerExpiry(F32 expiration) { mUpdateTimer->setTimerExpirySec(expiration); } + +void LLPipeline::onToggleAutoFPS() +{ + if (!gSavedSettings.getBOOL("AutoFPS")) + { + //reset the number of shadow map splits rendered, when disabling auto-fps + //probably should be removed, if we'll have actual UI control for this setting + gSavedSettings.setS32("RenderShadowSplits", 3); + } +} diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 3e5899d973..b86b68b09d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -416,6 +416,8 @@ public: static void updateRenderDeferred(); static void refreshCachedSettings(); + static void onToggleAutoFPS(); + void addDebugBlip(const LLVector3& position, const LLColor4& color); void hidePermanentObjects( std::vector& restoreList ); @@ -916,6 +918,7 @@ public: static U32 RenderResolutionDivisor; static bool RenderUIBuffer; static S32 RenderShadowDetail; + static S32 RenderShadowSplits; static bool RenderDeferredSSAO; static F32 RenderShadowResolutionScale; static bool RenderLocalLights; From 882600de2afa366729be870355767282247be0ef Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 18 Feb 2022 18:30:59 +0200 Subject: [PATCH 15/99] SL-16627 water reflection detail settings should be affected by auto-adjustment --- indra/newview/pipeline.cpp | 16 +++++++++++++++- .../en/floater_preferences_graphics_advanced.xml | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d3936fabcf..6738532bc3 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -132,7 +132,7 @@ // NOTE: Keep in sync with indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml // NOTE: Unused consts are commented out since some compilers (on macOS) may complain about unused variables. -// const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; + const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; const S32 WATER_REFLECT_NONE_WATER_TRANSPARENT = -1; const S32 WATER_REFLECT_MINIMAL = 0; // const S32 WATER_REFLECT_TERRAIN = 1; @@ -11510,6 +11510,13 @@ void LLPipeline::autoAdjustSettings() { S32 fps_dif = fps_lower_boundary - fps; + if (sWaterReflections && RenderReflectionDetail > WATER_REFLECT_NONE_WATER_OPAQUE) + { + S32 reflection_detail = llclamp(RenderReflectionDetail - 1, WATER_REFLECT_NONE_WATER_OPAQUE, WATER_REFLECT_MINIMAL); + gSavedSettings.setS32("RenderReflectionDetail", reflection_detail); + return; + } + if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0 && RenderShadowSplits > 0) { S32 shadow_splits = llclamp(RenderShadowSplits - 1, 0, 3); @@ -11551,6 +11558,13 @@ void LLPipeline::autoAdjustSettings() { S32 shadow_splits = llclamp(RenderShadowSplits + 1, 0, 3); gSavedSettings.setS32("RenderShadowSplits", shadow_splits); + return; + } + + if (sWaterReflections && RenderReflectionDetail < WATER_REFLECT_MINIMAL) + { + S32 reflection_detail = llclamp(RenderReflectionDetail + 1, WATER_REFLECT_NONE_WATER_OPAQUE, WATER_REFLECT_MINIMAL); + gSavedSettings.setS32("RenderReflectionDetail", reflection_detail); } } } diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 65b96d3694..b02eb62112 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -697,6 +697,8 @@ top_delta="0" name="Reflections" width="150"> + Date: Wed, 2 Mar 2022 00:47:02 +0200 Subject: [PATCH 16/99] merge fix --- indra/newview/llmodelpreview.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index b9fcad6366..c9bf0b0a12 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -1801,8 +1801,6 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d } } } - - mResourceCost = calcResourceCost(); } void LLModelPreview::updateStatusMessages() From 6ab4aeb14878a091a04324c87f5f40d9270f7897 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 9 Mar 2022 13:22:26 +0200 Subject: [PATCH 17/99] SL-16627 Enable auto-adjustments for frist login and update UI --- indra/newview/llstartup.cpp | 6 +- .../default/xui/en/floater_performance.xml | 2 +- .../xui/en/panel_performance_complexity.xml | 4 +- .../default/xui/en/panel_performance_huds.xml | 4 +- .../xui/en/panel_performance_preferences.xml | 55 +++++++++++++++---- .../xui/en/panel_preferences_graphics1.xml | 37 ++++++++----- 6 files changed, 77 insertions(+), 31 deletions(-) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 94bafcb612..537b431ea2 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2208,7 +2208,11 @@ bool idle_startup() if (STATE_CLEANUP == LLStartUp::getStartupState()) { - set_startup_status(1.0, "", ""); + if (gAgent.isFirstLogin()) + { + gSavedSettings.setBOOL("AutoFPS", TRUE); + } + set_startup_status(1.0, "", ""); display_startup(); if (!mBenefitsSuccessfullyInit) diff --git a/indra/newview/skins/default/xui/en/floater_performance.xml b/indra/newview/skins/default/xui/en/floater_performance.xml index 84ee9d3c00..0107c59868 100644 --- a/indra/newview/skins/default/xui/en/floater_performance.xml +++ b/indra/newview/skins/default/xui/en/floater_performance.xml @@ -1,6 +1,6 @@ + bevel_style="in" + height="0" + layout="topleft" + name="border0" + top_pad="8" + left="20" + width="540"/> + + Automatic settings + + + + - Shortcuts + Quality & Speed + width="380"> Reducing or turning off water effects can greatly improve frame rate. diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index f73149e77e..93cb3ea9c8 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -30,7 +30,28 @@ width="120"> (None) - + + + Quality & speed: @@ -262,18 +283,6 @@ function="Pref.RenderOptionUpdate" /> - - - Date: Mon, 14 Mar 2022 20:40:39 +0200 Subject: [PATCH 18/99] merge fix --- indra/llcommon/tests/llprocess_test.cpp | 66 ++++++++----------------- 1 file changed, 20 insertions(+), 46 deletions(-) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 54a1c55a2d..81449b4a42 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -356,24 +356,17 @@ namespace tut // Create a script file in a temporary place. NamedTempFile script("py", - "from __future__ import print_function" EOL + "from __future__ import print_function" EOL "import sys" EOL "import time" EOL EOL "time.sleep(2)" EOL -<<<<<<< HEAD "print('stdout after wait',file=sys.stdout)" EOL "sys.stdout.flush()" EOL "time.sleep(2)" EOL "print('stderr after wait',file=sys.stderr)" EOL -======= - "print('stdout after wait', file=sys.stdout)" EOL - "sys.stdout.flush()" EOL - "time.sleep(2)" EOL - "print('stderr after wait', file=sys.stderr)" EOL ->>>>>>> 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 "sys.stderr.flush()" EOL - ); + ); // Arrange to track the history of our interaction with child: what we // fetched, which pipe it came from, how many tries it took before we @@ -869,11 +862,8 @@ namespace tut set_test_name("'bogus' test"); CaptureLog recorder; PythonProcessLauncher py(get_test_name(), -<<<<<<< HEAD - "from __future__ import print_function\n" -======= ->>>>>>> 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 - "print('Hello world')\n"); + "from __future__ import print_function\n" + "print('Hello world')\n"); py.mParams.files.add(LLProcess::FileParam("bogus")); py.mPy = LLProcess::create(py.mParams); ensure("should have rejected 'bogus'", ! py.mPy); @@ -888,11 +878,8 @@ namespace tut // Replace this test with one or more real 'file' tests when we // implement 'file' support PythonProcessLauncher py(get_test_name(), -<<<<<<< HEAD - "from __future__ import print_function\n" -======= ->>>>>>> 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 - "print('Hello world')\n"); + "from __future__ import print_function\n" + "print('Hello world')\n"); py.mParams.files.add(LLProcess::FileParam()); py.mParams.files.add(LLProcess::FileParam("file")); py.mPy = LLProcess::create(py.mParams); @@ -907,11 +894,8 @@ namespace tut // implement 'tpipe' support CaptureLog recorder; PythonProcessLauncher py(get_test_name(), -<<<<<<< HEAD - "from __future__ import print_function\n" -======= ->>>>>>> 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 - "print('Hello world')\n"); + "from __future__ import print_function\n" + "print('Hello world')\n"); py.mParams.files.add(LLProcess::FileParam()); py.mParams.files.add(LLProcess::FileParam("tpipe")); py.mPy = LLProcess::create(py.mParams); @@ -928,11 +912,8 @@ namespace tut // implement 'npipe' support CaptureLog recorder; PythonProcessLauncher py(get_test_name(), -<<<<<<< HEAD - "from __future__ import print_function\n" -======= ->>>>>>> 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 - "print('Hello world')\n"); + "from __future__ import print_function\n" + "print('Hello world')\n"); py.mParams.files.add(LLProcess::FileParam()); py.mParams.files.add(LLProcess::FileParam()); py.mParams.files.add(LLProcess::FileParam("npipe")); @@ -1008,24 +989,20 @@ namespace tut { set_test_name("get*Pipe() validation"); PythonProcessLauncher py(get_test_name(), -<<<<<<< HEAD - "from __future__ import print_function\n" - "print('this output is expected')\n"); -======= - "print('this output is expected)'\n"); ->>>>>>> 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 + "from __future__ import print_function\n" + "print('this output is expected')\n"); py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stdin py.mParams.files.add(LLProcess::FileParam()); // inherit stdout py.mParams.files.add(LLProcess::FileParam("pipe")); // pipe for stderr py.run(); TEST_getPipe(*py.mPy, getWritePipe, getOptWritePipe, - LLProcess::STDIN, // VALID - LLProcess::STDOUT, // NOPIPE - LLProcess::STDERR); // BADPIPE + LLProcess::STDIN, // VALID + LLProcess::STDOUT, // NOPIPE + LLProcess::STDERR); // BADPIPE TEST_getPipe(*py.mPy, getReadPipe, getOptReadPipe, - LLProcess::STDERR, // VALID - LLProcess::STDOUT, // NOPIPE - LLProcess::STDIN); // BADPIPE + LLProcess::STDERR, // VALID + LLProcess::STDOUT, // NOPIPE + LLProcess::STDIN); // BADPIPE } template<> template<> @@ -1152,11 +1129,8 @@ namespace tut { set_test_name("ReadPipe \"eof\" event"); PythonProcessLauncher py(get_test_name(), -<<<<<<< HEAD - "from __future__ import print_function\n" -======= ->>>>>>> 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 - "print('Hello from Python!')\n"); + "from __future__ import print_function\n" + "print('Hello from Python!')\n"); py.mParams.files.add(LLProcess::FileParam()); // stdin py.mParams.files.add(LLProcess::FileParam("pipe")); // stdout py.launch(); From 00b71d8197ed2a64b2d2fa01a72f5cd316e198b7 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Wed, 9 Mar 2022 10:11:40 -0800 Subject: [PATCH 19/99] Fix DRTVWR-550 TeamCity build. codesigning retry block had some leftover python2 syntax --- indra/newview/viewer_manifest.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index c7e49206c8..6aafc07bc7 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1304,9 +1304,8 @@ class DarwinManifest(ViewerManifest): ] for attempt in range(3): if attempt: # second or subsequent iteration - print >> sys.stderr, \ - ("codesign failed, waiting %d seconds before retrying" % - sign_retry_wait) + print("codesign failed, waiting {:d} seconds before retrying".format(sign_retry_wait), + file=sys.stderr) time.sleep(sign_retry_wait) sign_retry_wait*=2 From d922d2ba7dc9e2a0de1cf69b569174e3990ae80f Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Wed, 9 Mar 2022 16:47:35 -0800 Subject: [PATCH 20/99] More DRTVWR-550 Teamcity build fix. another piece of python2 syntax leftover in an error handling block --- indra/newview/viewer_manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 6aafc07bc7..76160b73ba 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1335,7 +1335,7 @@ class DarwinManifest(ViewerManifest): # 'err' goes out of scope sign_failed = err else: - print >> sys.stderr, "Maximum codesign attempts exceeded; giving up" + print("Maximum codesign attempts exceeded; giving up", file=sys.stderr) raise sign_failed self.run_command(['spctl', '-a', '-texec', '-vvvv', app_in_dmg]) self.run_command([self.src_path_of("installers/darwin/apple-notarize.sh"), app_in_dmg]) From e5e710a1e6e0f74cd60647e3dae7d037076351ff Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 17 Mar 2022 18:47:42 +0200 Subject: [PATCH 21/99] SL-16627 show auto-adjustment warning when for Shadows quality and Water reflection settings --- indra/newview/llfloaterperformance.cpp | 1 + indra/newview/llfloaterpreferencesgraphicsadvanced.cpp | 3 +++ .../default/xui/en/floater_preferences_graphics_advanced.xml | 4 ---- indra/newview/skins/default/xui/en/notifications.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index e45d7a0c73..c89c58c401 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -123,6 +123,7 @@ BOOL LLFloaterPerformance::postBuild() mSettingsPanel->getChild("graphics_quality")->setCommitCallback(boost::bind(&LLFloaterPerformance::onChangeQuality, this, _2)); mSettingsPanel->getChild("advanced_lighting_model")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickAdvancedLighting, this)); mSettingsPanel->getChild("ShadowDetail")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickShadows, this)); + mSettingsPanel->getChild("Reflections")->setMouseDownCallback(boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); mNearbyPanel->getChild("exceptions_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickExceptions, this)); mNearbyPanel->getChild("hide_avatars")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickHideAvatars, this)); diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index 85a0fee143..ba2fd6eef2 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -81,6 +81,9 @@ BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateComplexityText, this)); + getChild("ShadowDetail")->setMouseDownCallback(boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); + getChild("Reflections")->setMouseDownCallback(boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); + return TRUE; } diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index b02eb62112..154c8b7909 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -697,8 +697,6 @@ top_delta="0" name="Reflections" width="150"> - - - Changing this setting will disable automatic adjustment and turn off 'Auto FPS' setting. +Changing this setting will disable automatic adjustment and turn off 'Automatic settings'. Are you sure you want to continue? confirm Date: Tue, 26 Apr 2022 16:10:52 +0300 Subject: [PATCH 22/99] merge fix --- indra/newview/llvoavatar.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 87aff6ca98..33f2ec81ab 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2546,7 +2546,11 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR)) && !disable_all_render_types && !isSelf()) { - return; + if (!mIsControlAvatar) + { + idleUpdateNameTag( mLastRootPos ); + } + return; } // Update should be happening max once per frame. @@ -3189,11 +3193,9 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) static LLCachedControl FADE_DURATION(gSavedSettings, "RenderNameFadeDuration"); // seconds static LLCachedControl use_chat_bubbles(gSavedSettings, "UseChatBubbles"); - bool visible_avatar = isVisible() || mNeedsAnimUpdate; bool visible_chat = use_chat_bubbles && (mChats.size() || mTyping); bool render_name = visible_chat || - (visible_avatar && - ((sRenderName == RENDER_NAME_ALWAYS) || + (((sRenderName == RENDER_NAME_ALWAYS) || (sRenderName == RENDER_NAME_FADE && time_visible < NAME_SHOW_TIME))); // If it's your own avatar, don't draw in mouselook, and don't // draw if we're specifically hiding our own name. From ba9bff5b9bdd7904916c3ae844840c87376498c3 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 8 Jun 2022 01:21:42 +0300 Subject: [PATCH 23/99] SL-17541 Show the message that user is currently at maximum FPS --- indra/llwindow/llwindow.cpp | 3 ++- indra/llwindow/llwindow.h | 3 +++ indra/llwindow/llwindowwin32.cpp | 3 ++- indra/newview/llfloaterperformance.cpp | 20 ++++++++++++++++--- indra/newview/llfloaterperformance.h | 1 + .../default/xui/en/floater_performance.xml | 8 +++++++- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index f4678a70c5..c5725677b4 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -117,7 +117,8 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mSwapMethod(SWAP_METHOD_UNDEFINED), mHideCursorPermanent(FALSE), mFlags(flags), - mHighSurrogate(0) + mHighSurrogate(0), + mRefreshRate(0) { } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 0edf39f6ef..4380bbdb73 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -196,6 +196,8 @@ public: // windows only DirectInput8 for joysticks virtual void* getDirectInput8() { return NULL; }; virtual bool getInputDevices(U32 device_type_filter, void * devices_callback, void* userdata) { return false; }; + + virtual S32 getRefreshRate() { return mRefreshRate; } protected: LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags); virtual ~LLWindow(); @@ -229,6 +231,7 @@ protected: U16 mHighSurrogate; S32 mMinWindowWidth; S32 mMinWindowHeight; + S32 mRefreshRate; // Handle a UTF-16 encoding unit received from keyboard. // Converting the series of UTF-16 encoding units to UTF-32 data, diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 1f3823509c..932f8c32cf 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -583,7 +583,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, { current_refresh = 60; } - + mRefreshRate = current_refresh; //----------------------------------------------------------------------- // Drop resolution and go fullscreen // use a display mode with our desired size and depth, with a refresh @@ -1061,6 +1061,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { current_refresh = 60; } + mRefreshRate = current_refresh; gGLManager.shutdownGL(); //destroy gl context diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index c89c58c401..ecacadee3e 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -43,6 +43,7 @@ #include "lltextbox.h" #include "lltrans.h" #include "llviewerobjectlist.h" +#include "llviewerwindow.h" #include "llvoavatar.h" #include "llvoavatarself.h" #include "llworld.h" @@ -162,11 +163,9 @@ void LLFloaterPerformance::showSelectedPanel(LLPanel* selected_panel) void LLFloaterPerformance::draw() { - const S32 NUM_PERIODS = 50; - if (mUpdateTimer->hasExpired()) { - getChild("fps_value")->setValue((S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, NUM_PERIODS))); + setFPSText(); if (mHUDsPanel->getVisible()) { populateHUDList(); @@ -409,6 +408,21 @@ void LLFloaterPerformance::populateNearbyList() mNearbyList->selectByID(prev_selected_id); } +void LLFloaterPerformance::setFPSText() +{ + const S32 NUM_PERIODS = 50; + S32 current_fps = (S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, NUM_PERIODS)); + getChild("fps_value")->setValue(current_fps); + + std::string fps_text = getString("fps_text"); + static LLCachedControl vsync_enabled(gSavedSettings, "RenderVSyncEnable", true); + if (vsync_enabled && (current_fps >= gViewerWindow->getWindow()->getRefreshRate())) + { + fps_text += getString("max_text"); + } + getChild("fps_lbl")->setValue(fps_text); +} + void LLFloaterPerformance::detachItem(const LLUUID& item_id) { LLAppearanceMgr::instance().removeItemFromAvatar(item_id); diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 9ccb29cd7b..e40eee162d 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -57,6 +57,7 @@ private: void populateHUDList(); void populateObjectList(); void populateNearbyList(); + void setFPSText(); void onClickAdvanced(); void onChangeQuality(const LLSD& data); diff --git a/indra/newview/skins/default/xui/en/floater_performance.xml b/indra/newview/skins/default/xui/en/floater_performance.xml index 0107c59868..bf2623f356 100644 --- a/indra/newview/skins/default/xui/en/floater_performance.xml +++ b/indra/newview/skins/default/xui/en/floater_performance.xml @@ -6,6 +6,12 @@ save_rect="true" title="IMPROVE GRAPHICS SPEED" width="580"> + + From 76c8a7ff0b57e7856613960391be7c400384183b Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Wed, 8 Jun 2022 03:15:59 +0300 Subject: [PATCH 24/99] SL-17541 show the message on mac --- indra/llwindow/llwindowmacosx.cpp | 2 ++ indra/newview/llfloaterperformance.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index bc4f07941b..b3616e4ea8 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -660,6 +660,8 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits } } + mRefreshRate = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(mDisplay)); + // Disable vertical sync for swap toggleVSync(enable_vsync); diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index ecacadee3e..0ef9ab3215 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -416,7 +416,8 @@ void LLFloaterPerformance::setFPSText() std::string fps_text = getString("fps_text"); static LLCachedControl vsync_enabled(gSavedSettings, "RenderVSyncEnable", true); - if (vsync_enabled && (current_fps >= gViewerWindow->getWindow()->getRefreshRate())) + S32 refresh_rate = gViewerWindow->getWindow()->getRefreshRate(); + if (vsync_enabled && (refresh_rate > 0) && (current_fps >= refresh_rate)) { fps_text += getString("max_text"); } From b66f2e7da7d3ec68984d7fcb5e5996e1451c0baf Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 21 Sep 2022 21:19:17 +0300 Subject: [PATCH 25/99] SL-18202 WIP merging autotune contribution and updating UI --- indra/newview/CMakeLists.txt | 3 + indra/newview/app_settings/settings.xml | 132 +++++ indra/newview/app_settings/toolbars.xml | 1 + indra/newview/llappviewer.cpp | 150 +++--- indra/newview/lldrawpool.cpp | 63 ++- indra/newview/lldrawpoolalpha.cpp | 34 +- indra/newview/lldrawpoolavatar.cpp | 9 +- indra/newview/lldrawpoolbump.cpp | 33 +- indra/newview/lldrawpoolmaterials.cpp | 14 +- indra/newview/llfloaterperformance.cpp | 4 + indra/newview/llfloaterperformance.h | 1 + indra/newview/llfloaterpreference.cpp | 18 + indra/newview/llfloaterpreference.h | 2 + indra/newview/llperfstats.cpp | 469 ++++++++++++++++++ indra/newview/llperfstats.h | 454 +++++++++++++++++ indra/newview/llstartup.cpp | 6 + indra/newview/llviewercontrol.cpp | 72 +++ indra/newview/llviewerdisplay.cpp | 13 +- indra/newview/llviewerjointmesh.cpp | 11 + indra/newview/llvoavatar.cpp | 93 ++++ indra/newview/llvoavatar.h | 24 + indra/newview/llvovolume.cpp | 21 +- .../default/xui/en/floater_performance.xml | 54 ++ .../en/panel_performance_autoadjustments.xml | 272 ++++++++++ 24 files changed, 1872 insertions(+), 81 deletions(-) create mode 100644 indra/newview/llperfstats.cpp create mode 100644 indra/newview/llperfstats.h create mode 100644 indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 776797da7c..1a009967f5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1383,6 +1383,9 @@ set(viewer_HEADER_FILES VorbisFramework.h ) + list(APPEND viewer_SOURCE_FILES llperfstats.cpp) + list(APPEND viewer_HEADER_FILES llperfstats.h) + source_group("CMake Rules" FILES ViewerInstall.cmake) #build_data.json creation moved to viewer_manifest.py MAINT-6413 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1877c30dc4..d92632c0a2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16776,6 +16776,138 @@ Value 50 + TargetFPS + + Comment + Desired minimum FPS + Persist + 1 + Type + U32 + Value + 25 + + AutoTuneFPS + + Comment + Allow the viewer to adjust your settings to achieve target FPS + Persist + 0 + Type + Boolean + Value + 0 + + AutoTuneLock + + Comment + When enabled the viewer will dynamically change settings until auto tune is explicitly turned off. + Persist + 1 + Type + Boolean + Value + 1 + + AllowSelfImpostor + + Comment + Allow own render time to impostor your avatar. + Persist + 1 + Type + Boolean + Value + 0 + + RenderAvatarMaxART + + Comment + Render Time Limit in microseconds (0.0 = no limit) + Persist + 0 + Type + F32 + Value + 4.699 + + AutoTuneRenderFarClipMin + + Comment + The lowest draw distance that auto tune is allowed to use + Persist + 0 + Type + F32 + Value + 32.0 + + AutoTuneRenderFarClipTarget + + Comment + The draw distance that auto tune will try to achieve + Persist + 0 + Type + F32 + Value + 256.0 + + UserTargetReflections + + Comment + Set by auto tune floater on build + Persist + 0 + Type + S32 + Value + 4 + + PerfStatsCaptureEnabled + + Comment + Enable/disable render time data to support autotune. + Persist + 1 + Type + Boolean + Value + 1 + + AutoTuneImpostorByDistEnabled + + Comment + Enable/disable using MaxNonImpostor to limit avatar rendering by distance. + Persist + 1 + Type + Boolean + Value + 0 + + AutoTuneImpostorFarAwayDistance + + Comment + Avatars beyond this range will automatically be optimized + Persist + 0 + Type + F32 + Value + 64.0 + + TuningFPSStrategy + + Comment + Strategy to use when tuning FPS. 0=Tune avatar rendering only, 1=Tune both avatar and global scene settings. + Persist + 1 + Type + U32 + Value + 0 + CameraOpacity Comment diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml index f3a23edc58..a1c9d6d9ee 100644 --- a/indra/newview/app_settings/toolbars.xml +++ b/indra/newview/app_settings/toolbars.xml @@ -22,6 +22,7 @@ + diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index d61a66c696..a04d21c4b0 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -108,6 +108,7 @@ #include "llscenemonitor.h" #include "llavatarrenderinfoaccountant.h" #include "lllocalbitmaps.h" +#include "llperfstats.h" // Linden library includes #include "llavatarnamecache.h" @@ -1377,82 +1378,91 @@ bool LLAppViewer::frame() bool LLAppViewer::doFrame() { - LL_RECORD_BLOCK_TIME(FTM_FRAME); + LL_RECORD_BLOCK_TIME(FTM_FRAME); + { + // and now adjust the visuals from previous frame. + if(LLPerfStats::tunables.userAutoTuneEnabled && LLPerfStats::tunables.tuningFlag != LLPerfStats::Tunables::Nothing) + { + LLPerfStats::tunables.applyUpdates(); + } + LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_FRAME); if (!LLWorld::instanceExists()) { LLWorld::createInstance(); } - LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); - LLSD newFrame; - - { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLTrace"); - if (LLFloaterReg::instanceVisible("block_timers")) + LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); + LLSD newFrame; + { + LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE); // perf stats { - LLTrace::BlockTimer::processTimes(); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLTrace"); + if (LLFloaterReg::instanceVisible("block_timers")) + { + LLTrace::BlockTimer::processTimes(); + } + + LLTrace::get_frame_recording().nextPeriod(); + LLTrace::BlockTimer::logStats(); } - - LLTrace::get_frame_recording().nextPeriod(); - LLTrace::BlockTimer::logStats(); - } - LLTrace::get_thread_recorder()->pullFromChildren(); + LLTrace::get_thread_recorder()->pullFromChildren(); - //clear call stack records - LL_CLEAR_CALLSTACKS(); + //clear call stack records + LL_CLEAR_CALLSTACKS(); + } + { + { + LLPerfStats::RecordSceneTime T(LLPerfStats::StatType_t::RENDER_IDLE); // ensure we have the entire top scope of frame covered (input event and coro) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df processMiscNativeEvents") + pingMainloopTimeout("Main:MiscNativeWindowEvents"); - { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df processMiscNativeEvents" ) - pingMainloopTimeout("Main:MiscNativeWindowEvents"); + if (gViewerWindow) + { + LL_RECORD_BLOCK_TIME(FTM_MESSAGES); + gViewerWindow->getWindow()->processMiscNativeEvents(); + } - if (gViewerWindow) - { - LL_RECORD_BLOCK_TIME(FTM_MESSAGES); - gViewerWindow->getWindow()->processMiscNativeEvents(); - } + { + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gatherInput") + pingMainloopTimeout("Main:GatherInput"); + } - { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df gatherInput" ) - pingMainloopTimeout("Main:GatherInput"); - } + if (gViewerWindow) + { + LL_RECORD_BLOCK_TIME(FTM_MESSAGES); + if (!restoreErrorTrap()) + { + LL_WARNS() << " Someone took over my signal/exception handler (post messagehandling)!" << LL_ENDL; + } - if (gViewerWindow) - { - LL_RECORD_BLOCK_TIME(FTM_MESSAGES); - if (!restoreErrorTrap()) - { - LL_WARNS() << " Someone took over my signal/exception handler (post messagehandling)!" << LL_ENDL; - } + gViewerWindow->getWindow()->gatherInput(); + } - gViewerWindow->getWindow()->gatherInput(); - } + //memory leaking simulation + if (gSimulateMemLeak) + { + LLFloaterMemLeak* mem_leak_instance = + LLFloaterReg::findTypedInstance("mem_leaking"); + if (mem_leak_instance) + { + mem_leak_instance->idle(); + } + } - //memory leaking simulation - if (gSimulateMemLeak) - { - LLFloaterMemLeak* mem_leak_instance = - LLFloaterReg::findTypedInstance("mem_leaking"); - if (mem_leak_instance) - { - mem_leak_instance->idle(); - } - } + { + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df mainloop") + // canonical per-frame event + mainloop.post(newFrame); + } - { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df mainloop" ) - // canonical per-frame event - mainloop.post(newFrame); - } - - { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df suspend" ) - // give listeners a chance to run - llcoro::suspend(); - // if one of our coroutines threw an uncaught exception, rethrow it now - LLCoros::instance().rethrow(); - } + { + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df suspend") + // give listeners a chance to run + llcoro::suspend(); + } + } if (!LLApp::isExiting()) { @@ -1470,6 +1480,7 @@ bool LLAppViewer::doFrame() && (gHeadlessClient || !gViewerWindow->getShowProgress()) && !gFocusMgr.focusLocked()) { + LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE); joystick->scanJoystick(); gKeyboard->scanKeyboard(); gViewerInput.scanMouse(); @@ -1483,6 +1494,7 @@ bool LLAppViewer::doFrame() } { + LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE); LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df idle"); //LL_RECORD_BLOCK_TIME(FTM_IDLE); idle(); } @@ -1517,13 +1529,14 @@ bool LLAppViewer::doFrame() display(); - { - LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df Snapshot" ) - pingMainloopTimeout("Main:Snapshot"); - LLFloaterSnapshot::update(); // take snapshots - LLFloaterOutfitSnapshot::update(); - gGLActive = FALSE; - } + { + LLPerfStats::RecordSceneTime T(LLPerfStats::StatType_t::RENDER_IDLE); + LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df Snapshot" ) + pingMainloopTimeout("Main:Snapshot"); + LLFloaterSnapshot::update(); // take snapshots + LLFloaterOutfitSnapshot::update(); + gGLActive = FALSE; + } } } @@ -1569,7 +1582,8 @@ bool LLAppViewer::doFrame() // of equal priority on Windows if (milliseconds_to_sleep > 0) { - ms_sleep(milliseconds_to_sleep); + LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_SLEEP ); + ms_sleep(milliseconds_to_sleep); // also pause worker threads during this wait period LLAppViewer::getTextureCache()->pause(); LLAppViewer::getImageDecodeThread()->pause(); @@ -1670,7 +1684,7 @@ bool LLAppViewer::doFrame() LL_INFOS() << "Exiting main_loop" << LL_ENDL; } - + }LLPerfStats::StatsRecorder::endFrame(); LL_PROFILER_FRAME_END return ! LLApp::isRunning(); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index a3837fe10c..594cfe513d 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -52,6 +52,7 @@ #include "llglcommonfunc.h" #include "llvoavatar.h" #include "llviewershadermgr.h" +#include "llperfstats.h" S32 LLDrawPool::sNumDrawPools = 0; @@ -391,13 +392,22 @@ void LLRenderPass::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL t { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type]; - + + std::unique_ptr ratPtr{}; // Perf stats for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) { LLDrawInfo *pparams = *k; if (pparams) { - pushBatch(*pparams, mask, texture); + if(pparams->mFace) + { + LLViewerObject* vobj = pparams->mFace->getViewerObject(); + if(vobj->isAttachment()) + { + trackAttachments(vobj, false, &ratPtr); + } + } + pushBatch(*pparams, mask, texture); } } } @@ -410,11 +420,21 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, U32 mask, U64 lastMeshId = 0; mask |= LLVertexBuffer::MAP_WEIGHT4; + std::unique_ptr ratPtr{}; // Perf stats for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) { LLDrawInfo* pparams = *k; if (pparams) { + if(pparams->mFace) + { + LLViewerObject* vobj = pparams->mFace->getViewerObject(); + if(vobj->isAttachment()) + { + trackAttachments( vobj, true ,&ratPtr); + } + } + if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash) { uploadMatrixPalette(*pparams); @@ -430,12 +450,21 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, U32 mask, void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; + std::unique_ptr ratPtr{}; for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) { LLDrawInfo* pparams = *i; if (pparams) { - pushBatch(*pparams, mask, texture, batch_textures); + if(pparams->mFace) + { + LLViewerObject* vobj = pparams->mFace->getViewerObject(); + if(vobj->isAttachment()) + { + trackAttachments( vobj, false, &ratPtr); + } + } + pushBatch(*pparams, mask, texture, batch_textures); } } } @@ -446,11 +475,21 @@ void LLRenderPass::pushRiggedBatches(U32 type, U32 mask, BOOL texture, BOOL batc LLVOAvatar* lastAvatar = nullptr; U64 lastMeshId = 0; mask |= LLVertexBuffer::MAP_WEIGHT4; + std::unique_ptr ratPtr{}; // Perf stats for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) { LLDrawInfo* pparams = *i; if (pparams) { + if(pparams->mFace) + { + LLViewerObject* vobj = pparams->mFace->getViewerObject(); + if(vobj->isAttachment()) + { + trackAttachments( vobj, true, &ratPtr); + } + } + if (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)) { uploadMatrixPalette(*pparams); @@ -466,11 +505,20 @@ void LLRenderPass::pushRiggedBatches(U32 type, U32 mask, BOOL texture, BOOL batc void LLRenderPass::pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; + std::unique_ptr ratPtr{}; for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) { LLDrawInfo* pparams = *i; if (pparams) { + if((*pparams).mFace) + { + LLViewerObject* vobj = (*pparams).mFace->getViewerObject(); + if(vobj->isAttachment()) + { + trackAttachments( vobj, false, &ratPtr); + } + } LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff); pushBatch(*pparams, mask, texture, batch_textures); } @@ -482,11 +530,20 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, U32 mask, BOOL texture, BOOL LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; LLVOAvatar* lastAvatar = nullptr; U64 lastMeshId = 0; + std::unique_ptr ratPtr{}; for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) { LLDrawInfo* pparams = *i; if (pparams) { + if((*pparams).mFace) + { + LLViewerObject* vobj = (*pparams).mFace->getViewerObject(); + if(vobj->isAttachment()) + { + trackAttachments( vobj, true, &ratPtr); + } + } if (LLGLSLShader::sCurBoundShaderPtr) { LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index e674707c01..de5b9d5062 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -49,6 +49,7 @@ #include "llspatialpartition.h" #include "llglcommonfunc.h" #include "llvoavatar.h" +#include "llperfstats.h" BOOL LLDrawPoolAlpha::sShowDebugAlpha = FALSE; @@ -327,10 +328,20 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask) { LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA+pass]; // <-- hacky + pass to use PASS_ALPHA_RIGGED on second pass + std::unique_ptr ratPtr{}; // Render time Stats collection for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) { LLDrawInfo& params = **k; + if(params.mFace) + { + LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); + if(vobj->isAttachment()) + { + trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr ); + } + } + if (params.mParticle) { continue; @@ -500,8 +511,16 @@ void LLDrawPoolAlpha::renderRiggedEmissives(U32 mask, std::vector& mask |= LLVertexBuffer::MAP_WEIGHT4; + std::unique_ptr ratPtr{}; // Render time Stats collection for (LLDrawInfo* draw : emissives) { + LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("Emissives"); + auto vobj = draw->mFace?draw->mFace->getViewerObject():nullptr; + if(vobj && vobj->isAttachment()) + { + trackAttachments( vobj, draw->mFace->isState(LLFace::RIGGED), &ratPtr ); + } + bool tex_setup = TexSetup(draw, false); if (lastAvatar != draw->mAvatar || lastMeshId != draw->mSkinInfo->mHash) { @@ -566,7 +585,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) LLSpatialGroup::drawmap_elem_t& draw_info = rigged ? group->mDrawMap[LLRenderPass::PASS_ALPHA_RIGGED] : group->mDrawMap[LLRenderPass::PASS_ALPHA]; - for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) + std::unique_ptr ratPtr{}; // Render time Stats collection + for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) { LLDrawInfo& params = **k; if ((bool)params.mAvatar != rigged) @@ -585,6 +605,16 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) continue; } + if(params.mFace) + { + LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); + + if(vobj->isAttachment()) + { + trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr ); + } + } + if(depth_only) { // when updating depth buffer, discard faces that are more than 90% transparent @@ -769,6 +799,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) } } + ratPtr.reset(); // force the final batch to terminate to avoid double counting on the subsidiary batches for FB and Emmissives + // render emissive faces into alpha channel for bloom effects if (!depth_only) { diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 4a9a3caaec..02dea6b828 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -52,6 +52,7 @@ #include "llviewerpartsim.h" #include "llviewercontrol.h" // for gSavedSettings #include "llviewertexturelist.h" +#include "llperfstats.h" static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK; static U32 sBufferUsage = GL_STREAM_DRAW_ARB; @@ -380,9 +381,12 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) { return; } + LLPerfStats::RecordAvatarTime T(avatarp->getID(), LLPerfStats::StatType_t::RENDER_SHADOWS); + LLVOAvatar::AvatarOverallAppearance oa = avatarp->getOverallAppearance(); - BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor(); - if (impostor || (oa == LLVOAvatar::AOA_INVISIBLE)) + BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor(); + // no shadows if the shadows are causing this avatar to breach the limit. + if (avatarp->isTooSlowWithShadows() || impostor || (oa == LLVOAvatar::AOA_INVISIBLE)) { // No shadows for impostored (including jellydolled) or invisible avs. return; @@ -789,6 +793,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) { return; } + LLPerfStats::RecordAvatarTime T(avatarp->getID(), LLPerfStats::StatType_t::RENDER_GEOMETRY); if (!single_avatar && !avatarp->isFullyLoaded() ) { diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 8db6a10e26..09b2400aff 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -48,6 +48,7 @@ #include "llspatialpartition.h" #include "llviewershadermgr.h" #include "llmodel.h" +#include "llperfstats.h" //#include "llimagebmp.h" //#include "../tools/imdebug/imdebug.h" @@ -538,10 +539,18 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL { LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type]; - for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) + std::unique_ptr ratPtr{}; + for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) { LLDrawInfo& params = **k; + LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); + + if( vobj && vobj->isAttachment() ) + { + trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr ); + } + applyModelMatrix(params); if (params.mGroup) @@ -706,10 +715,21 @@ void LLDrawPoolBump::renderDeferred(S32 pass) LLVOAvatar* avatar = nullptr; U64 skin = 0; + std::unique_ptr ratPtr{}; for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { LLDrawInfo& params = **i; + if(params.mFace) + { + LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); + + if(vobj && vobj->isAttachment()) + { + trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr ); + } + } + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(params.mAlphaMaskCutoff); LLDrawPoolBump::bindBumpMap(params, bump_channel); @@ -1337,10 +1357,21 @@ void LLDrawPoolBump::renderBump(U32 type, U32 mask) LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); + std::unique_ptr ratPtr{}; for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { LLDrawInfo& params = **i; + if(params.mFace) + { + LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); + + if( vobj && vobj->isAttachment() ) + { + trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr ); + } + } + if (LLDrawPoolBump::bindBumpMap(params)) { if (mRigged) diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index 2b05f4c453..f2408a3294 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -32,6 +32,7 @@ #include "pipeline.h" #include "llglcommonfunc.h" #include "llvoavatar.h" +#include "llperfstats.h" S32 diffuse_channel = -1; @@ -164,9 +165,20 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); - for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) + std::unique_ptr ratPtr{}; + for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i) { LLDrawInfo& params = **i; + + if(params.mFace) + { + LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); + + if( vobj && vobj->isAttachment() ) + { + trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr ); + } + } mShader->uniform4f(LLShaderMgr::SPECULAR_COLOR, params.mSpecColor.mV[0], params.mSpecColor.mV[1], params.mSpecColor.mV[2], params.mSpecColor.mV[3]); mShader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, params.mEnvIntensity); diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 0ef9ab3215..257c0b2b37 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -99,16 +99,19 @@ BOOL LLFloaterPerformance::postBuild() mComplexityPanel = getChild("panel_performance_complexity"); mSettingsPanel = getChild("panel_performance_preferences"); mHUDsPanel = getChild("panel_performance_huds"); + mAutoadjustmentsPanel = getChild("panel_performance_autoadjustments"); getChild("nearby_subpanel")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::showSelectedPanel, this, mNearbyPanel)); getChild("complexity_subpanel")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::showSelectedPanel, this, mComplexityPanel)); getChild("settings_subpanel")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::showSelectedPanel, this, mSettingsPanel)); getChild("huds_subpanel")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::showSelectedPanel, this, mHUDsPanel)); + getChild("autoadjustments_subpanel")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::showSelectedPanel, this, mAutoadjustmentsPanel)); initBackBtn(mNearbyPanel); initBackBtn(mComplexityPanel); initBackBtn(mSettingsPanel); initBackBtn(mHUDsPanel); + initBackBtn(mAutoadjustmentsPanel); mHUDList = mHUDsPanel->getChild("hud_list"); mHUDList->setNameListType(LLNameListCtrl::SPECIAL); @@ -197,6 +200,7 @@ void LLFloaterPerformance::hidePanels() mComplexityPanel->setVisible(FALSE); mHUDsPanel->setVisible(FALSE); mSettingsPanel->setVisible(FALSE); + mAutoadjustmentsPanel->setVisible(FALSE); } void LLFloaterPerformance::initBackBtn(LLPanel* panel) diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index e40eee162d..01b65365da 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -76,6 +76,7 @@ private: LLPanel* mComplexityPanel; LLPanel* mHUDsPanel; LLPanel* mSettingsPanel; + LLPanel* mAutoadjustmentsPanel; LLNameListCtrl* mHUDList; LLNameListCtrl* mObjectList; LLNameListCtrl* mNearbyList; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index ac1dbe9867..77bf03852f 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -115,6 +115,7 @@ #include "llpresetsmanager.h" #include "llsearchableui.h" +#include "llperfstats.h" const F32 BANDWIDTH_UPDATER_TIMEOUT = 0.5f; char const* const VISIBILITY_DEFAULT = "default"; @@ -1481,6 +1482,23 @@ void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box, bool sh } } +void LLAvatarComplexityControls::updateMaxRenderTime(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val) +{ + setRenderTimeText((F32)(LLPerfStats::renderAvatarMaxART_ns/1000), value_label, short_val); +} + +void LLAvatarComplexityControls::setRenderTimeText(F32 value, LLTextBox* text_box, bool short_val) +{ + if (0 == value) + { + text_box->setText(LLTrans::getString("no_limit")); + } + else + { + text_box->setText(llformat("%.0f", value)); + } +} + void LLFloaterPreference::updateMaxComplexity() { // Called when the IndirectMaxComplexity control changes diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index a089fde9ff..de4e3cd886 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -358,6 +358,8 @@ class LLAvatarComplexityControls public: static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val = false); static void setText(U32 value, LLTextBox* text_box, bool short_val = false); + static void updateMaxRenderTime(LLSliderCtrl* slider, LLTextBox* value_label, bool short_val = false); + static void setRenderTimeText(F32 value, LLTextBox* text_box, bool short_val = false); static void setIndirectControls(); static void setIndirectMaxNonImpostors(); static void setIndirectMaxArc(); diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp new file mode 100644 index 0000000000..16d0df0245 --- /dev/null +++ b/indra/newview/llperfstats.cpp @@ -0,0 +1,469 @@ +/** +* @file llperfstats.cpp +* @brief Statistics collection to support autotune and perf flaoter. +* +* $LicenseInfo:firstyear=2022&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2022, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llperfstats.h" +#include "llcontrol.h" +#include "pipeline.h" +#include "llagentcamera.h" +#include "llvoavatar.h" +#include "llworld.h" +#include + +extern LLControlGroup gSavedSettings; + +namespace LLPerfStats +{ + std::atomic tunedAvatars{0}; + std::atomic renderAvatarMaxART_ns{(U64)(ART_UNLIMITED_NANOS)}; // highest render time we'll allow without culling features + bool belowTargetFPS{false}; + U32 lastGlobalPrefChange{0}; + std::mutex bufferToggleLock{}; + + Tunables tunables; + + std::atomic StatsRecorder::writeBuffer{0}; + bool StatsRecorder::collectionEnabled{true}; + LLUUID StatsRecorder::focusAv{LLUUID::null}; + std::array StatsRecorder::statsDoubleBuffer{ {} }; + std::array StatsRecorder::max{ {} }; + std::array StatsRecorder::sum{ {} }; + + void Tunables::applyUpdates() + { + assert_main_thread(); + // these following variables are proxies for pipeline statics we do not need a two way update (no llviewercontrol handler) + if( tuningFlag & NonImpostors ){ gSavedSettings.setU32("IndirectMaxNonImpostors", nonImpostors); }; + if( tuningFlag & ReflectionDetail ){ gSavedSettings.setS32("RenderReflectionDetail", reflectionDetail); }; + if( tuningFlag & FarClip ){ gSavedSettings.setF32("RenderFarClip", farClip); }; + if( tuningFlag & UserMinDrawDistance ){ gSavedSettings.setF32("AutoTuneRenderFarClipMin", userMinDrawDistance); }; + if( tuningFlag & UserTargetDrawDistance ){ gSavedSettings.setF32("AutoTuneRenderFarClipTarget", userTargetDrawDistance); }; + if( tuningFlag & UserImpostorDistance ){ gSavedSettings.setF32("AutoTuneImpostorFarAwayDistance", userImpostorDistance); }; + if( tuningFlag & UserImpostorDistanceTuningEnabled ){ gSavedSettings.setBOOL("AutoTuneImpostorByDistEnabled", userImpostorDistanceTuningEnabled); }; + if( tuningFlag & UserFPSTuningStrategy ){ gSavedSettings.setU32("TuningFPSStrategy", userFPSTuningStrategy); }; + if( tuningFlag & UserAutoTuneEnabled ){ gSavedSettings.setBOOL("AutoTuneFPS", userAutoTuneEnabled); }; + if( tuningFlag & UserAutoTuneLock ){ gSavedSettings.setBOOL("AutoTuneLock", userAutoTuneLock); }; + if( tuningFlag & UserTargetFPS ){ gSavedSettings.setU32("TargetFPS", userTargetFPS); }; + if( tuningFlag & UserTargetReflections ){ gSavedSettings.setS32("UserTargetReflections", userTargetReflections); }; + // Note: The Max ART slider is logarithmic and thus we have an intermediate proxy value + if( tuningFlag & UserARTCutoff ){ gSavedSettings.setF32("RenderAvatarMaxART", userARTCutoffSliderValue); }; + resetChanges(); + } + + void Tunables::updateRenderCostLimitFromSettings() + { + assert_main_thread(); + const auto newval = gSavedSettings.getF32("RenderAvatarMaxART"); + if(newval < log10(LLPerfStats::ART_UNLIMITED_NANOS/1000)) + { + LLPerfStats::renderAvatarMaxART_ns = pow(10,newval)*1000; + } + else + { + LLPerfStats::renderAvatarMaxART_ns = 0; + }; + } + + // static + void Tunables::updateSettingsFromRenderCostLimit() + { + if( userARTCutoffSliderValue != log10( ( (F32)LLPerfStats::renderAvatarMaxART_ns )/1000 ) ) + { + if( LLPerfStats::renderAvatarMaxART_ns != 0 ) + { + updateUserARTCutoffSlider(log10( ( (F32)LLPerfStats::renderAvatarMaxART_ns )/1000 ) ); + } + else + { + updateUserARTCutoffSlider(log10( (F32)LLPerfStats::ART_UNLIMITED_NANOS/1000 ) ); + } + } + } + + void Tunables::initialiseFromSettings() + { + assert_main_thread(); + // the following variables are two way and have "push" in llviewercontrol + LLPerfStats::tunables.userMinDrawDistance = gSavedSettings.getF32("AutoTuneRenderFarClipMin"); + LLPerfStats::tunables.userTargetDrawDistance = gSavedSettings.getF32("AutoTuneRenderFarClipTarget"); + LLPerfStats::tunables.userImpostorDistance = gSavedSettings.getF32("AutoTuneImpostorFarAwayDistance"); + LLPerfStats::tunables.userImpostorDistanceTuningEnabled = gSavedSettings.getBOOL("AutoTuneImpostorByDistEnabled"); + LLPerfStats::tunables.userFPSTuningStrategy = gSavedSettings.getU32("TuningFPSStrategy"); + LLPerfStats::tunables.userTargetFPS = gSavedSettings.getU32("TargetFPS"); + LLPerfStats::tunables.userTargetReflections = gSavedSettings.getS32("UserTargetReflections"); + LLPerfStats::tunables.userAutoTuneEnabled = gSavedSettings.getBOOL("AutoTuneFPS"); + LLPerfStats::tunables.userAutoTuneLock = gSavedSettings.getBOOL("AutoTuneLock"); + // Note: The Max ART slider is logarithmic and thus we have an intermediate proxy value + updateRenderCostLimitFromSettings(); + resetChanges(); + } + + StatsRecorder::StatsRecorder():q(1024*16),t(&StatsRecorder::run) + { + // create a queue + // create a thread to consume from the queue + tunables.initialiseFromSettings(); + t.detach(); + } + + // static + void StatsRecorder::toggleBuffer() + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + using ST = StatType_t; + + bool unreliable{false}; + LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FRAME); + auto& sceneStats = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null]; + auto& lastStats = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null]; + + static constexpr std::initializer_list sceneStatsToAvg = { + StatType_t::RENDER_FRAME, + StatType_t::RENDER_DISPLAY, + StatType_t::RENDER_HUDS, + StatType_t::RENDER_UI, + StatType_t::RENDER_SWAP, + // RENDER_LFS, + // RENDER_MESHREPO, + StatType_t::RENDER_IDLE }; + + static constexpr std::initializer_list avatarStatsToAvg = { + StatType_t::RENDER_GEOMETRY, + StatType_t::RENDER_SHADOWS, + StatType_t::RENDER_COMBINED, + StatType_t::RENDER_IDLE }; + + + if( /*sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)] != 0 ||*/ sceneStats[static_cast(StatType_t::RENDER_SLEEP)] != 0 ) + { + unreliable = true; + //lastStats[static_cast(StatType_t::RENDER_FPSLIMIT)] = sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)]; + lastStats[static_cast(StatType_t::RENDER_SLEEP)] = sceneStats[static_cast(StatType_t::RENDER_SLEEP)]; + lastStats[static_cast(StatType_t::RENDER_FRAME)] = sceneStats[static_cast(StatType_t::RENDER_FRAME)]; // bring over the total frame render time to deal with region crossing overlap issues + } + + if(!unreliable) + { + // only use these stats when things are reliable. + + for(auto & statEntry : sceneStatsToAvg) + { + auto avg = lastStats[static_cast(statEntry)]; + auto val = sceneStats[static_cast(statEntry)]; + sceneStats[static_cast(statEntry)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); + // LL_INFOS("scenestats") << "Scenestat: " << static_cast(statEntry) << " before=" << avg << " new=" << val << " newavg=" << statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null][static_cast(statEntry)] << LL_ENDL; + } + } +// Allow attachment times etc to update even when FPS limited or sleeping. + auto& statsMap = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_ATTACHMENT)]; + for(auto& stat_entry : statsMap) + { + auto val = stat_entry.second[static_cast(ST::RENDER_COMBINED)]; + if(val > SMOOTHING_PERIODS){ + auto avg = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_ATTACHMENT)][stat_entry.first][static_cast(ST::RENDER_COMBINED)]; + stat_entry.second[static_cast(ST::RENDER_COMBINED)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); + } + } + + + auto& statsMapAv = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_AVATAR)]; + for(auto& stat_entry : statsMapAv) + { + for(auto& stat : avatarStatsToAvg) + { + auto val = stat_entry.second[static_cast(stat)]; + if(val > SMOOTHING_PERIODS) + { + auto avg = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_AVATAR)][stat_entry.first][static_cast(stat)]; + stat_entry.second[static_cast(stat)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); + } + } + } + + // swap the buffers + if(enabled()) + { + std::lock_guard lock{bufferToggleLock}; + writeBuffer ^= 1; + }; // note we are relying on atomic updates here. The risk is low and would cause minor errors in the stats display. + + // clean the write maps in all cases. + auto& statsTypeMatrix = statsDoubleBuffer[writeBuffer]; + for(auto& statsMapByType : statsTypeMatrix) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("Clear stats maps"); + for(auto& stat_entry : statsMapByType) + { + std::fill_n(stat_entry.second.begin() ,static_cast(ST::STATS_COUNT),0); + } + statsMapByType.clear(); + } + for(int i=0; i< static_cast(ObjType_t::OT_COUNT); i++) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("clear max/sum"); + max[writeBuffer][i].fill(0); + sum[writeBuffer][i].fill(0); + } + + // and now adjust the proxy vars so that the main thread can adjust the visuals. + if(tunables.userAutoTuneEnabled) + { + updateAvatarParams(); + } + } + + // clear buffers when we change region or need a hard reset. + // static + void StatsRecorder::clearStatsBuffers() + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + using ST = StatType_t; + + auto& statsTypeMatrix = statsDoubleBuffer[writeBuffer]; + for(auto& statsMap : statsTypeMatrix) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("Clear stats maps"); + for(auto& stat_entry : statsMap) + { + std::fill_n(stat_entry.second.begin() ,static_cast(ST::STATS_COUNT),0); + } + statsMap.clear(); + } + for(int i=0; i< static_cast(ObjType_t::OT_COUNT); i++) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("clear max/sum"); + max[writeBuffer][i].fill(0); + sum[writeBuffer][i].fill(0); + } + // swap the clean buffers in + if(enabled()) + { + std::lock_guard lock{bufferToggleLock}; + writeBuffer ^= 1; + }; + // repeat before we start processing new stuff + for(auto& statsMap : statsTypeMatrix) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("Clear stats maps"); + for(auto& stat_entry : statsMap) + { + std::fill_n(stat_entry.second.begin() ,static_cast(ST::STATS_COUNT),0); + } + statsMap.clear(); + } + for(int i=0; i< static_cast(ObjType_t::OT_COUNT); i++) + { + LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("clear max/sum"); + max[writeBuffer][i].fill(0); + sum[writeBuffer][i].fill(0); + } + } + + //static + int StatsRecorder::countNearbyAvatars(S32 distance) + { + const auto our_pos = gAgentCamera.getCameraPositionGlobal(); + + std::vector positions; + uuid_vec_t avatar_ids; + LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance); + return positions.size(); + } + + // static + void StatsRecorder::updateAvatarParams() + { + + if(tunables.userImpostorDistanceTuningEnabled) + { + // if we have less than the user's "max Non-Impostors" avatars within the desired range then adjust the limit. + // also adjusts back up again for nearby crowds. + auto count = countNearbyAvatars(std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance)); + if( count != tunables.nonImpostors ) + { + tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER ); + LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; + } + } + + auto av_render_max_raw = LLPerfStats::StatsRecorder::getMax(ObjType_t::OT_AVATAR, LLPerfStats::StatType_t::RENDER_COMBINED); + // Is our target frame time lower than current? If so we need to take action to reduce draw overheads. + // cumulative avatar time (includes idle processing, attachments and base av) + auto tot_avatar_time_raw = LLPerfStats::StatsRecorder::getSum(ObjType_t::OT_AVATAR, LLPerfStats::StatType_t::RENDER_COMBINED); + // sleep time is basically forced sleep when window out of focus + auto tot_sleep_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SLEEP); + // similar to sleep time, induced by FPS limit + //auto tot_limit_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FPSLIMIT); + + + // the time spent this frame on the "doFrame" call. Treated as "tot time for frame" + auto tot_frame_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FRAME); + + if( tot_sleep_time_raw != 0 ) + { + // Note: we do not average sleep + // if at some point we need to, the averaging will need to take this into account or + // we forever think we're in the background due to residuals. + LL_DEBUGS() << "No tuning when not in focus" << LL_ENDL; + return; + } + + // The frametime budget we have based on the target FPS selected + auto target_frame_time_raw = (U64)llround((F64)LLTrace::BlockTimer::countsPerSecond()/(tunables.userTargetFPS==0?1:tunables.userTargetFPS)); + // LL_INFOS() << "Effective FPS(raw):" << tot_frame_time_raw << " Target:" << target_frame_time_raw << LL_ENDL; + auto inferredFPS{1000/(U32)std::max(raw_to_ms(tot_frame_time_raw),1.0)}; + U32 settingsChangeFrequency{inferredFPS > 25?inferredFPS:25}; + /*if( tot_limit_time_raw != 0) + { + // This could be problematic. + tot_frame_time_raw -= tot_limit_time_raw; + }*/ + // 1) Is the target frame time lower than current? + if( target_frame_time_raw <= tot_frame_time_raw ) + { + if(belowTargetFPS == false) + { + // this is the first frame under. hold fire to add a little hysteresis + belowTargetFPS = true; + LLPerfStats::lastGlobalPrefChange = gFrameCount; + } + // if so we've got work to do + + // how much of the frame was spent on non avatar related work? + U64 non_avatar_time_raw = tot_frame_time_raw - tot_avatar_time_raw; + + // If the target frame time < scene time (estimated as non_avatar time) + U64 target_avatar_time_raw; + if(target_frame_time_raw < non_avatar_time_raw) + { + // we cannnot do this by avatar adjustment alone. + if((gFrameCount - LLPerfStats::lastGlobalPrefChange) > settingsChangeFrequency) // give changes a short time to take effect. + { + if(tunables.userFPSTuningStrategy == TUNE_SCENE_AND_AVATARS) + { + // 1 - hack the water to opaque. all non opaque have a significant hit, this is a big boost for (arguably) a minor visual hit. + // the other reflection options make comparatively little change and if this overshoots we'll be stepping back up later + if(LLPipeline::RenderReflectionDetail != -2) + { + LLPerfStats::tunables.updateReflectionDetail(-2); + LLPerfStats::lastGlobalPrefChange = gFrameCount; + return; + } + else // deliberately "else" here so we only do one of these in any given frame + { + // step down the DD by 10m per update + auto new_dd = (LLPipeline::RenderFarClip - DD_STEP > tunables.userMinDrawDistance)?(LLPipeline::RenderFarClip - DD_STEP) : tunables.userMinDrawDistance; + if(new_dd != LLPipeline::RenderFarClip) + { + LLPerfStats::tunables.updateFarClip( new_dd ); + LLPerfStats::lastGlobalPrefChange = gFrameCount; + return; + } + } + } + // if we reach here, we've no more changes to make to tune scenery so we'll resort to agressive Avatar tuning + // Note: moved from outside "if changefrequency elapsed" to stop fallthrough and allow scenery changes time to take effect. + target_avatar_time_raw = 0; + } + else + { + // we made a settings change recently so let's give it time. + return; + } + } + else + { + // set desired avatar budget. + target_avatar_time_raw = target_frame_time_raw - non_avatar_time_raw; + } + + if( target_avatar_time_raw < tot_avatar_time_raw ) + { + // we need to spend less time drawing avatars to meet our budget + auto new_render_limit_ns {LLPerfStats::raw_to_ns(av_render_max_raw)}; + // max render this frame may be higher than the last (cos new entrants and jitter) so make sure we are heading in the right direction + if( new_render_limit_ns > renderAvatarMaxART_ns ) + { + new_render_limit_ns = renderAvatarMaxART_ns; + } + new_render_limit_ns -= LLPerfStats::ART_MIN_ADJUST_DOWN_NANOS; + + // bounce at the bottom to prevent "no limit" + new_render_limit_ns = std::max((U64)new_render_limit_ns, (U64)LLPerfStats::ART_MINIMUM_NANOS); + + // assign the new value + if(renderAvatarMaxART_ns != new_render_limit_ns) + { + renderAvatarMaxART_ns = new_render_limit_ns; + tunables.updateSettingsFromRenderCostLimit(); + } + // LL_DEBUGS() << "AUTO_TUNE: avatar_budget adjusted to:" << new_render_limit_ns << LL_ENDL; + } + // LL_DEBUGS() << "AUTO_TUNE: Target frame time:"<< LLPerfStats::raw_to_us(target_frame_time_raw) << "usecs (non_avatar is " << LLPerfStats::raw_to_us(non_avatar_time_raw) << "usecs) Max cost limited=" << renderAvatarMaxART_ns << LL_ENDL; + } + else if( LLPerfStats::raw_to_ns(target_frame_time_raw) > (LLPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns) ) + { + if(belowTargetFPS == true) + { + // we reached target, force a pause + lastGlobalPrefChange = gFrameCount; + belowTargetFPS = false; + } + + // once we're over the FPS target we slow down further + if((gFrameCount - lastGlobalPrefChange) > settingsChangeFrequency*3) + { + if(!tunables.userAutoTuneLock) + { + // we've reached the target and stayed long enough to consider stable. + // turn off if we are not locked. + tunables.updateUserAutoTuneEnabled(false); + } + if( LLPerfStats::tunedAvatars > 0 ) + { + // if we have more time to spare let's shift up little in the hope we'll restore an avatar. + renderAvatarMaxART_ns += LLPerfStats::ART_MIN_ADJUST_UP_NANOS; + tunables.updateSettingsFromRenderCostLimit(); + return; + } + if(tunables.userFPSTuningStrategy == TUNE_SCENE_AND_AVATARS) + { + if( LLPipeline::RenderFarClip < tunables.userTargetDrawDistance ) + { + LLPerfStats::tunables.updateFarClip( std::min(LLPipeline::RenderFarClip + DD_STEP, tunables.userTargetDrawDistance) ); + LLPerfStats::lastGlobalPrefChange = gFrameCount; + return; + } + if( (tot_frame_time_raw * 1.5) < target_frame_time_raw ) + { + // if everything else is "max" and we have >50% headroom let's knock the water quality up a notch at a time. + LLPerfStats::tunables.updateReflectionDetail( std::min(LLPipeline::RenderReflectionDetail + 1, tunables.userTargetReflections) ); + } + } + } + } + } +} \ No newline at end of file diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h new file mode 100644 index 0000000000..1e867f5ef1 --- /dev/null +++ b/indra/newview/llperfstats.h @@ -0,0 +1,454 @@ +/** +* @file llperfstats.h +* @brief Statistics collection to support autotune and perf flaoter. +* +* $LicenseInfo:firstyear=2022&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2022, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ +#pragma once +#ifndef LL_PERFSTATS_H_INCLUDED +#define LL_PERFSTATS_H_INCLUDED + +#include +#include +#include +#include +#include +#include "lluuid.h" +#include "llfasttimer.h" +#include "llapp.h" +#include "llprofiler.h" +#include "pipeline.h" + +extern U32 gFrameCount; +extern LLUUID gAgentID; +namespace LLPerfStats +{ +// Note if changing these, they should correspond with the log range of the correpsonding sliders + static constexpr U64 ART_UNLIMITED_NANOS{50000000}; + static constexpr U64 ART_MINIMUM_NANOS{100000}; + static constexpr U64 ART_MIN_ADJUST_UP_NANOS{10000}; + static constexpr U64 ART_MIN_ADJUST_DOWN_NANOS{10000}; + + static constexpr F32 PREFERRED_DD{180}; + static constexpr U32 SMOOTHING_PERIODS{50}; + static constexpr U32 DD_STEP{10}; + + static constexpr U32 TUNE_AVATARS_ONLY{0}; + static constexpr U32 TUNE_SCENE_AND_AVATARS{1}; + + extern std::atomic tunedAvatars; + extern std::atomic renderAvatarMaxART_ns; + extern bool belowTargetFPS; + extern U32 lastGlobalPrefChange; + extern std::mutex bufferToggleLock; + + enum class ObjType_t{ + OT_GENERAL=0, // Also Unknown. Used for n/a type stats such as scenery + OT_AVATAR, + OT_ATTACHMENT, + OT_HUD, + OT_COUNT + }; + enum class StatType_t{ + RENDER_GEOMETRY=0, + RENDER_SHADOWS, + RENDER_HUDS, + RENDER_UI, + RENDER_COMBINED, + RENDER_SWAP, + RENDER_FRAME, + RENDER_DISPLAY, + RENDER_SLEEP, + RENDER_LFS, + RENDER_MESHREPO, + //RENDER_FPSLIMIT, + RENDER_FPS, + RENDER_IDLE, + RENDER_DONE, // toggle buffer & clearbuffer (see processUpdate for hackery) + STATS_COUNT + }; + + struct StatsRecord + { + StatType_t statType; + ObjType_t objType; + LLUUID avID; + LLUUID objID; + uint64_t time; + bool isRigged; + bool isHUD; + }; + + struct Tunables + { + static constexpr U32 Nothing{0}; + static constexpr U32 NonImpostors{1}; + static constexpr U32 ReflectionDetail{2}; + static constexpr U32 FarClip{4}; + static constexpr U32 UserMinDrawDistance{8}; + static constexpr U32 UserTargetDrawDistance{16}; + static constexpr U32 UserImpostorDistance{32}; + static constexpr U32 UserImpostorDistanceTuningEnabled{64}; + static constexpr U32 UserFPSTuningStrategy{128}; + static constexpr U32 UserAutoTuneEnabled{256}; + static constexpr U32 UserTargetFPS{512}; + static constexpr U32 UserARTCutoff{1024}; + static constexpr U32 UserTargetReflections{2048}; + static constexpr U32 UserAutoTuneLock{4096}; + + U32 tuningFlag{0}; // bit mask for changed settings + + // proxy variables, used to pas the new value to be set via the mainthread + U32 nonImpostors{0}; + S32 reflectionDetail{0}; + F32 farClip{0.0}; + F32 userMinDrawDistance{0.0}; + F32 userTargetDrawDistance{0.0}; + F32 userImpostorDistance{0.0}; + bool userImpostorDistanceTuningEnabled{false}; + U32 userFPSTuningStrategy{0}; + bool userAutoTuneEnabled{false}; + bool userAutoTuneLock{true}; + U32 userTargetFPS{0}; + F32 userARTCutoffSliderValue{0}; + S32 userTargetReflections{0}; + + void updateNonImposters(U32 nv){nonImpostors=nv; tuningFlag |= NonImpostors;}; + void updateReflectionDetail(S32 nv){reflectionDetail=nv; tuningFlag |= ReflectionDetail;}; + void updateFarClip(F32 nv){farClip=nv; tuningFlag |= FarClip;}; + void updateUserMinDrawDistance(F32 nv){userMinDrawDistance=nv; tuningFlag |= UserMinDrawDistance;}; + void updateUserTargetDrawDistance(F32 nv){userTargetDrawDistance=nv; tuningFlag |= UserTargetDrawDistance;}; + void updateImposterDistance(F32 nv){userImpostorDistance=nv; tuningFlag |= UserImpostorDistance;}; + void updateImposterDistanceTuningEnabled(bool nv){userImpostorDistanceTuningEnabled=nv; tuningFlag |= UserImpostorDistanceTuningEnabled;}; + void updateUserFPSTuningStrategy(U32 nv){userFPSTuningStrategy=nv; tuningFlag |= UserFPSTuningStrategy;}; + void updateTargetFps(U32 nv){userTargetFPS=nv; tuningFlag |= UserTargetFPS;}; + void updateUserARTCutoffSlider(F32 nv){userARTCutoffSliderValue=nv; tuningFlag |= UserARTCutoff;}; + void updateUserAutoTuneEnabled(bool nv){userAutoTuneEnabled=nv; tuningFlag |= UserAutoTuneEnabled;}; + void updateUserAutoTuneLock(bool nv){userAutoTuneLock=nv; tuningFlag |= UserAutoTuneLock;}; + void updateUserTargetReflections(S32 nv){userTargetReflections=nv; tuningFlag |= UserTargetReflections;}; + + void resetChanges(){tuningFlag=Nothing;}; + void initialiseFromSettings(); + void updateRenderCostLimitFromSettings(); + void updateSettingsFromRenderCostLimit(); + void applyUpdates(); + }; + + extern Tunables tunables; + + class StatsRecorder{ + using Queue = LLThreadSafeQueue; + public: + + static inline StatsRecorder& getInstance() + { + static StatsRecorder instance; + return instance; + } + static inline void setFocusAv(const LLUUID& avID){focusAv = avID;}; + static inline const LLUUID& getFocusAv(){return focusAv;}; + static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.pushFront(std::move(upd));}; + static void endFrame(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});}; + static void clearStats(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});}; + + static inline void setEnabled(bool on_or_off){collectionEnabled=on_or_off;}; + static inline void enable() { collectionEnabled=true; }; + static inline void disable() { collectionEnabled=false; }; + static inline bool enabled() { return collectionEnabled; }; + + static inline int getReadBufferIndex() { return (writeBuffer ^ 1); }; + // static inline const StatsTypeMatrix& getCurrentStatsMatrix(){ return statsDoubleBuffer[getReadBufferIndex()];} + static inline uint64_t get(ObjType_t otype, LLUUID id, StatType_t type) + { + return statsDoubleBuffer[getReadBufferIndex()][static_cast(otype)][id][static_cast(type)]; + } + static inline uint64_t getSceneStat(StatType_t type) + { + return statsDoubleBuffer[getReadBufferIndex()][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null][static_cast(type)]; + } + + static inline uint64_t getSum(ObjType_t otype, StatType_t type) + { + return sum[getReadBufferIndex()][static_cast(otype)][static_cast(type)]; + } + static inline uint64_t getMax(ObjType_t otype, StatType_t type) + { + return max[getReadBufferIndex()][static_cast(otype)][static_cast(type)]; + } + static void updateAvatarParams(); + private: + StatsRecorder(); + + static int countNearbyAvatars(S32 distance); +// StatsArray is a uint64_t for each possible statistic type. + using StatsArray = std::array(LLPerfStats::StatType_t::STATS_COUNT)>; + using StatsMap = std::unordered_map>; + using StatsTypeMatrix = std::array(LLPerfStats::ObjType_t::OT_COUNT)>; + using StatsSummaryArray = std::array(LLPerfStats::ObjType_t::OT_COUNT)>; + + static std::atomic writeBuffer; + static LLUUID focusAv; + static std::array statsDoubleBuffer; + static std::array max; + static std::array sum; + static bool collectionEnabled; + + + void processUpdate(const StatsRecord& upd) const + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + // LL_INFOS("perfstats") << "processing update:" << LL_ENDL; + // Note: nullptr is used as the key for global stats + #ifdef TRACY_ENABLE + static char avstr[36]; + static char obstr[36]; + #endif + + if (upd.statType == StatType_t::RENDER_DONE && upd.objType == ObjType_t::OT_GENERAL && upd.time == 0) + { + // LL_INFOS("perfstats") << "End of Frame Toggle Buffer:" << gFrameCount << LL_ENDL; + toggleBuffer(); + return; + } + if (upd.statType == StatType_t::RENDER_DONE && upd.objType == ObjType_t::OT_GENERAL && upd.time == 1) + { + // LL_INFOS("perfstats") << "New region - clear buffers:" << gFrameCount << LL_ENDL; + clearStatsBuffers(); + return; + } + + auto ot{upd.objType}; + auto& key{upd.objID}; + auto& avKey{upd.avID}; + auto type {upd.statType}; + auto val {upd.time}; + + if (ot == ObjType_t::OT_GENERAL) + { + // LL_INFOS("perfstats") << "General update:" << LL_ENDL; + doUpd(key, ot, type,val); + return; + } + + if (ot == ObjType_t::OT_AVATAR) + { + // LL_INFOS("perfstats") << "Avatar update:" << LL_ENDL; + doUpd(avKey, ot, type, val); + return; + } + + if (ot == ObjType_t::OT_ATTACHMENT) + { + if( !upd.isHUD ) // don't include HUD cost in self. + { + LL_PROFILE_ZONE_NAMED("Att as Av") + // For all attachments that are not rigged we add them to the avatar (for all avatars) cost. + doUpd(avKey, ObjType_t::OT_AVATAR, type, val); + } + if( avKey == focusAv ) + { + LL_PROFILE_ZONE_NAMED("Att as Att") + // For attachments that are for the focusAv (self for now) we record them for the attachment/complexity view + if(upd.isHUD) + { + ot = ObjType_t::OT_HUD; + } + // LL_INFOS("perfstats") << "frame: " << gFrameCount << " Attachment update("<< (type==StatType_t::RENDER_GEOMETRY?"GEOMETRY":"SHADOW") << ": " << key.asString() << " = " << val << LL_ENDL; + doUpd(key, ot, type, val); + } + // else + // { + // // LL_INFOS("perfstats") << "frame: " << gFrameCount << " non-self Att update("<< (type==StatType_t::RENDER_GEOMETRY?"GEOMETRY":"SHADOW") << ": " << key.asString() << " = " << val << " for av " << avKey.asString() << LL_ENDL; + // } + } + } + + static inline void doUpd(const LLUUID& key, ObjType_t ot, StatType_t type, uint64_t val) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + using ST = StatType_t; + StatsMap& stm {statsDoubleBuffer[writeBuffer][static_cast(ot)]}; + auto& thisAsset = stm[key]; + + thisAsset[static_cast(type)] += val; + thisAsset[static_cast(ST::RENDER_COMBINED)] += val; + + sum[writeBuffer][static_cast(ot)][static_cast(type)] += val; + sum[writeBuffer][static_cast(ot)][static_cast(ST::RENDER_COMBINED)] += val; + + if(max[writeBuffer][static_cast(ot)][static_cast(type)] < thisAsset[static_cast(type)]) + { + max[writeBuffer][static_cast(ot)][static_cast(type)] = thisAsset[static_cast(type)]; + } + if(max[writeBuffer][static_cast(ot)][static_cast(ST::RENDER_COMBINED)] < thisAsset[static_cast(ST::RENDER_COMBINED)]) + { + max[writeBuffer][static_cast(ot)][static_cast(ST::RENDER_COMBINED)] = thisAsset[static_cast(ST::RENDER_COMBINED)]; + } + } + + static void toggleBuffer(); + static void clearStatsBuffers(); + + // thread entry + static void run() + { + StatsRecord upd[10]; + auto & instance {StatsRecorder::getInstance()}; + LL_PROFILER_SET_THREAD_NAME("PerfStats"); + + while( enabled() && !LLApp::isExiting() ) + { + auto count = 0; + while (count < 10) + { + if (instance.q.tryPopFor(std::chrono::milliseconds(10), upd[count])) + { + count++; + } + else + { + break; + } + } + //LL_PROFILER_THREAD_BEGIN("PerfStats"); + if(count) + { + // LL_INFOS("perfstats") << "processing " << count << " updates." << LL_ENDL; + for(auto i =0; i < count; i++) + { + instance.processUpdate(upd[i]); + } + } + //LL_PROFILER_THREAD_END("PerfStats"); + } + } + + Queue q; + std::thread t; + + ~StatsRecorder() = default; + StatsRecorder(const StatsRecorder&) = delete; + StatsRecorder& operator=(const StatsRecorder&) = delete; + + }; + + template + class RecordTime + { + + private: + RecordTime(const RecordTime&) = delete; + RecordTime() = delete; + U64 start; + public: + StatsRecord stat; + + RecordTime( const LLUUID& av, const LLUUID& id, StatType_t type, bool isRiggedAtt=false, bool isHUDAtt=false): + start{LLTrace::BlockTimer::getCPUClockCount64()}, + stat{type, ObjTypeDiscriminator, std::move(av), std::move(id), 0, isRiggedAtt, isHUDAtt} + { + //LL_PROFILE_ZONE_COLOR(tracy::Color::Orange); + }; + + template < ObjType_t OD = ObjTypeDiscriminator, + std::enable_if_t * = nullptr> + explicit RecordTime( StatType_t type ):RecordTime(LLUUID::null, LLUUID::null, type ) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + }; + + template < ObjType_t OD = ObjTypeDiscriminator, + std::enable_if_t * = nullptr> + RecordTime( const LLUUID & av, StatType_t type ):RecordTime(std::move(av), LLUUID::null, type) + { + //LL_PROFILE_ZONE_COLOR(tracy::Color::Purple); + }; + + ~RecordTime() + { + if(!LLPerfStats::StatsRecorder::enabled()) + { + return; + } + + //LL_PROFILE_ZONE_COLOR(tracy::Color::Red); + + stat.time = LLTrace::BlockTimer::getCPUClockCount64() - start; + StatsRecorder::send(std::move(stat)); + }; + }; + + + inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + + using RecordSceneTime = RecordTime; + using RecordAvatarTime = RecordTime; + using RecordAttachmentTime = RecordTime; + using RecordHudAttachmentTime = RecordTime; + +};// namespace LLPerfStats + +// helper functions +using RATptr = std::unique_ptr; +using RSTptr = std::unique_ptr; + +template +static inline void trackAttachments(const T * vobj, bool isRigged, RATptr* ratPtrp) +{ + if( !vobj ){ ratPtrp->reset(); return;}; + + const T* rootAtt{vobj}; + if (rootAtt->isAttachment()) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + + while( !rootAtt->isRootEdit() ) + { + rootAtt = (T*)(rootAtt->getParent()); + } + + auto avPtr = (T*)(rootAtt->getParent()); + if(!avPtr){ratPtrp->reset(); return;} + + auto& av = avPtr->getID(); + auto& obj = rootAtt->getAttachmentItemID(); + if (!*ratPtrp || (*ratPtrp)->stat.objID != obj || (*ratPtrp)->stat.avID != av) + { + if (*ratPtrp) + { + // deliberately reset to ensure destruction before construction of replacement. + ratPtrp->reset(); + }; + *ratPtrp = std::make_unique( + av, + obj, + ( LLPipeline::sShadowRender?LLPerfStats::StatType_t::RENDER_SHADOWS : LLPerfStats::StatType_t::RENDER_GEOMETRY ), + isRigged, + rootAtt->isHUDAttachment()); + } + } + return; +}; + +#endif \ No newline at end of file diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index dc48eaa823..9cbd56ee7f 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -207,6 +207,7 @@ #include "llstacktrace.h" #include "threadpool.h" +#include "llperfstats.h" #if LL_WINDOWS @@ -1492,6 +1493,8 @@ bool idle_startup() LLViewerParcelAskPlay::getInstance()->loadSettings(); } + gAgent.addRegionChangedCallback(boost::bind(&LLPerfStats::StatsRecorder::clearStats)); + // *Note: this is where gWorldMap used to be initialized. // register null callbacks for audio until the audio system is initialized @@ -3405,6 +3408,9 @@ bool process_login_success_response() if(!text.empty()) gAgentID.set(text); gDebugInfo["AgentID"] = text; + LLPerfStats::StatsRecorder::setEnabled(gSavedSettings.getBOOL("PerfStatsCaptureEnabled")); + LLPerfStats::StatsRecorder::setFocusAv(gAgentID); + // Agent id needed for parcel info request in LLUrlEntryParcel // to resolve parcel name. LLUrlEntryParcel::setAgentID(gAgentID); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index fd07fc32bc..e5723ebfe5 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -75,6 +75,7 @@ #include "llspellcheck.h" #include "llslurl.h" #include "llstartup.h" +#include "llperfstats.h" // Third party library includes #include @@ -643,6 +644,66 @@ bool toggle_show_object_render_cost(const LLSD& newvalue) } void handleRenderAutoMuteByteLimitChanged(const LLSD& new_value); + +void handleTargetFPSChanged(const LLSD& newValue) +{ + const auto targetFPS = gSavedSettings.getU32("TargetFPS"); + LLPerfStats::tunables.userTargetFPS = targetFPS; +} + +void handleAutoTuneLockChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getBOOL("AutoTuneLock"); + LLPerfStats::tunables.userAutoTuneLock = newval; +} + +void handleAutoTuneFPSChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getBOOL("AutoTuneFPS"); + LLPerfStats::tunables.userAutoTuneEnabled = newval; + if(newval && LLPerfStats::renderAvatarMaxART_ns == 0) // If we've enabled autotune we override "unlimited" to max + { + gSavedSettings.setF32("RenderAvatarMaxART",log10(LLPerfStats::ART_UNLIMITED_NANOS-1000));//triggers callback to update static var + } +} + +void handleRenderAvatarMaxARTChanged(const LLSD& newValue) +{ + LLPerfStats::tunables.updateRenderCostLimitFromSettings(); +} + +void handleUserTargetDrawDistanceChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getF32("AutoTuneRenderFarClipTarget"); + LLPerfStats::tunables.userTargetDrawDistance = newval; +} + +void handleUserTargetReflectionsChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getS32("UserTargetReflections"); + LLPerfStats::tunables.userTargetReflections = newval; +} + +void handlePerformanceStatsEnabledChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getBOOL("PerfStatsCaptureEnabled"); + LLPerfStats::StatsRecorder::setEnabled(newval); +} +void handleUserImpostorByDistEnabledChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getBOOL("AutoTuneImpostorByDistEnabled"); + LLPerfStats::tunables.userImpostorDistanceTuningEnabled = newval; +} +void handleUserImpostorDistanceChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getF32("AutoTuneImpostorFarAwayDistance"); + LLPerfStats::tunables.userImpostorDistance = newval; +} +void handleFPSTuningStrategyChanged(const LLSD& newValue) +{ + const auto newval = gSavedSettings.getU32("TuningFPSStrategy"); + LLPerfStats::tunables.userFPSTuningStrategy = newval; +} //////////////////////////////////////////////////////////////////////////// void settings_setup_listeners() @@ -796,6 +857,17 @@ void settings_setup_listeners() gSavedSettings.getControl("DebugAvatarJoints")->getCommitSignal()->connect(boost::bind(&handleDebugAvatarJointsChanged, _2)); gSavedSettings.getControl("RenderAutoMuteByteLimit")->getSignal()->connect(boost::bind(&handleRenderAutoMuteByteLimitChanged, _2)); gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getCommitSignal()->connect(boost::bind(&handleAvatarHoverOffsetChanged, _2)); + + gSavedSettings.getControl("TargetFPS")->getSignal()->connect(boost::bind(&handleTargetFPSChanged, _2)); + gSavedSettings.getControl("AutoTuneFPS")->getSignal()->connect(boost::bind(&handleAutoTuneFPSChanged, _2)); + gSavedSettings.getControl("AutoTuneLock")->getSignal()->connect(boost::bind(&handleAutoTuneLockChanged, _2)); + gSavedSettings.getControl("RenderAvatarMaxART")->getSignal()->connect(boost::bind(&handleRenderAvatarMaxARTChanged, _2)); + gSavedSettings.getControl("PerfStatsCaptureEnabled")->getSignal()->connect(boost::bind(&handlePerformanceStatsEnabledChanged, _2)); + gSavedSettings.getControl("UserTargetReflections")->getSignal()->connect(boost::bind(&handleUserTargetReflectionsChanged, _2)); + gSavedSettings.getControl("AutoTuneRenderFarClipTarget")->getSignal()->connect(boost::bind(&handleUserTargetDrawDistanceChanged, _2)); + gSavedSettings.getControl("AutoTuneImpostorFarAwayDistance")->getSignal()->connect(boost::bind(&handleUserImpostorDistanceChanged, _2)); + gSavedSettings.getControl("AutoTuneImpostorByDistEnabled")->getSignal()->connect(boost::bind(&handleUserImpostorByDistEnabledChanged, _2)); + gSavedSettings.getControl("TuningFPSStrategy")->getSignal()->connect(boost::bind(&handleFPSTuningStrategyChanged, _2)); } #if TEST_CACHED_CONTROL diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index be54cb2f96..fa026c2888 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -78,6 +78,7 @@ #include "llscenemonitor.h" #include "llenvironment.h" +#include "llperfstats.h" extern LLPointer gStartTexture; extern bool gShiftFrame; @@ -256,7 +257,8 @@ static LLTrace::BlockTimerStatHandle FTM_EEP_UPDATE("Env Update"); // Paint the display! void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { - LL_RECORD_BLOCK_TIME(FTM_RENDER); + LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_DISPLAY); // render time capture - This is the main stat for overall rendering. + LL_RECORD_BLOCK_TIME(FTM_RENDER); if (gWindowResized) { //skip render on frames where window has been resized @@ -1051,7 +1053,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) void render_hud_attachments() { - gGL.matrixMode(LLRender::MM_PROJECTION); + LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_HUDS); // render time capture - Primary contributor to HUDs (though these end up in render batches) + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); @@ -1242,7 +1245,8 @@ bool setup_hud_matrices(const LLRect& screen_region) void render_ui(F32 zoom_factor, int subfield) { - LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); + LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_UI ); // render time capture - Primary UI stat can have HUD time overlap (TODO) + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; //LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); LLGLState::checkStates(); @@ -1325,7 +1329,8 @@ static LLTrace::BlockTimerStatHandle FTM_SWAP("Swap"); void swap() { - LL_RECORD_BLOCK_TIME(FTM_SWAP); + LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_SWAP ); // render time capture - Swap buffer time - can signify excessive data transfer to/from GPU + LL_RECORD_BLOCK_TIME(FTM_SWAP); if (gDisplaySwapBuffers) { diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index f3b0e82b3a..489f90aabb 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -55,6 +55,7 @@ #include "m3math.h" #include "m4math.h" #include "llmatrix4a.h" +#include "llperfstats.h" #if !LL_DARWIN && !LL_LINUX extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB; @@ -230,6 +231,16 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) return 0; } + // render time capture + // This path does not appear to have attachments. Prove this then remove. + std::unique_ptr ratPtr{}; + auto vobj = mFace->getViewerObject(); + if( vobj && vobj->isAttachment() ) + { + trackAttachments( vobj, mFace->isState(LLFace::RIGGED), &ratPtr ); + LL_WARNS("trackAttachments") << "Attachment render time is captuted." << LL_ENDL; + } + U32 triangle_count = 0; S32 diffuse_channel = LLDrawPoolAvatar::sDiffuseChannel; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b66a6958fe..1a71780a88 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -113,6 +113,8 @@ #include "llrendersphere.h" #include "llskinningutil.h" +#include "llperfstats.h" + #include extern F32 SPEED_ADJUST_MAX; @@ -2544,6 +2546,9 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL; return; } + // record time and refresh "tooSlow" status + LLPerfStats::RecordAvatarTime T(getID(), LLPerfStats::StatType_t::RENDER_IDLE); // per avatar "idle" time. + updateTooSlow(); static LLCachedControl disable_all_render_types(gSavedSettings, "DisableAllRenderTypes"); if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR)) @@ -8268,6 +8273,94 @@ bool LLVOAvatar::isTooComplex() const return too_complex; } +// use Avatar Render Time as complexity metric +// markARTStale - Mark stale and set the frameupdate to now so that we can wait at least one frame to get a revised number. +void LLVOAvatar::markARTStale() +{ + mARTStale=true; + mLastARTUpdateFrame = LLFrameTimer::getFrameCount(); +} + +// Udpate Avatar state based on render time +void LLVOAvatar::updateTooSlow() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; + static LLCachedControl alwaysRenderFriends(gSavedSettings, "AlwaysRenderFriends"); + static LLCachedControl allowSelfImpostor(gSavedSettings, "AllowSelfImpostor"); + const auto id = getID(); + + // mTooSlow - Is the avatar flagged as being slow (includes shadow time) + // mTooSlowWithoutShadows - Is the avatar flagged as being slow even with shadows removed. + // mARTStale - the rendertime we have is stale because of an update. We need to force a re-render to re-assess slowness + + if( mARTStale ) + { + if ( LLFrameTimer::getFrameCount() - mLastARTUpdateFrame < 5 ) + { + // LL_INFOS() << this->getFullname() << " marked stale " << LL_ENDL; + // we've not had a chance to update yet (allow a few to be certain a full frame has passed) + return; + } + + mARTStale = false; + mTooSlow = false; + mTooSlowWithoutShadows = false; + // LL_INFOS() << this->getFullname() << " refreshed ART combined = " << mRenderTime << " @ " << mLastARTUpdateFrame << LL_ENDL; + } + + // Either we're not stale or we've updated. + + U64 render_time_raw; + U64 render_geom_time_raw; + + if( !mTooSlow ) + { + // we are fully rendered, so we use the live values + std::lock_guard lock{LLPerfStats::bufferToggleLock}; + render_time_raw = LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_COMBINED); + render_geom_time_raw = LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_GEOMETRY); + } + else + { + // use the cached values. + render_time_raw = mRenderTime; + render_geom_time_raw = mGeomTime; + } + if( (LLPerfStats::renderAvatarMaxART_ns > 0) && + (LLPerfStats::raw_to_ns(render_time_raw) >= LLPerfStats::renderAvatarMaxART_ns) ) + { + if( !mTooSlow ) // if we were previously not slow (with or without shadows.) + { + // if we weren't capped, we are now + mLastARTUpdateFrame = LLFrameTimer::getFrameCount(); + mRenderTime = render_time_raw; + mGeomTime = render_geom_time_raw; + mARTStale = false; + mTooSlow = true; + } + if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap + { + bool render_friend_or_exception = ( alwaysRenderFriends && LLAvatarTracker::instance().isBuddy( id ) ) || + ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER ); + if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception ) + { + // Note: slow rendering Friends still get their shadows zapped. + mTooSlowWithoutShadows = (LLPerfStats::raw_to_ns(render_geom_time_raw) >= LLPerfStats::renderAvatarMaxART_ns); + } + } + } + else + { + // LL_INFOS() << this->getFullname() << " ("<< (combined?"combined":"geometry") << ") good render time = " << LLPerfStats::raw_to_ns(render_time_raw) << " vs ("<< LLVOAvatar::sRenderTimeCap_ns << " set @ " << mLastARTUpdateFrame << LL_ENDL; + mTooSlow = false; + mTooSlowWithoutShadows = false; + } + if(mTooSlow) + { + LLPerfStats::tunedAvatars++; // increment the number of avatars that have been tweaked. + } +} + //----------------------------------------------------------------------------- // findMotion() //----------------------------------------------------------------------------- diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index e9c3d48a78..a27327d8a3 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -350,6 +350,18 @@ public: //-------------------------------------------------------------------- public: BOOL isFullyLoaded() const; + + // check and return current state relative to limits + // default will test only the geometry (combined=false). + // this allows us to disable shadows separately on complex avatars. + inline bool isTooSlowWithShadows() const {return mTooSlow;}; + inline bool isTooSlowWithoutShadows() const {return mTooSlowWithoutShadows;}; + inline bool isTooSlow(bool combined = false) const + { + return(combined?mTooSlow:mTooSlowWithoutShadows); + } + void updateTooSlow(); + bool isTooComplex() const; bool visualParamWeightsAreDefault(); virtual bool getIsCloud() const; @@ -369,6 +381,7 @@ public: void logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed); void calcMutedAVColor(); + void markARTStale(); protected: LLViewerStats::PhaseMap& getPhases() { return mPhases; } @@ -390,6 +403,15 @@ private: LLFrameTimer mFullyLoadedTimer; LLFrameTimer mRuthTimer; + U32 mLastARTUpdateFrame{0}; + U64 mRenderTime{0}; + U64 mGeomTime{0}; + bool mARTStale{true}; + bool mARTCapped{false}; + // variables to hold "slowness" status + bool mTooSlow{false}; + bool mTooSlowWithoutShadows{false}; + private: LLViewerStats::PhaseMap mPhases; @@ -1145,6 +1167,8 @@ public: // COF version of last appearance message received for this av. S32 mLastUpdateReceivedCOFVersion; + U64 getLastART() const { return mRenderTime; } + /** Diagnostics ** ** *******************************************************************************/ diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f4a938e57d..77d1511dcd 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -88,6 +88,7 @@ #include "llcallstack.h" #include "llsculptidsize.h" #include "llavatarappearancedefines.h" +#include "llperfstats.h" const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; const F32 FORCE_CULL_AREA = 8.f; @@ -5589,6 +5590,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LL_PROFILE_ZONE_NAMED("rebuildGeom - face list"); //get all the faces into a list + std::unique_ptr ratPtr{}; for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { @@ -5620,6 +5622,11 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) continue; } + if(vobj->isAttachment()) + { + trackAttachments( vobj, drawablep->isState(LLDrawable::RIGGED),&ratPtr); + } + LLVolume* volume = vobj->getVolume(); if (volume) { @@ -6010,6 +6017,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) U32 buffer_count = 0; + std::unique_ptr ratPtr{}; for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable(); @@ -6019,6 +6027,11 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) LLVOVolume* vobj = drawablep->getVOVolume(); if (!vobj) continue; + + if (vobj->isAttachment()) + { + trackAttachments( vobj, drawablep->isState(LLDrawable::RIGGED), &ratPtr ); + } if (debugLoggingEnabled("AnimatedObjectsLinkset")) { @@ -6458,10 +6471,16 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace U32 indices_index = 0; U16 index_offset = 0; - while (face_iter < i) + std::unique_ptr ratPtr; + while (face_iter < i) { //update face indices for new buffer facep = *face_iter; + LLViewerObject* vobj = facep->getViewerObject(); + if(vobj && vobj->isAttachment()) + { + trackAttachments(vobj, LLPipeline::sShadowRender, &ratPtr); + } if (buffer.isNull()) { // Bulk allocation failed diff --git a/indra/newview/skins/default/xui/en/floater_performance.xml b/indra/newview/skins/default/xui/en/floater_performance.xml index bf2623f356..ee88701037 100644 --- a/indra/newview/skins/default/xui/en/floater_performance.xml +++ b/indra/newview/skins/default/xui/en/floater_performance.xml @@ -277,6 +277,52 @@ top="19" right="-20"/> + + + Preferred frame rate + + + Allow automatic adjustments to reach your preferred frame rate (advanced). + + + + diff --git a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml new file mode 100644 index 0000000000..10ac4b98b7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml @@ -0,0 +1,272 @@ + + + + + Back + + + Preferred frame rate + + + + Desired frame rate + + + + + + + Settings affect + + + + + + + + Reducing detail shown on avatars that are far away will improve graphics speed. + + + + + + meters + + + + Choose the distance range that automatic settings will affect. + + + Minimum distance + + + + + Maximum distance + + + + From 81c287f877a48381bfa212ad00fe23aef260ef5f Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 22 Sep 2022 20:34:29 +0300 Subject: [PATCH 26/99] SL-18202 WIP merging autotune contribution and updating UI #2 --- indra/newview/app_settings/settings.xml | 11 ++ indra/newview/llfloaterperformance.cpp | 150 ++++++++++-------- indra/newview/llfloaterperformance.h | 5 +- indra/newview/llperfstats.cpp | 20 +-- indra/newview/llperfstats.h | 2 +- indra/newview/pipeline.cpp | 10 +- .../xui/en/panel_performance_nearby.xml | 24 +-- 7 files changed, 127 insertions(+), 95 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d92632c0a2..b1b971da14 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16820,6 +16820,17 @@ Value 0 + ShowTunedART + + Comment + Show the current render time not the pre-tuning render time in the avatar display. + Persist + 1 + Type + Boolean + Value + 1 + RenderAvatarMaxART Comment diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 257c0b2b37..afa46db1e3 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -38,6 +38,7 @@ #include "llfloaterreg.h" #include "llnamelistctrl.h" #include "llnotificationsutil.h" +#include "llperfstats.h" #include "llradiogroup.h" #include "llsliderctrl.h" #include "lltextbox.h" @@ -54,6 +55,11 @@ const S32 BAR_LEFT_PAD = 2; const S32 BAR_RIGHT_PAD = 5; const S32 BAR_BOTTOM_PAD = 9; +constexpr auto AvType {LLPerfStats::ObjType_t::OT_AVATAR}; +constexpr auto AttType {LLPerfStats::ObjType_t::OT_ATTACHMENT}; +constexpr auto HudType {LLPerfStats::ObjType_t::OT_HUD}; +constexpr auto SceneType {LLPerfStats::ObjType_t::OT_GENERAL}; + class LLExceptionsContextMenu : public LLListContextMenu { public: @@ -87,7 +93,7 @@ LLFloaterPerformance::LLFloaterPerformance(const LLSD& key) LLFloaterPerformance::~LLFloaterPerformance() { - mComplexityChangedSignal.disconnect(); + mMaxARTChangedSignal.disconnect(); delete mContextMenu; delete mUpdateTimer; } @@ -135,11 +141,15 @@ BOOL LLFloaterPerformance::postBuild() mNearbyList = mNearbyPanel->getChild("nearby_list"); mNearbyList->setRightMouseDownCallback(boost::bind(&LLFloaterPerformance::onAvatarListRightClick, this, _1, _2, _3)); - updateComplexityText(); - mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPerformance::updateComplexityText, this)); - mNearbyPanel->getChild("IndirectMaxComplexity")->setCommitCallback(boost::bind(&LLFloaterPerformance::updateMaxComplexity, this)); + mMaxARTChangedSignal = gSavedSettings.getControl("RenderAvatarMaxART")->getCommitSignal()->connect(boost::bind(&LLFloaterPerformance::updateMaxRenderTime, this)); + mNearbyPanel->getChild("RenderAvatarMaxART")->setCommitCallback(boost::bind(&LLFloaterPerformance::updateMaxRenderTime, this)); - LLAvatarComplexityControls::setIndirectMaxArc(); + // store the current setting as the users desired reflection detail and DD + gSavedSettings.setS32("UserTargetReflections", LLPipeline::RenderReflectionDetail); + if(!LLPerfStats::tunables.userAutoTuneEnabled) + { + gSavedSettings.setF32("AutoTuneRenderFarClipTarget", LLPipeline::RenderFarClip); + } return TRUE; } @@ -224,16 +234,13 @@ void LLFloaterPerformance::populateHUDList() hud_complexity_list_t::iterator iter = complexity_list.begin(); hud_complexity_list_t::iterator end = complexity_list.end(); - U32 max_complexity = 0; - for (; iter != end; ++iter) - { - max_complexity = llmax(max_complexity, (*iter).objectsCost); - } - + auto huds_max_render_time_raw = LLPerfStats::StatsRecorder::getMax(HudType, LLPerfStats::StatType_t::RENDER_GEOMETRY); for (iter = complexity_list.begin(); iter != end; ++iter) { - LLHUDComplexity hud_object_complexity = *iter; - S32 obj_cost_short = llmax((S32)hud_object_complexity.objectsCost / 1000, 1); + LLHUDComplexity hud_object_complexity = *iter; + + auto hud_render_time_raw = LLPerfStats::StatsRecorder::get(HudType, hud_object_complexity.objectId, LLPerfStats::StatType_t::RENDER_GEOMETRY); + LLSD item; item["special_id"] = hud_object_complexity.objectId; item["target"] = LLNameListCtrl::SPECIAL; @@ -241,14 +248,14 @@ void LLFloaterPerformance::populateHUDList() row[0]["column"] = "complex_visual"; row[0]["type"] = "bar"; LLSD& value = row[0]["value"]; - value["ratio"] = (F32)obj_cost_short / max_complexity * 1000; + value["ratio"] = (F32)hud_render_time_raw / huds_max_render_time_raw; value["bottom"] = BAR_BOTTOM_PAD; value["left_pad"] = BAR_LEFT_PAD; value["right_pad"] = BAR_RIGHT_PAD; row[1]["column"] = "complex_value"; row[1]["type"] = "text"; - row[1]["value"] = std::to_string(obj_cost_short); + row[1]["value"] = llformat( "%.f",LLPerfStats::raw_to_us(hud_render_time_raw) ); row[1]["font"]["name"] = "SANSSERIF"; row[2]["column"] = "name"; @@ -283,45 +290,46 @@ void LLFloaterPerformance::populateObjectList() object_complexity_list_t::iterator iter = complexity_list.begin(); object_complexity_list_t::iterator end = complexity_list.end(); - U32 max_complexity = 0; - for (; iter != end; ++iter) + // for consistency we lock the buffer while we build the list. In theory this is uncontended as the buffer should only toggle on end of frame { - max_complexity = llmax(max_complexity, (*iter).objectCost); - } + std::lock_guard guard{ LLPerfStats::bufferToggleLock }; + auto att_max_render_time_raw = LLPerfStats::StatsRecorder::getMax(AttType, LLPerfStats::StatType_t::RENDER_COMBINED); - for (iter = complexity_list.begin(); iter != end; ++iter) - { - LLObjectComplexity object_complexity = *iter; - S32 obj_cost_short = llmax((S32)object_complexity.objectCost / 1000, 1); - LLSD item; - item["special_id"] = object_complexity.objectId; - item["target"] = LLNameListCtrl::SPECIAL; - LLSD& row = item["columns"]; - row[0]["column"] = "complex_visual"; - row[0]["type"] = "bar"; - LLSD& value = row[0]["value"]; - value["ratio"] = (F32)obj_cost_short / max_complexity * 1000; - value["bottom"] = BAR_BOTTOM_PAD; - value["left_pad"] = BAR_LEFT_PAD; - value["right_pad"] = BAR_RIGHT_PAD; - - row[1]["column"] = "complex_value"; - row[1]["type"] = "text"; - row[1]["value"] = std::to_string(obj_cost_short); - row[1]["font"]["name"] = "SANSSERIF"; - - row[2]["column"] = "name"; - row[2]["type"] = "text"; - row[2]["value"] = object_complexity.objectName; - row[2]["font"]["name"] = "SANSSERIF"; - - LLScrollListItem* obj = mObjectList->addElement(item); - if (obj) + for (iter = complexity_list.begin(); iter != end; ++iter) { - LLScrollListText* value_text = dynamic_cast(obj->getColumn(1)); - if (value_text) + LLObjectComplexity object_complexity = *iter; + + auto attach_render_time_raw = LLPerfStats::StatsRecorder::get(AttType, object_complexity.objectId, LLPerfStats::StatType_t::RENDER_COMBINED); + LLSD item; + item["special_id"] = object_complexity.objectId; + item["target"] = LLNameListCtrl::SPECIAL; + LLSD& row = item["columns"]; + row[0]["column"] = "complex_visual"; + row[0]["type"] = "bar"; + LLSD& value = row[0]["value"]; + value["ratio"] = ((F32)attach_render_time_raw) / att_max_render_time_raw; + value["bottom"] = BAR_BOTTOM_PAD; + value["left_pad"] = BAR_LEFT_PAD; + value["right_pad"] = BAR_RIGHT_PAD; + + row[1]["column"] = "complex_value"; + row[1]["type"] = "text"; + row[1]["value"] = llformat("%.f", LLPerfStats::raw_to_us(attach_render_time_raw)); + row[1]["font"]["name"] = "SANSSERIF"; + + row[2]["column"] = "name"; + row[2]["type"] = "text"; + row[2]["value"] = object_complexity.objectName; + row[2]["font"]["name"] = "SANSSERIF"; + + LLScrollListItem* obj = mObjectList->addElement(item); + if (obj) { - value_text->setAlignment(LLFontGL::HCENTER); + LLScrollListText* value_text = dynamic_cast(obj->getColumn(1)); + if (value_text) + { + value_text->setAlignment(LLFontGL::HCENTER); + } } } } @@ -332,6 +340,7 @@ void LLFloaterPerformance::populateObjectList() void LLFloaterPerformance::populateNearbyList() { + static LLCachedControl showTunedART(gSavedSettings, "ShowTunedART"); S32 prev_pos = mNearbyList->getScrollPos(); LLUUID prev_selected_id = mNearbyList->getStringUUIDSelectedItem(); mNearbyList->clearRows(); @@ -342,26 +351,44 @@ void LLFloaterPerformance::populateNearbyList() mNearbyMaxComplexity = LLWorld::getInstance()->getNearbyAvatarsAndCompl(valid_nearby_avs); std::vector::iterator char_iter = valid_nearby_avs.begin(); + + LLPerfStats::bufferToggleLock.lock(); + auto av_render_max_raw = LLPerfStats::StatsRecorder::getMax(AvType, LLPerfStats::StatType_t::RENDER_COMBINED); + LLPerfStats::bufferToggleLock.unlock(); + while (char_iter != valid_nearby_avs.end()) { LLVOAvatar* avatar = dynamic_cast(*char_iter); if (avatar && (LLVOAvatar::AOA_INVISIBLE != avatar->getOverallAppearance())) { - S32 complexity_short = llmax((S32)avatar->getVisualComplexity() / 1000, 1);; + LLPerfStats::bufferToggleLock.lock(); + auto render_av_raw = LLPerfStats::StatsRecorder::get(AvType, avatar->getID(),LLPerfStats::StatType_t::RENDER_COMBINED); + LLPerfStats::bufferToggleLock.unlock(); + + auto is_slow = avatar->isTooSlowWithShadows(); LLSD item; item["id"] = avatar->getID(); LLSD& row = item["columns"]; row[0]["column"] = "complex_visual"; row[0]["type"] = "bar"; LLSD& value = row[0]["value"]; - value["ratio"] = (F32)complexity_short / mNearbyMaxComplexity * 1000; + // The ratio used in the bar is the current cost, as soon as we take action this changes so we keep the + // pre-tune value for the numerical column and sorting. + value["ratio"] = (double)render_av_raw / av_render_max_raw; value["bottom"] = BAR_BOTTOM_PAD; value["left_pad"] = BAR_LEFT_PAD; value["right_pad"] = BAR_RIGHT_PAD; row[1]["column"] = "complex_value"; row[1]["type"] = "text"; - row[1]["value"] = std::to_string(complexity_short); + if (is_slow && !showTunedART) + { + row[1]["value"] = llformat( "%.f", LLPerfStats::raw_to_us( avatar->getLastART() ) ); + } + else + { + row[1]["value"] = llformat( "%.f", LLPerfStats::raw_to_us( render_av_raw ) ); + } row[1]["font"]["name"] = "SANSSERIF"; row[2]["column"] = "name"; @@ -387,7 +414,7 @@ void LLFloaterPerformance::populateNearbyList() else { std::string color = "white"; - if (LLVOAvatar::AOA_JELLYDOLL == avatar->getOverallAppearance()) + if (is_slow || LLVOAvatar::AOA_JELLYDOLL == avatar->getOverallAppearance()) { color = "LabelDisabledColor"; LLScrollListBar* bar = dynamic_cast(av_item->getColumn(0)); @@ -462,18 +489,11 @@ void LLFloaterPerformance::onClickExceptions() LLFloaterReg::showInstance("avatar_render_settings"); } -void LLFloaterPerformance::updateMaxComplexity() +void LLFloaterPerformance::updateMaxRenderTime() { - LLAvatarComplexityControls::updateMax( - mNearbyPanel->getChild("IndirectMaxComplexity"), - mNearbyPanel->getChild("IndirectMaxComplexityText"), - true); -} - -void LLFloaterPerformance::updateComplexityText() -{ - LLAvatarComplexityControls::setText(gSavedSettings.getU32("RenderAvatarMaxComplexity"), - mNearbyPanel->getChild("IndirectMaxComplexityText", true), + LLAvatarComplexityControls::updateMaxRenderTime( + mNearbyPanel->getChild("RenderAvatarMaxART"), + mNearbyPanel->getChild("RenderAvatarMaxARTText"), true); } diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 01b65365da..a79da7460b 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -66,8 +66,7 @@ private: void onClickShadows(); void onClickAdvancedLighting(); - void updateMaxComplexity(); - void updateComplexityText(); + void updateMaxRenderTime(); static void changeQualityLevel(const std::string& notif); @@ -87,7 +86,7 @@ private: S32 mNearbyMaxComplexity; - boost::signals2::connection mComplexityChangedSignal; + boost::signals2::connection mMaxARTChangedSignal; }; #endif // LL_LLFLOATERPERFORMANCE_H diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 16d0df0245..1a0e5842e2 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -76,15 +76,15 @@ namespace LLPerfStats void Tunables::updateRenderCostLimitFromSettings() { assert_main_thread(); - const auto newval = gSavedSettings.getF32("RenderAvatarMaxART"); - if(newval < log10(LLPerfStats::ART_UNLIMITED_NANOS/1000)) - { - LLPerfStats::renderAvatarMaxART_ns = pow(10,newval)*1000; - } - else - { - LLPerfStats::renderAvatarMaxART_ns = 0; - }; + const auto newval = gSavedSettings.getF32("RenderAvatarMaxART"); + if(newval < log10(LLPerfStats::ART_UNLIMITED_NANOS/1000)) + { + LLPerfStats::renderAvatarMaxART_ns = pow(10,newval)*1000; + } + else + { + LLPerfStats::renderAvatarMaxART_ns = 0; + } } // static @@ -466,4 +466,4 @@ namespace LLPerfStats } } } -} \ No newline at end of file +} diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h index 1e867f5ef1..961594f18c 100644 --- a/indra/newview/llperfstats.h +++ b/indra/newview/llperfstats.h @@ -451,4 +451,4 @@ static inline void trackAttachments(const T * vobj, bool isRigged, RATptr* ratPt return; }; -#endif \ No newline at end of file +#endif diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7044d27430..2a059e5db4 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -10853,10 +10853,12 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) << " is " << ( too_complex ? "" : "not ") << "too complex" << LL_ENDL; - pushRenderTypeMask(); - - if (visually_muted || too_complex) - { + bool too_slow = avatar->isTooSlowWithoutShadows(); // only if we really have to do we imposter. + + pushRenderTypeMask(); + + if ( !too_slow && ( visually_muted || too_complex ) ) + { // only show jelly doll geometry andRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, diff --git a/indra/newview/skins/default/xui/en/panel_performance_nearby.xml b/indra/newview/skins/default/xui/en/panel_performance_nearby.xml index e1aef13717..e80bf592e4 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_nearby.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_nearby.xml @@ -57,22 +57,22 @@ Hide the most complex avatars to boost speed. + width="490"> - 0 + no limit Date: Fri, 23 Sep 2022 16:49:47 +0300 Subject: [PATCH 27/99] SL-18202 remove old autofps --- indra/newview/app_settings/settings.xml | 57 ------- indra/newview/llagent.cpp | 2 - indra/newview/llfloaterperformance.cpp | 16 +- indra/newview/llfloaterpreference.cpp | 18 --- indra/newview/llfloaterpreference.h | 2 - .../llfloaterpreferencesgraphicsadvanced.cpp | 5 - indra/newview/llstartup.cpp | 4 - indra/newview/llviewerdisplay.cpp | 2 - indra/newview/pipeline.cpp | 143 +----------------- indra/newview/pipeline.h | 7 - .../floater_preferences_graphics_advanced.xml | 4 - .../xui/en/panel_performance_preferences.xml | 37 +---- .../xui/en/panel_preferences_graphics1.xml | 34 +---- 13 files changed, 10 insertions(+), 321 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b1b971da14..bf72492a28 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16719,63 +16719,6 @@ Value 0 - AutoFPS - - Comment - - Allow dynamic adjustment of graphics preferences - - Persist - 1 - Type - Boolean - Value - 0 - - AutoAdjustmentTimeout - - Comment - Time before next iteration of automatic adjustments - Persist - 1 - Type - F32 - Value - 5 - - InitialAdjustmentTimeout - - Comment - Time before first iteration of automatic adjustments after login to the world, teleporting, maximizing Viewer etc. - Persist - 1 - Type - F32 - Value - 10 - - AutoFPSLowerBoundary - - Comment - FPS lower boundary when automatic adjustments are occured to reduce graphics quality to increase FPS - Persist - 1 - Type - S32 - Value - 30 - - AutoFPSUpperBoundary - - Comment - FPS upper boundary when automatic adjustments are occured to increase graphics quality - Persist - 1 - Type - S32 - Value - 50 - TargetFPS Comment diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 78c726043e..8a6186123e 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4097,7 +4097,6 @@ void LLAgent::handleTeleportFinished() } } - gPipeline.setAdjustmentTimerExpiry(gSavedSettings.getF32("InitialAdjustmentTimeout")); } void LLAgent::handleTeleportFailed() @@ -4130,7 +4129,6 @@ void LLAgent::handleTeleportFailed() mTPNeedsNeabyChatSeparator = false; - gPipeline.setAdjustmentTimerExpiry(gSavedSettings.getF32("InitialAdjustmentTimeout")); } /*static*/ diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index afa46db1e3..da1670c15e 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -58,7 +58,6 @@ const S32 BAR_BOTTOM_PAD = 9; constexpr auto AvType {LLPerfStats::ObjType_t::OT_AVATAR}; constexpr auto AttType {LLPerfStats::ObjType_t::OT_ATTACHMENT}; constexpr auto HudType {LLPerfStats::ObjType_t::OT_HUD}; -constexpr auto SceneType {LLPerfStats::ObjType_t::OT_GENERAL}; class LLExceptionsContextMenu : public LLListContextMenu { @@ -87,8 +86,6 @@ LLFloaterPerformance::LLFloaterPerformance(const LLSD& key) mNearbyMaxComplexity(0) { mContextMenu = new LLExceptionsContextMenu(this); - - mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); } LLFloaterPerformance::~LLFloaterPerformance() @@ -133,7 +130,6 @@ BOOL LLFloaterPerformance::postBuild() mSettingsPanel->getChild("graphics_quality")->setCommitCallback(boost::bind(&LLFloaterPerformance::onChangeQuality, this, _2)); mSettingsPanel->getChild("advanced_lighting_model")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickAdvancedLighting, this)); mSettingsPanel->getChild("ShadowDetail")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickShadows, this)); - mSettingsPanel->getChild("Reflections")->setMouseDownCallback(boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); mNearbyPanel->getChild("exceptions_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickExceptions, this)); mNearbyPanel->getChild("hide_avatars")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickHideAvatars, this)); @@ -623,16 +619,10 @@ void LLFloaterPerformance::onClickAdvancedLighting() void LLFloaterPerformance::onClickShadows() { - if (gSavedSettings.getBOOL("AutoFPS")) + if (!is_ALM_available() || !gSavedSettings.getBOOL("RenderDeferred")) { - LLFloaterPreference::showAutoAdjustWarning(); - } - else - { - if (!is_ALM_available() || !gSavedSettings.getBOOL("RenderDeferred")) - { - changeQualityLevel("ShadowsConfirm"); - } + changeQualityLevel("ShadowsConfirm"); } + } // EOF diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 77bf03852f..e9d5a8e02c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -305,7 +305,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.RememberedUsernames", boost::bind(&LLFloaterPreference::onClickRememberedUsernames, this)); mCommitCallbackRegistrar.add("Pref.SpellChecker", boost::bind(&LLFloaterPreference::onClickSpellChecker, this)); mCommitCallbackRegistrar.add("Pref.Advanced", boost::bind(&LLFloaterPreference::onClickAdvanced, this)); - mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -1800,23 +1799,6 @@ void LLFloaterPreference::updateSearchableItems() mSearchDataDirty = true; } -void LLFloaterPreference::showAutoAdjustWarning() -{ - static LLCachedControl use_auto_adjust(gSavedSettings,"AutoFPS"); - if (use_auto_adjust) - { - LLNotificationsUtil::add("AutoFPSConfirmDisable", LLSD(), LLSD(), - [](const LLSD¬if, const LLSD&resp) - { - S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); - if (opt == 0) - { - gSavedSettings.setBOOL("AutoFPS", FALSE); - } - }); - } -} - void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) { LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index de4e3cd886..94aac56506 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -109,8 +109,6 @@ public: void updateClickActionViews(); void updateSearchableItems(); - static void showAutoAdjustWarning(); - void onBtnOK(const LLSD& userdata); void onBtnCancel(const LLSD& userdata); diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index ba2fd6eef2..4cfc91f88e 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -49,8 +49,6 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors,this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity,this)); - mCommitCallbackRegistrar.add("Pref.AutoAdjustWarning", boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); - mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnCancel, this, _2)); mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreferenceGraphicsAdvanced::onBtnOK, this, _2)); @@ -81,9 +79,6 @@ BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateComplexityText, this)); - getChild("ShadowDetail")->setMouseDownCallback(boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); - getChild("Reflections")->setMouseDownCallback(boost::bind(&LLFloaterPreference::showAutoAdjustWarning)); - return TRUE; } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9cbd56ee7f..00c2fca7df 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2254,10 +2254,6 @@ bool idle_startup() if (STATE_CLEANUP == LLStartUp::getStartupState()) { - if (gAgent.isFirstLogin()) - { - gSavedSettings.setBOOL("AutoFPS", TRUE); - } set_startup_status(1.0, "", ""); display_startup(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index fa026c2888..a1773ae8d5 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1024,8 +1024,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gPipeline.clearReferences(); gPipeline.rebuildGroups(); - - gPipeline.autoAdjustSettings(); } LLAppViewer::instance()->pingMainloopTimeout("Display:FrameStats"); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 2a059e5db4..3110a1cbe5 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -409,8 +409,7 @@ LLPipeline::LLPipeline() : mLightMovingMask(0), mLightingDetail(0), mScreenWidth(0), - mScreenHeight(0), - mUpdateTimer(new LLTimer()) + mScreenHeight(0) { mNoiseMap = 0; mTrueNoiseMap = 0; @@ -615,12 +614,10 @@ void LLPipeline::init() connectRefreshCachedSettingsSafe("CameraDoFResScale"); connectRefreshCachedSettingsSafe("RenderAutoHideSurfaceAreaLimit"); gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); - gSavedSettings.getControl("AutoFPS")->getCommitSignal()->connect(boost::bind(&LLPipeline::onToggleAutoFPS)); } LLPipeline::~LLPipeline() { - delete mUpdateTimer; } void LLPipeline::cleanup() @@ -11522,141 +11519,3 @@ void LLPipeline::handleShadowDetailChanged() } } -const F32 MIN_DRAW_DISTANCE = 64; -const F32 MAX_DRAW_DISTANCE = 256; - -void update_far_clip(F32 fps_dif) -{ - F32 DIST_PER_FRAME_DIF = 16; - - F32 new_far_clip = llclamp(LLPipeline::RenderFarClip - llmin(fps_dif * DIST_PER_FRAME_DIF, (F32)128), MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE); - gSavedSettings.setF32("RenderFarClip", new_far_clip); -} - -void update_max_non_impostors(F32 fps_dif, S32 max_avatars) -{ - const F32 IMPOSTORS_PER_FRAME_DIF = 0.5; - - U32 new_non_imp = (U32)llclamp((S32)(LLVOAvatar::sMaxNonImpostors - llmin((S32)(fps_dif / IMPOSTORS_PER_FRAME_DIF), 10)), 1, max_avatars); - gSavedSettings.setU32("RenderAvatarMaxNonImpostors", new_non_imp); -} - -void LLPipeline::autoAdjustSettings() -{ - static LLCachedControl use_auto_adjustment(gSavedSettings,"AutoFPS"); - if (!use_auto_adjustment) - { - return; - } - - if (LLStartUp::getStartupState() < STATE_STARTED || LLApp::isExiting()) - { - return; - } - - static LLCachedControl adjustment_timeout(gSavedSettings, "AutoAdjustmentTimeout"); - static LLCachedControl initial_adjustment_timeout(gSavedSettings, "InitialAdjustmentTimeout"); - - static LLCachedControl fps_lower_boundary(gSavedSettings, "AutoFPSLowerBoundary"); - static LLCachedControl fps_upper_boundary(gSavedSettings, "AutoFPSUpperBoundary"); - - if (gViewerWindow && gViewerWindow->getWindow()->getVisible() - && gFocusMgr.getAppHasFocus() && !gTeleportDisplay) - { - static bool is_init = false; - if (!is_init) - { - //wait for FPS to stabilize after login in-world - mUpdateTimer->setTimerExpirySec((F32)initial_adjustment_timeout); - is_init = true; - } - if (mUpdateTimer->hasExpired()) - { - mUpdateTimer->setTimerExpirySec((F32)adjustment_timeout); - - const S32 FPS_STAT_PERIODS = 50; - S32 fps = (S32)llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, FPS_STAT_PERIODS)); - if (fps < fps_lower_boundary) - { - S32 fps_dif = fps_lower_boundary - fps; - - if (sWaterReflections && RenderReflectionDetail > WATER_REFLECT_NONE_WATER_OPAQUE) - { - S32 reflection_detail = llclamp(RenderReflectionDetail - 1, WATER_REFLECT_NONE_WATER_OPAQUE, WATER_REFLECT_MINIMAL); - gSavedSettings.setS32("RenderReflectionDetail", reflection_detail); - return; - } - - if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0 && RenderShadowSplits > 0) - { - S32 shadow_splits = llclamp(RenderShadowSplits - 1, 0, 3); - gSavedSettings.setS32("RenderShadowSplits", shadow_splits); - return; - } - - if (RenderFarClip > MIN_DRAW_DISTANCE) - { - update_far_clip(fps_dif); - } - - std::vector valid_nearby_avs; - LLWorld::getInstance()->getNearbyAvatarsAndCompl(valid_nearby_avs); - - if (valid_nearby_avs.size() > 1 && LLVOAvatar::sMaxNonImpostors > 1) - { - update_max_non_impostors(fps_dif, valid_nearby_avs.size()); - } - } - else if (fps > fps_upper_boundary) - { - S32 fps_dif = fps_upper_boundary - fps; - - std::vector valid_nearby_avs; - LLWorld::getInstance()->getNearbyAvatarsAndCompl(valid_nearby_avs); - if (valid_nearby_avs.size() > 1 && (LLVOAvatar::sMaxNonImpostors < valid_nearby_avs.size())) - { - update_max_non_impostors(fps_dif, valid_nearby_avs.size()); - return; - } - - if (RenderFarClip < MAX_DRAW_DISTANCE) - { - update_far_clip(fps_dif); - } - - if (LLPipeline::sRenderDeferred && RenderShadowDetail > 0 && RenderShadowSplits < 3) - { - S32 shadow_splits = llclamp(RenderShadowSplits + 1, 0, 3); - gSavedSettings.setS32("RenderShadowSplits", shadow_splits); - return; - } - - if (sWaterReflections && RenderReflectionDetail < WATER_REFLECT_MINIMAL) - { - S32 reflection_detail = llclamp(RenderReflectionDetail + 1, WATER_REFLECT_NONE_WATER_OPAQUE, WATER_REFLECT_MINIMAL); - gSavedSettings.setS32("RenderReflectionDetail", reflection_detail); - } - } - } - } - else - { - //wait for FPS to stabilize if the window was minimized or not focused before - mUpdateTimer->setTimerExpirySec((F32)initial_adjustment_timeout); - } -} - -void LLPipeline::setAdjustmentTimerExpiry(F32 expiration) -{ - mUpdateTimer->setTimerExpirySec(expiration); -} - -void LLPipeline::onToggleAutoFPS() -{ - if (!gSavedSettings.getBOOL("AutoFPS")) - { - //reset the number of shadow map splits rendered, when disabling auto-fps - //probably should be removed, if we'll have actual UI control for this setting - gSavedSettings.setS32("RenderShadowSplits", 3); - } -} diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index bdd498abff..584d32a767 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -418,8 +418,6 @@ public: static void updateRenderDeferred(); static void refreshCachedSettings(); - static void onToggleAutoFPS(); - void addDebugBlip(const LLVector3& position, const LLColor4& color); void hidePermanentObjects( std::vector& restoreList ); @@ -429,9 +427,6 @@ public: void restoreHiddenObject( const LLUUID& id ); void handleShadowDetailChanged(); - void autoAdjustSettings(); - void setAdjustmentTimerExpiry(F32 expiration); - private: void unloadShaders(); void addToQuickLookup( LLDrawPool* new_poolp ); @@ -724,8 +719,6 @@ protected: U64 mOldRenderDebugMask; std::stack mRenderDebugFeatureStack; - LLTimer* mUpdateTimer; - ///////////////////////////////////////////// // // diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 154c8b7909..9da6ec093b 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -40,8 +40,6 @@ name="DrawDistance" top_delta="16" width="330"> - - - - Automatic settings - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 93cb3ea9c8..5aff7a5127 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -30,28 +30,7 @@ width="120"> (None) - - - + Quality & speed: @@ -238,10 +217,7 @@ max_val="512" name="DrawDistance" top_delta="40" - width="330"> - - + width="330" /> - + Date: Tue, 27 Sep 2022 19:35:49 +0300 Subject: [PATCH 28/99] SL-18202 impostor too slow avatars and add autotune settings button to Preference --- indra/newview/llfloaterperformance.cpp | 5 +++++ indra/newview/llfloaterperformance.h | 1 + indra/newview/llfloaterpreference.cpp | 15 ++++++++++++++- indra/newview/llfloaterpreference.h | 1 + indra/newview/llviewerpartsim.cpp | 2 +- indra/newview/llvoavatar.cpp | 8 ++++---- indra/newview/pipeline.cpp | 8 ++++---- .../xui/en/panel_preferences_graphics1.xml | 14 +++++++++++++- 8 files changed, 43 insertions(+), 11 deletions(-) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index da1670c15e..e79e9d19b1 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -170,6 +170,11 @@ void LLFloaterPerformance::showSelectedPanel(LLPanel* selected_panel) } } +void LLFloaterPerformance::showAutoadjustmentsPanel() +{ + showSelectedPanel(mAutoadjustmentsPanel); +} + void LLFloaterPerformance::draw() { if (mUpdateTimer->hasExpired()) diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index a79da7460b..09bcd18bb5 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -44,6 +44,7 @@ public: void showSelectedPanel(LLPanel* selected_panel); void showMainPanel(); void hidePanels(); + void showAutoadjustmentsPanel(); void detachItem(const LLUUID& item_id); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index e9d5a8e02c..179f70a4a7 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -51,6 +51,7 @@ #include "llfloaterabout.h" #include "llfavoritesbar.h" #include "llfloaterpreferencesgraphicsadvanced.h" +#include "llfloaterperformance.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterimsession.h" #include "llkeyboard.h" @@ -287,6 +288,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this)); + mCommitCallbackRegistrar.add("Pref.AutoAdjustments", boost::bind(&LLFloaterPreference::onClickAutoAdjustments, this)); mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); @@ -726,13 +728,15 @@ void LLFloaterPreference::onOpen(const LLSD& key) LLButton* save_btn = findChild("PrefSaveButton"); LLButton* delete_btn = findChild("PrefDeleteButton"); LLButton* exceptions_btn = findChild("RenderExceptionsButton"); + LLButton* auto_adjustments_btn = findChild("AutoAdjustmentsButton"); - if (load_btn && save_btn && delete_btn && exceptions_btn) + if (load_btn && save_btn && delete_btn && exceptions_btn && auto_adjustments_btn) { load_btn->setEnabled(started); save_btn->setEnabled(started); delete_btn->setEnabled(started); exceptions_btn->setEnabled(started); + auto_adjustments_btn->setEnabled(started); } collectSearchableItems(); @@ -1655,6 +1659,15 @@ void LLFloaterPreference::onClickRenderExceptions() LLFloaterReg::showInstance("avatar_render_settings"); } +void LLFloaterPreference::onClickAutoAdjustments() +{ + LLFloaterPerformance* performance_floater = LLFloaterReg::showTypedInstance("performance"); + if (performance_floater) + { + performance_floater->showAutoadjustmentsPanel(); + } +} + void LLFloaterPreference::onClickAdvanced() { LLFloaterReg::showInstance("prefs_graphics_advanced"); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 94aac56506..1079b41000 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -185,6 +185,7 @@ public: void onClickAutoReplace(); void onClickSpellChecker(); void onClickRenderExceptions(); + void onClickAutoAdjustments(); void onClickAdvanced(); void applyUIColor(LLUICtrl* ctrl, const LLSD& param); void getUIColor(LLUICtrl* ctrl, const LLSD& param); diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index e5265f1dcd..a440f3232a 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -716,7 +716,7 @@ void LLViewerPartSim::updateSimulation() if (upd && vobj && (vobj->getPCode() == LL_PCODE_VOLUME)) { - if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex()) + if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex() && vobj->getAvatar()->isTooSlowWithShadows()) { upd = FALSE; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1a71780a88..976b69502f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3136,7 +3136,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_TARGET_POS_MASK ); // do not generate particles for dummy or overly-complex avatars - if (!mIsDummy && !isTooComplex()) + if (!mIsDummy && !isTooComplex() && !isTooSlowWithShadows()) { setParticleSource(particle_parameters, getID()); } @@ -3717,7 +3717,7 @@ bool LLVOAvatar::isVisuallyMuted() } else { - muted = isTooComplex(); + muted = isTooComplex() || isTooSlowWithShadows(); } } @@ -11174,7 +11174,7 @@ LLVOAvatar::AvatarOverallAppearance LLVOAvatar::getOverallAppearance() const { // Always want to see this AV as an impostor result = AOA_JELLYDOLL; } - else if (isTooComplex()) + else if (isTooComplex() || isTooSlowWithShadows()) { result = AOA_JELLYDOLL; } @@ -11201,7 +11201,7 @@ void LLVOAvatar::calcMutedAVColor() new_color = LLColor4::grey4; change_msg = " blocked: color is grey4"; } - else if (!isTooComplex()) + else if (!isTooComplex() && !isTooSlowWithShadows()) { new_color = LLColor4::white; change_msg = " simple imposter "; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3110a1cbe5..ba5e35fd3e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -132,7 +132,7 @@ // NOTE: Keep in sync with indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml // NOTE: Unused consts are commented out since some compilers (on macOS) may complain about unused variables. - const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; +// const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; const S32 WATER_REFLECT_NONE_WATER_TRANSPARENT = -1; const S32 WATER_REFLECT_MINIMAL = 0; // const S32 WATER_REFLECT_TERRAIN = 1; @@ -5993,7 +5993,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) LLDrawable* drawable = light->drawable; const LLViewerObject *vobj = light->drawable->getVObj(); if(vobj && vobj->getAvatar() - && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList()) + && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlowWithShadows()) ) { drawable->clearState(LLDrawable::NEARBY_LIGHT); @@ -6072,7 +6072,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) continue; } LLVOAvatar * av = light->getAvatar(); - if (av && (av->isTooComplex() || av->isInMuteList())) + if (av && (av->isTooComplex() || av->isInMuteList() || av->isTooSlowWithShadows())) { // avatars that are already in the list will be removed by removeMutedAVsLights continue; @@ -10850,7 +10850,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) << " is " << ( too_complex ? "" : "not ") << "too complex" << LL_ENDL; - bool too_slow = avatar->isTooSlowWithoutShadows(); // only if we really have to do we imposter. + bool too_slow = avatar->isTooSlowWithShadows(); pushRenderTypeMask(); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 5aff7a5127..ad02df3087 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -258,6 +258,18 @@ + + Date: Wed, 28 Sep 2022 14:16:16 +0300 Subject: [PATCH 29/99] SL-18248 Move frame breakdown stats to 'Scene loading statistics' floater --- doc/contributions.txt | 1 + indra/newview/llviewerstats.cpp | 91 +++++++++++++++++++ .../xui/en/floater_scene_load_stats.xml | 53 +++++++++++ 3 files changed, 145 insertions(+) diff --git a/doc/contributions.txt b/doc/contributions.txt index 2c1e5487ce..e059f3bb38 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -281,6 +281,7 @@ Beq Janus SL-11300 SL-15709 SL-16021 + SL-18202 Beth Walcher Bezilon Kasei Biancaluce Robbiani diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index a420de98f5..0045dcb547 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -58,6 +58,7 @@ #include "llfeaturemanager.h" #include "llviewernetwork.h" #include "llmeshrepository.h" //for LLMeshRepository::sBytesReceived +#include "llperfstats.h" #include "llsdserialize.h" #include "llsdutil.h" #include "llcorehttputil.h" @@ -208,6 +209,13 @@ LLTrace::EventStatHandle AVATAR_EDIT_TIME("avataredittime", "Second LLTrace::EventStatHandle > OBJECT_CACHE_HIT_RATE("object_cache_hits"); LLTrace::EventStatHandle TEXTURE_FETCH_TIME("texture_fetch_time"); + +LLTrace::SampleStatHandle > SCENERY_FRAME_PCT("scenery_frame_pct"); +LLTrace::SampleStatHandle > AVATAR_FRAME_PCT("avatar_frame_pct"); +LLTrace::SampleStatHandle > HUDS_FRAME_PCT("huds_frame_pct"); +LLTrace::SampleStatHandle > UI_FRAME_PCT("ui_frame_pct"); +LLTrace::SampleStatHandle > SWAP_FRAME_PCT("swap_frame_pct"); +LLTrace::SampleStatHandle > IDLE_FRAME_PCT("idle_frame_pct"); } LLViewerStats::LLViewerStats() @@ -414,6 +422,89 @@ void update_statistics() texture_stats_timer.reset(); } } + + if (LLFloaterReg::instanceVisible("scene_load_stats")) + { + static const F32 perf_stats_freq = 1; + static LLFrameTimer perf_stats_timer; + if (perf_stats_timer.getElapsedTimeF32() >= perf_stats_freq) + { + LLStringUtil::format_map_t args; + LLPerfStats::bufferToggleLock.lock(); // prevent toggle for a moment + + auto tot_frame_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FRAME); + // cumulative avatar time (includes idle processing, attachments and base av) + auto tot_avatar_time_raw = LLPerfStats::StatsRecorder::getSum(LLPerfStats::ObjType_t::OT_AVATAR, LLPerfStats::StatType_t::RENDER_COMBINED); + // cumulative avatar render specific time (a bit arbitrary as the processing is too.) + // auto tot_av_idle_time_raw = LLPerfStats::StatsRecorder::getSum(AvType, LLPerfStats::StatType_t::RENDER_IDLE); + // auto tot_avatar_render_time_raw = tot_avatar_time_raw - tot_av_idle_time_raw; + // the time spent this frame on the "display()" call. Treated as "tot time rendering" + auto tot_render_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_DISPLAY); + // sleep time is basically forced sleep when window out of focus + auto tot_sleep_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SLEEP); + // time spent on UI + auto tot_ui_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_UI); + // cumulative time spent rendering HUDS + auto tot_huds_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_HUDS); + // "idle" time. This is the time spent in the idle poll section of the main loop + auto tot_idle_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_IDLE); + // similar to sleep time, induced by FPS limit + //auto tot_limit_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FPSLIMIT); + // swap time is time spent in swap buffer + auto tot_swap_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SWAP); + + LLPerfStats::bufferToggleLock.unlock(); + + auto tot_frame_time_ns = LLPerfStats::raw_to_ns(tot_frame_time_raw); + auto tot_avatar_time_ns = LLPerfStats::raw_to_ns(tot_avatar_time_raw); + auto tot_huds_time_ns = LLPerfStats::raw_to_ns(tot_huds_time_raw); + // UI time includes HUD time so dedut that before we calc percentages + auto tot_ui_time_ns = LLPerfStats::raw_to_ns(tot_ui_time_raw - tot_huds_time_raw); + + // auto tot_sleep_time_ns = LLPerfStats::raw_to_ns( tot_sleep_time_raw ); + // auto tot_limit_time_ns = LLPerfStats::raw_to_ns( tot_limit_time_raw ); + + // auto tot_render_time_ns = LLPerfStats::raw_to_ns( tot_render_time_raw ); + auto tot_idle_time_ns = LLPerfStats::raw_to_ns(tot_idle_time_raw); + auto tot_swap_time_ns = LLPerfStats::raw_to_ns(tot_swap_time_raw); + auto tot_scene_time_ns = LLPerfStats::raw_to_ns(tot_render_time_raw - tot_avatar_time_raw - tot_swap_time_raw - tot_ui_time_raw); + // auto tot_overhead_time_ns = LLPerfStats::raw_to_ns( tot_frame_time_raw - tot_render_time_raw - tot_idle_time_raw ); + + // // remove time spent sleeping for fps limit or out of focus. + // tot_frame_time_ns -= tot_limit_time_ns; + // tot_frame_time_ns -= tot_sleep_time_ns; + + if (tot_frame_time_ns != 0) + { + auto pct_avatar_time = (tot_avatar_time_ns * 100) / tot_frame_time_ns; + auto pct_huds_time = (tot_huds_time_ns * 100) / tot_frame_time_ns; + auto pct_ui_time = (tot_ui_time_ns * 100) / tot_frame_time_ns; + auto pct_idle_time = (tot_idle_time_ns * 100) / tot_frame_time_ns; + auto pct_swap_time = (tot_swap_time_ns * 100) / tot_frame_time_ns; + auto pct_scene_render_time = (tot_scene_time_ns * 100) / tot_frame_time_ns; + pct_avatar_time = llclamp(pct_avatar_time, 0., 100.); + pct_huds_time = llclamp(pct_huds_time, 0., 100.); + pct_ui_time = llclamp(pct_ui_time, 0., 100.); + pct_idle_time = llclamp(pct_idle_time, 0., 100.); + pct_swap_time = llclamp(pct_swap_time, 0., 100.); + pct_scene_render_time = llclamp(pct_scene_render_time, 0., 100.); + if (tot_sleep_time_raw == 0) + { + sample(LLStatViewer::SCENERY_FRAME_PCT, (U32)llround(pct_scene_render_time)); + sample(LLStatViewer::AVATAR_FRAME_PCT, (U32)llround(pct_avatar_time)); + sample(LLStatViewer::HUDS_FRAME_PCT, (U32)llround(pct_huds_time)); + sample(LLStatViewer::UI_FRAME_PCT, (U32)llround(pct_ui_time)); + sample(LLStatViewer::SWAP_FRAME_PCT, (U32)llround(pct_swap_time)); + sample(LLStatViewer::IDLE_FRAME_PCT, (U32)llround(pct_idle_time)); + } + } + else + { + LL_WARNS("performance") << "Scene time 0. Skipping til we have data." << LL_ENDL; + } + perf_stats_timer.reset(); + } + } } void update_texture_time() diff --git a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml index 2abd8ec5c0..37efbe654e 100644 --- a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml @@ -410,6 +410,59 @@ + + + + + + + + From 0bbe44c4b9df591ecfc451652b79cacb9087276d Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Mon, 3 Oct 2022 15:52:50 +0300 Subject: [PATCH 30/99] SL-17541 simple fallback when refresh rate is unknown --- indra/llwindow/llwindowmacosx.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 66f7e60371..74878df781 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -49,6 +49,8 @@ BOOL gHiDPISupport = TRUE; const S32 BITS_PER_PIXEL = 32; const S32 MAX_NUM_RESOLUTIONS = 32; +const S32 DEFAULT_REFRESH_RATE = 60; + namespace { NSKeyEventRef mRawKeyEvent = NULL; @@ -661,6 +663,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits } mRefreshRate = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(mDisplay)); + if(mRefreshRate == 0) + { + //consider adding more appropriate fallback later + mRefreshRate = DEFAULT_REFRESH_RATE; + } // Disable vertical sync for swap toggleVSync(enable_vsync); From 0bd3560b3e057f7ca74f4d586a02a29235d46489 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 3 Oct 2022 20:49:08 +0300 Subject: [PATCH 31/99] SL-18273 add VSync checkbox to Preferred frame rate pane --- .../en/panel_performance_autoadjustments.xml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml index 10ac4b98b7..4c2061bc60 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml @@ -149,6 +149,49 @@ name="av_and_scene" value="1" /> + + + Synchronize the refresh rate and frame rate of a monitor, + + + which can result in smoother performance. + + Date: Mon, 3 Oct 2022 20:56:15 +0300 Subject: [PATCH 32/99] SL-18271 update tooltip text for Continuous checkbox --- .../skins/default/xui/en/panel_performance_autoadjustments.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml index 4c2061bc60..5d4ffd232b 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml @@ -115,7 +115,7 @@ left_pad="10" name="AutoTuneContinuous" top_delta="0" - tool_tip="The viewer will continually adapt the settings to meet the target FPS until stopped even with the floater closed. When disabled clicking the Auto Tune button will adjust for the current settings then stop." + tool_tip="The viewer will continually adapt the settings to meet the target FPS until stopped even with the floater closed. When disabled clicking the Start button will adjust for the current settings then stop." width="64"> Date: Tue, 4 Oct 2022 13:17:04 +0300 Subject: [PATCH 33/99] SL-18296 FIXED 'Start' button is till toggled when desired FPS is reached --- indra/newview/llfloaterperformance.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index e79e9d19b1..644e52c022 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -194,6 +194,12 @@ void LLFloaterPerformance::draw() populateObjectList(); } + auto button = getChild("AutoTuneFPS"); + if((bool)button->getToggleState() != LLPerfStats::tunables.userAutoTuneEnabled) + { + button->toggleState(); + } + mUpdateTimer->setTimerExpirySec(REFRESH_INTERVAL); } LLFloater::draw(); From 386334f32c92be34c1c574c9d30346e559300353 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 21 Oct 2022 18:31:31 +0300 Subject: [PATCH 34/99] Post-merge fix --- indra/newview/llviewercontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 161c8ce0da..2140c70a20 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -781,7 +781,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderDebugPipeline", handleRenderDebugPipelineChanged); setting_setup_signal_listener(gSavedSettings, "RenderResolutionDivisor", handleRenderResolutionDivisorChanged); setting_setup_signal_listener(gSavedSettings, "RenderDeferred", handleRenderDeferredChanged); - setting_setup_signal_listener(gSavedSettings, "RenderShadowDetail", handleSetShaderChanged); + setting_setup_signal_listener(gSavedSettings, "RenderShadowDetail", handleShadowDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderDeferredSSAO", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderPerformanceTest", handleRenderPerfTestChanged); setting_setup_signal_listener(gSavedSettings, "TextureMemory", handleVideoMemoryChanged); From f5b447bc4781d518fbe7841eea6cadd909b57a0a Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 31 Oct 2022 16:46:28 +0200 Subject: [PATCH 35/99] SL-18495 Enable autofps for new users by default --- indra/newview/app_settings/settings.xml | 4 ++-- indra/newview/llstartup.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 657119ae53..292eef64b9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16742,14 +16742,14 @@ Type U32 Value - 25 + 30 AutoTuneFPS Comment Allow the viewer to adjust your settings to achieve target FPS Persist - 0 + 1 Type Boolean Value diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e66fefdd1a..87fba5ec1b 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2254,6 +2254,10 @@ bool idle_startup() if (STATE_CLEANUP == LLStartUp::getStartupState()) { + if (gAgent.isFirstLogin()) + { + gSavedSettings.setBOOL("AutoTuneFPS", TRUE); + } set_startup_status(1.0, "", ""); display_startup(); From af675bbe6311f712738976dc35d89061bff35962 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 8 Nov 2022 12:45:25 +0200 Subject: [PATCH 36/99] SL-18584 FIXED viewer starts in minimized mode after a clean install --- indra/newview/llappviewer.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index aef78e08e6..6ef92c98ef 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3024,15 +3024,9 @@ void LLAppViewer::initStrings() } } -// -// This function decides whether the client machine meets the minimum requirements to -// run in a maximized window, per the consensus of davep, boa and nyx on 3/30/2011. -// bool LLAppViewer::meetsRequirementsForMaximizedStart() { - bool maximizedOk = (LLFeatureManager::getInstance()->getGPUClass() >= GPU_CLASS_2); - - maximizedOk &= (gSysMemory.getPhysicalMemoryKB() >= U32Gigabytes(1)); + bool maximizedOk = (gSysMemory.getPhysicalMemoryKB() >= U32Gigabytes(1)); return maximizedOk; } From e697c774b58f59602680d10f418c3b33481c86bb Mon Sep 17 00:00:00 2001 From: Beq Date: Tue, 8 Nov 2022 16:40:37 +0000 Subject: [PATCH 37/99] Remove FS specific settings in favour of LL versions --- indra/newview/app_settings/settings.xml | 143 ------------------------ 1 file changed, 143 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a89212f3b3..c301b25539 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -26173,28 +26173,6 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 - FSTargetFPS - - Comment - Desired minimum FPS - Persist - 1 - Type - U32 - Value - 25 - - FSAutoTuneFPS - - Comment - Allow the viewer to adjust your settings to achieve target FPS - Persist - 0 - Type - Boolean - Value - 0 - FSPerfFloaterSmoothingPeriods Comment @@ -26239,127 +26217,6 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 - FSPerfStatsCaptureEnabled - - Comment - Enable/disable render time data to support autotune. - Persist - 1 - Type - Boolean - Value - 1 - - FSAutoTuneImpostorByDistEnabled - - Comment - Enable/disable using MaxNonImpostor to limit avatar rendering by distance. - Persist - 1 - Type - Boolean - Value - 0 - - FSAutoTuneLock - - Comment - When enabled the viewer will dynamically change settings until auto tune is explicitly turned off. - Persist - 1 - Type - Boolean - Value - 1 - - FSAllowSelfImpostor - - Comment - Allow own render time to impostor your avatar. - Persist - 1 - Type - Boolean - Value - 0 - - FSShowTunedART - - Comment - Show the tuned render time in the avatar display. - Persist - 1 - Type - Boolean - Value - 0 - - FSRenderAvatarMaxART - - Comment - Render Time Limit in microseconds (0.0 = no limit) - Persist - 0 - Type - F32 - Value - 4.699 - - FSAutoTuneRenderFarClipMin - - Comment - The lowest draw distance that auto tune is allowed to use - Persist - 0 - Type - F32 - Value - 32.0 - - FSAutoTuneRenderFarClipTarget - - Comment - The draw distance that auto tune will try to achieve - Persist - 0 - Type - F32 - Value - 256.0 - - FSAutoTuneImpostorFarAwayDistance - - Comment - Avatars beyond this range will automatically be optimized - Persist - 0 - Type - F32 - Value - 64.0 - - FSTuningFPSStrategy - - Comment - Strategy to use when tuning FPS. 0=Tune avatar rendering only, 1=Tune both avatar and global scene settings. - Persist - 1 - Type - U32 - Value - 0 - - FSUserTargetReflections - - Comment - Set by auto tune floater on build - Persist - 0 - Type - S32 - Value - 4 - FSReportRegionRestartToChat Comment From 3d42d2ebeaf71dd46dacf01dd526b3850682a23c Mon Sep 17 00:00:00 2001 From: Beq Date: Tue, 8 Nov 2022 16:42:59 +0000 Subject: [PATCH 38/99] fspefstats switcharoo with LL version but keep fs perf floater. --- indra/newview/CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c07e233661..c51e1130a2 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -409,8 +409,8 @@ set(viewer_SOURCE_FILES llfloaterpathfindinglinksets.cpp llfloaterpathfindingobjects.cpp llfloaterpay.cpp - # llfloaterperformance.cpp replaced with fs version due to large changes and likelihood that LL version will not release. - fsfloaterperformance.cpp + # llfloaterperformance.cpp + fsfloaterperformance.cpp # restore fs perf floater llfloaterperms.cpp llfloaterpostprocess.cpp llfloaterprofile.cpp @@ -1698,10 +1698,6 @@ configure_file( list(APPEND viewer_HEADER_FILES ${CMAKE_CURRENT_BINARY_DIR}/fsversionvalues.h) # - # Performance stast support - list(APPEND viewer_SOURCE_FILES fsperfstats.cpp) - list(APPEND viewer_HEADER_FILES fsperfstats.h) - # source_group("CMake Rules" FILES ViewerInstall.cmake) #build_data.json creation moved to viewer_manifest.py MAINT-6413 From 8e281d8d037d6efbe7df3aeab9ae05c78398ecca Mon Sep 17 00:00:00 2001 From: Beq Date: Tue, 8 Nov 2022 16:44:44 +0000 Subject: [PATCH 39/99] rename the fs peformance panels to distinguish from ll ones --- .../default/xui/en/floater_performance_fs.xml | 606 ++++++++++++++++++ .../xui/en/panel_performance_autotune_fs.xml | 229 +++++++ .../en/panel_performance_complexity_fs.xml | 116 ++++ .../xui/en/panel_performance_huds_fs.xml | 100 +++ .../xui/en/panel_performance_nearby_fs.xml | 294 +++++++++ .../en/panel_performance_preferences_fs.xml | 516 +++++++++++++++ 6 files changed, 1861 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/floater_performance_fs.xml create mode 100644 indra/newview/skins/default/xui/en/panel_performance_autotune_fs.xml create mode 100644 indra/newview/skins/default/xui/en/panel_performance_complexity_fs.xml create mode 100644 indra/newview/skins/default/xui/en/panel_performance_huds_fs.xml create mode 100644 indra/newview/skins/default/xui/en/panel_performance_nearby_fs.xml create mode 100644 indra/newview/skins/default/xui/en/panel_performance_preferences_fs.xml diff --git a/indra/newview/skins/default/xui/en/floater_performance_fs.xml b/indra/newview/skins/default/xui/en/floater_performance_fs.xml new file mode 100644 index 0000000000..5e814ba099 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_performance_fs.xml @@ -0,0 +1,606 @@ + + + + Frame: [TOT_FRAME_TIME]ms - Scenery:[SCENERY_FRAME_PCT]% Avatars:[AV_FRAME_PCT]% UI:[UI_FRAME_PCT]% HUDs:[HUDS_FRAME_PCT]% Swap:[SWAP_FRAME_PCT]% Tasks:[IDLE_FRAME_PCT]% + + + User Limited @ [FPSCAP] FPS + + + Target [FPSTARGET] FPS + + + [AV_FRAME_PCT]% + + + [HUDS_FRAME_PCT]% + + + In Background + + + Allow 5-10 seconds for changes to take effect. + + + Stats pause when FPS is limited or in background. + + + Total: [TOT_AV] ([TOT_AV_TIME]μs) + + + Total: [TOT_ATT] ([TOT_ATT_TIME]μs) + + + + + + + 167 + + + frames per second + + User Limited @ 000 FPS + + + Stats pause when FPS is limited or in background. + + +[--------------------Frame breakdown will appear here.---------------------] + + + + + Auto Tune: + + + Target Frame Rate (fps) + + + + + + + + + + + Tuning Strategy + + + + + + + + + + + + Graphics settings + + + Choose settings for distance, water, lighting and more. + + + + + + Avatars nearby + + + Manage which nearby avatars are fully displayed. + + +Time spent +drawing +avatars + + + 00% + + + + + + Your avatar complexity + + + Be a good citizen. Manage the impact of your avatar + + + + + + Your active HUDs + + + Removing unnecessary HUDs may improve speed. + + +Time spent +drawing +HUDs + + + 00% + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_performance_autotune_fs.xml b/indra/newview/skins/default/xui/en/panel_performance_autotune_fs.xml new file mode 100644 index 0000000000..1e7a9be84c --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_performance_autotune_fs.xml @@ -0,0 +1,229 @@ + + + + + Back + + +Auto Tune Preferences + + + +Distant Avatars + + + + + +Distant avatars can be automatically optimized regardless of their render cost. +Set the distance from camera beyond which an avatar will be optimized. +Note: This setting will force MaxNonImpostors to 1 if nobody is nearby. + + + +Visibility distance tuning limits + + + + + + +When adjusting scene parameters, autotune will choose values between the minimum and the preferred draw distances. + + + +Sundry Settings + + + + +These options control more subtle settings. Use the online help page to get more information on what these do. + + diff --git a/indra/newview/skins/default/xui/en/panel_performance_complexity_fs.xml b/indra/newview/skins/default/xui/en/panel_performance_complexity_fs.xml new file mode 100644 index 0000000000..7518328a35 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_performance_complexity_fs.xml @@ -0,0 +1,116 @@ + + + + + Back + + + Avatar attachment complexity + + + Total: 50 (120000.10μs) + + + Attachments make your avatar more complex and slower to render. + + +This screen allows you to view the attachments of your own avatar. + + +You may remove your own attachments quickly and easily by hitting the 'X'. + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_performance_huds_fs.xml b/indra/newview/skins/default/xui/en/panel_performance_huds_fs.xml new file mode 100644 index 0000000000..c6a5c025ae --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_performance_huds_fs.xml @@ -0,0 +1,100 @@ + + + + + Back + + + Your active HUDs + + + Detaching HUDs you aren't using saves memory and can make the viewer run faster. + + + HUDs are often heavily scripted and also contribute to server-side lag. + + + Note: Using a HUD's minimize button does not detach it. Use the X to remove it. + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_performance_nearby_fs.xml b/indra/newview/skins/default/xui/en/panel_performance_nearby_fs.xml new file mode 100644 index 0000000000..18dc8ca0a8 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_performance_nearby_fs.xml @@ -0,0 +1,294 @@ + + + + + Back + + + Avatars nearby + + Total: 50 (120000.10μs) + + + Hide the most complex avatars to boost speed. + + + + + 0 + + + + + no limit + + + + + + + + + + + + You can also right-click on an avatar in-world to control display. + + + Note: Your own avatar includes viewer overheads. Use the attachment tab to see how you affect others. + + + + + + + + + Name tags: + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_performance_preferences_fs.xml b/indra/newview/skins/default/xui/en/panel_performance_preferences_fs.xml new file mode 100644 index 0000000000..1fd23144c0 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_performance_preferences_fs.xml @@ -0,0 +1,516 @@ + + + + + Back + + + Graphics settings + + + + Quality vs speed + + +Faster + + + + + + + + + + Better Quality + + + + + Low + + + Mid + + + High + + + Ultra + + + Choosing a preset will reset all manual changes you have made. + + + + Visibility distance + + + Faster + + + + m + + + Farther + + + Keep this low for better performance, increase it to see further afield. + + + + Environment + + +Reducing / eliminating shadows can be a boost to FPS but impacts +the ambience and appearance of the scene. + + + Shadow sources: + + + + + + + + + Water + + + Reducing water effects quality can greatly improve frame rate. + + + Water Reflections: + + + + + + + + + + + + + Photography + + +Photographers need high quality, but this is often +at the cost of frame rate. [APP_NAME] phototools can +help you find the right balance. + + + From 6baaea9fc8c6fa619ef9fbf23632bbf2490f3815 Mon Sep 17 00:00:00 2001 From: Beq Date: Tue, 8 Nov 2022 17:55:30 +0000 Subject: [PATCH 40/99] improve behaviour around shadow derendering --- indra/newview/llvoavatar.cpp | 175 ++++++++++++++--------------------- indra/newview/llvoavatar.h | 16 +--- indra/newview/pipeline.cpp | 2 +- 3 files changed, 75 insertions(+), 118 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4118da159a..f725600165 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -137,7 +137,6 @@ #include "fslslbridge.h" // Movelock position refresh #include "fsdiscordconnect.h" // tapping a place that happens on landing in world to start up discord -#include "fsperfstats.h" // performance stats support extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; @@ -4308,7 +4307,7 @@ bool LLVOAvatar::isVisuallyMuted() // else { - muted = isTooComplex() || isTooSlowWithShadows(); + muted = isTooComplex(); // this should not trigger based on perfstats } } @@ -9197,95 +9196,6 @@ BOOL LLVOAvatar::isFullyLoaded() const // return (mRenderUnloadedAvatar || mFullyLoaded); } -// use Avatar Render Time as complexity metric -// markARTStale - Mark stale and set the frameupdate to now so that we can wait at least one frame to get a revised number. -void LLVOAvatar::markARTStale() -{ - mARTStale=true; - mLastARTUpdateFrame = LLFrameTimer::getFrameCount(); -} - -// Udpate Avatar state based on render time -void LLVOAvatar::updateTooSlow() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - static LLCachedControl alwaysRenderFriends(gSavedSettings, "AlwaysRenderFriends"); - static LLCachedControl allowSelfImpostor(gSavedSettings, "FSAllowSelfImpostor"); - const auto id = getID(); - - // mTooSlow - Is the avatar flagged as being slow (includes shadow time) - // mTooSlowWithoutShadows - Is the avatar flagged as being slow even with shadows removed. - // mARTStale - the rendertime we have is stale because of an update. We need to force a re-render to re-assess slowness - - if( mARTStale ) - { - if ( LLFrameTimer::getFrameCount() - mLastARTUpdateFrame < 5 ) - { - // LL_INFOS() << this->getFullname() << " marked stale " << LL_ENDL; - // we've not had a chance to update yet (allow a few to be certain a full frame has passed) - return; - } - - mARTStale = false; - mTooSlow = false; - mTooSlowWithoutShadows = false; - // LL_INFOS() << this->getFullname() << " refreshed ART combined = " << mRenderTime << " @ " << mLastARTUpdateFrame << LL_ENDL; - } - - // Either we're not stale or we've updated. - - U64 render_time_raw; - U64 render_geom_time_raw; - - if( !mTooSlow ) - { - // we are fully rendered, so we use the live values - std::lock_guard lock{FSPerfStats::bufferToggleLock}; - render_time_raw = FSPerfStats::StatsRecorder::get(FSPerfStats::ObjType_t::OT_AVATAR, id, FSPerfStats::StatType_t::RENDER_COMBINED); - render_geom_time_raw = FSPerfStats::StatsRecorder::get(FSPerfStats::ObjType_t::OT_AVATAR, id, FSPerfStats::StatType_t::RENDER_GEOMETRY); - } - else - { - // use the cached values. - render_time_raw = mRenderTime; - render_geom_time_raw = mGeomTime; - } - if( (FSPerfStats::renderAvatarMaxART_ns > 0) && - (FSPerfStats::raw_to_ns(render_time_raw) >= FSPerfStats::renderAvatarMaxART_ns) ) - { - if( !mTooSlow ) // if we were previously not slow (with or without shadows.) - { - // if we weren't capped, we are now - mLastARTUpdateFrame = LLFrameTimer::getFrameCount(); - mRenderTime = render_time_raw; - mGeomTime = render_geom_time_raw; - mARTStale = false; - mTooSlow = true; - } - if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap - { - bool render_friend_or_exception = ( alwaysRenderFriends && LLAvatarTracker::instance().isBuddy( id ) ) || - ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER ); - if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception ) - { - // Note: slow rendering Friends still get their shadows zapped. - mTooSlowWithoutShadows = (FSPerfStats::raw_to_ns(render_geom_time_raw) >= FSPerfStats::renderAvatarMaxART_ns); - } - } - } - else - { - // LL_INFOS() << this->getFullname() << " ("<< (combined?"combined":"geometry") << ") good render time = " << FSPerfStats::raw_to_ns(render_time_raw) << " vs ("<< LLVOAvatar::sRenderTimeCap_ns << " set @ " << mLastARTUpdateFrame << LL_ENDL; - mTooSlow = false; - mTooSlowWithoutShadows = false; - } - if(mTooSlow) - { - FSPerfStats::tunedAvatars++; // increment the number of avatars that have been tweaked. - } -} -// - bool LLVOAvatar::isTooComplex() const { bool too_complex; @@ -9314,6 +9224,23 @@ bool LLVOAvatar::isTooComplex() const } // use Avatar Render Time as complexity metric +// refactor for clarity post LL merge +void LLVOAvatar::clearSlowARTCache() +{ + mARTStale = false; + mTooSlow = false; + mTooSlowWithoutShadows = false; +} + +void LLVOAvatar::setSlowARTCache(U64 full_render_time, U64 non_shadow_render_time) +{ + mLastARTUpdateFrame = LLFrameTimer::getFrameCount(); + mRenderTime = full_render_time; + mRenderTimeNoShadows = non_shadow_render_time; + mARTStale = false; + mTooSlow = true; +} +// // markARTStale - Mark stale and set the frameupdate to now so that we can wait at least one frame to get a revised number. void LLVOAvatar::markARTStale() { @@ -9328,6 +9255,7 @@ void LLVOAvatar::updateTooSlow() static LLCachedControl alwaysRenderFriends(gSavedSettings, "AlwaysRenderFriends"); static LLCachedControl allowSelfImpostor(gSavedSettings, "AllowSelfImpostor"); const auto id = getID(); + bool changed_slow_state{false}; // Post LL merge, force dirty when slowness state changes // mTooSlow - Is the avatar flagged as being slow (includes shadow time) // mTooSlowWithoutShadows - Is the avatar flagged as being slow even with shadows removed. @@ -9341,42 +9269,53 @@ void LLVOAvatar::updateTooSlow() // we've not had a chance to update yet (allow a few to be certain a full frame has passed) return; } - - mARTStale = false; - mTooSlow = false; - mTooSlowWithoutShadows = false; + // refactor and work out why shadow derendering is no longer working + // mARTStale = false; + // mTooSlow = false; + // mTooSlowWithoutShadows = false; // LL_INFOS() << this->getFullname() << " refreshed ART combined = " << mRenderTime << " @ " << mLastARTUpdateFrame << LL_ENDL; + clearSlowARTCache(); + changed_slow_state = true; + // } // Either we're not stale or we've updated. U64 render_time_raw; - U64 render_geom_time_raw; + U64 render_time_no_shadows_raw; // rename as we now include idle time if( !mTooSlow ) { // we are fully rendered, so we use the live values std::lock_guard lock{LLPerfStats::bufferToggleLock}; render_time_raw = LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_COMBINED); - render_geom_time_raw = LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_GEOMETRY); + // include idle time in total render time + // render_geom_time_raw = LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_GEOMETRY); + render_time_no_shadows_raw = render_time_raw - LLPerfStats::StatsRecorder::get(LLPerfStats::ObjType_t::OT_AVATAR, id, LLPerfStats::StatType_t::RENDER_SHADOWS); + // } else { // use the cached values. render_time_raw = mRenderTime; - render_geom_time_raw = mGeomTime; + render_time_no_shadows_raw = mRenderTimeNoShadows; // variable name updated to refelect different meaning. } + if( (LLPerfStats::renderAvatarMaxART_ns > 0) && (LLPerfStats::raw_to_ns(render_time_raw) >= LLPerfStats::renderAvatarMaxART_ns) ) { if( !mTooSlow ) // if we were previously not slow (with or without shadows.) { // if we weren't capped, we are now - mLastARTUpdateFrame = LLFrameTimer::getFrameCount(); - mRenderTime = render_time_raw; - mGeomTime = render_geom_time_raw; - mARTStale = false; - mTooSlow = true; + // refactored "geom" becomes "no shadow" + // mLastARTUpdateFrame = LLFrameTimer::getFrameCount(); + // mRenderTime = render_time_raw; + // mGeomTime = render_geom_time_raw; + // mARTStale = false; + // mTooSlow = true; + setSlowARTCache(render_time_raw, render_time_no_shadows_raw); + changed_slow_state = true; + // } if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap { @@ -9385,13 +9324,28 @@ void LLVOAvatar::updateTooSlow() if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception ) { // Note: slow rendering Friends still get their shadows zapped. - mTooSlowWithoutShadows = (LLPerfStats::raw_to_ns(render_geom_time_raw) >= LLPerfStats::renderAvatarMaxART_ns); + // changes to support idel and geom in non shadow rendering cost + improved dirty marking + // mTooSlowWithoutShadows = (LLPerfStats::raw_to_ns(render_geom_time_raw) >= LLPerfStats::renderAvatarMaxART_ns); + mTooSlowWithoutShadows = (LLPerfStats::raw_to_ns(render_time_no_shadows_raw) >= LLPerfStats::renderAvatarMaxART_ns); } + if(mTooSlowWithoutShadows) + { + changed_slow_state = true; + // + } + } } else { + // better state change flagging // LL_INFOS() << this->getFullname() << " ("<< (combined?"combined":"geometry") << ") good render time = " << LLPerfStats::raw_to_ns(render_time_raw) << " vs ("<< LLVOAvatar::sRenderTimeCap_ns << " set @ " << mLastARTUpdateFrame << LL_ENDL; + // LL_INFOS() << this->getFullname() << " good render time = " << render_time_ns << " vs ("<< LLPerfStats::renderAvatarMaxART_ns << " set @ " << mLastARTUpdateFrame << ")" << LL_ENDL; + if( mTooSlow || mTooSlowWithoutShadows ) + { + changed_slow_state = true; + } + // mTooSlow = false; mTooSlowWithoutShadows = false; } @@ -9399,6 +9353,12 @@ void LLVOAvatar::updateTooSlow() { LLPerfStats::tunedAvatars++; // increment the number of avatars that have been tweaked. } + // better state change flagging + if( changed_slow_state ) + { + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_GEOMETRY, true); + } + // } //----------------------------------------------------------------------------- @@ -12472,7 +12432,7 @@ LLVOAvatar::AvatarOverallAppearance LLVOAvatar::getOverallAppearance() const { // Always want to see this AV as an impostor result = AOA_JELLYDOLL; } - else if (isTooComplex() || isTooSlowWithShadows()) + else if (isTooComplex() || isTooSlowWithoutShadows()) // correct for misplaced check { result = AOA_JELLYDOLL; } @@ -12507,7 +12467,10 @@ void LLVOAvatar::calcMutedAVColor() new_color = LLColor4::grey4; change_msg = " blocked: color is grey4"; } - else if (!isTooComplex() && !isTooSlowWithShadows()) + // we don't want jelly dolls + // else if (!isTooComplex() && !isTooSlowWithShadows()) + else if (!isTooComplex()) + // { new_color = LLColor4::white; change_msg = " simple imposter "; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 03a0f063e7..78c4549651 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -351,7 +351,6 @@ public: static F32 sLODFactor; // user-settable LOD factor static F32 sPhysicsLODFactor; // user-settable physics LOD factor static BOOL sJointDebug; // output total number of joints being touched for each avatar - static U64 sRenderTimeLimit_ns; // nanosecond time limit for avatar rendering 0 is unlimited. static LLPartSysData sCloud; static LLPointer sCloudTexture; @@ -401,6 +400,10 @@ public: void calcMutedAVColor(); void markARTStale(); + // refactoring post LL merge + void clearSlowARTCache(); + void setSlowARTCache(U64 full_render_time, U64 geometry_render_time); + // protected: LLViewerStats::PhaseMap& getPhases() { return mPhases; } @@ -421,19 +424,10 @@ private: LLColor4 mMutedAVColor; LLFrameTimer mFullyLoadedTimer; LLFrameTimer mRuthTimer; - U32 mLastARTUpdateFrame{0}; - U64 mRenderTime{0}; - U64 mGeomTime{0}; - bool mARTStale{true}; - bool mARTCapped{false}; - // variables to hold "slowness" status - bool mTooSlow{false}; - bool mTooSlowWithoutShadows{false}; - // U32 mLastARTUpdateFrame{0}; U64 mRenderTime{0}; - U64 mGeomTime{0}; + U64 mRenderTimeNoShadows{0}; bool mARTStale{true}; bool mARTCapped{false}; // variables to hold "slowness" status diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index df51800dae..731475a32a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -11212,7 +11212,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) << " is " << ( too_complex ? "" : "not ") << "too complex" << LL_ENDL; - bool too_slow = avatar->isTooSlowWithShadows(); + bool too_slow = avatar->isTooSlowWithoutShadows();// only if we really have to do we imposter. pushRenderTypeMask(); From ad7aa540895d39ab093fef6995a01c97f292db42 Mon Sep 17 00:00:00 2001 From: Beq Date: Tue, 8 Nov 2022 18:52:37 +0000 Subject: [PATCH 41/99] performance floater updated to align upstream merge of contribution --- indra/newview/fsfloaterperformance.cpp | 248 +++++++++++++++---------- indra/newview/llappviewer.cpp | 71 ++++--- indra/newview/lldrawpoolavatar.cpp | 1 - indra/newview/lldrawpoolbump.cpp | 2 - indra/newview/llface.cpp | 2 +- indra/newview/llperfstats.cpp | 28 ++- indra/newview/llperfstats.h | 201 +++++++++++++++++--- indra/newview/llpresetsmanager.cpp | 4 +- indra/newview/llstartup.cpp | 5 - indra/newview/llviewerfloaterreg.cpp | 6 +- 10 files changed, 390 insertions(+), 178 deletions(-) diff --git a/indra/newview/fsfloaterperformance.cpp b/indra/newview/fsfloaterperformance.cpp index 0979553e30..ec7c2cbffe 100644 --- a/indra/newview/fsfloaterperformance.cpp +++ b/indra/newview/fsfloaterperformance.cpp @@ -1,5 +1,5 @@ /** - * @file llfloaterperformance.cpp + * @file fsfloaterperformance.cpp * * $LicenseInfo:firstyear=2021&license=viewerlgpl$ * Second Life Viewer Source Code @@ -48,11 +48,12 @@ #include "llviewermediafocus.h" #include "llvoavatar.h" #include "llvoavatarself.h" +#include "llperfstats.h" #include "pipeline.h" #include "llviewercontrol.h" #include "fsavatarrenderpersistence.h" #include "llpresetsmanager.h" -#include "fsperfstats.h" // performance stats support +#include "llwindow.h" #include "fslslbridge.h" #include @@ -63,10 +64,10 @@ const S32 BAR_LEFT_PAD = 2; const S32 BAR_RIGHT_PAD = 5; const S32 BAR_BOTTOM_PAD = 9; -constexpr auto AvType {FSPerfStats::ObjType_t::OT_AVATAR}; -constexpr auto AttType {FSPerfStats::ObjType_t::OT_ATTACHMENT}; -constexpr auto HudType {FSPerfStats::ObjType_t::OT_HUD}; -constexpr auto SceneType {FSPerfStats::ObjType_t::OT_GENERAL}; +constexpr auto AvType {LLPerfStats::ObjType_t::OT_AVATAR}; +constexpr auto AttType {LLPerfStats::ObjType_t::OT_ATTACHMENT}; +constexpr auto HudType {LLPerfStats::ObjType_t::OT_HUD}; +constexpr auto SceneType {LLPerfStats::ObjType_t::OT_GENERAL}; class FSExceptionsContextMenu : public LLListContextMenu { public: @@ -124,7 +125,7 @@ BOOL FSFloaterPerformance::postBuild() if (tgt_panel) { tgt_panel->getChild("target_btn")->setCommitCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mAutoTunePanel)); - tgt_panel->getChild("FSTuningFPSStrategy")->setCurrentByIndex(gSavedSettings.getU32("FSTuningFPSStrategy")); + tgt_panel->getChild("FSTuningFPSStrategy")->setCurrentByIndex(gSavedSettings.getU32("TuningFPSStrategy")); tgt_panel->getChild("PrefSaveButton")->setCommitCallback(boost::bind(&FSFloaterPerformance::savePreset, this)); tgt_panel->getChild("PrefLoadButton")->setCommitCallback(boost::bind(&FSFloaterPerformance::loadPreset, this)); tgt_panel->getChild("Defaults")->setCommitCallback(boost::bind(&FSFloaterPerformance::setHardwareDefaults, this)); @@ -159,21 +160,21 @@ BOOL FSFloaterPerformance::postBuild() mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&FSFloaterPerformance::updateComplexityText, this)); mNearbyPanel->getChild("IndirectMaxComplexity")->setCommitCallback(boost::bind(&FSFloaterPerformance::updateMaxComplexity, this)); - mMaxARTChangedSignal = gSavedSettings.getControl("FSRenderAvatarMaxART")->getCommitSignal()->connect(boost::bind(&FSFloaterPerformance::updateMaxRenderTime, this)); - mNearbyPanel->getChild("FSRenderAvatarMaxART")->setCommitCallback(boost::bind(&FSFloaterPerformance::updateMaxRenderTime, this)); + mMaxARTChangedSignal = gSavedSettings.getControl("RenderAvatarMaxART")->getCommitSignal()->connect(boost::bind(&FSFloaterPerformance::updateMaxRenderTime, this)); + mNearbyPanel->getChild("RenderAvatarMaxART")->setCommitCallback(boost::bind(&FSFloaterPerformance::updateMaxRenderTime, this)); LLAvatarComplexityControls::setIndirectMaxArc(); // store the current setting as the users desired reflection detail and DD - gSavedSettings.setS32("FSUserTargetReflections", LLPipeline::RenderReflectionDetail); - if(!FSPerfStats::tunables.userAutoTuneEnabled) + gSavedSettings.setS32("UserTargetReflections", LLPipeline::RenderReflectionDetail); + if(!LLPerfStats::tunables.userAutoTuneEnabled) { if (gSavedDrawDistance) { - gSavedSettings.setF32("FSAutoTuneRenderFarClipTarget", gSavedDrawDistance); + gSavedSettings.setF32("AutoTuneRenderFarClipTarget", gSavedDrawDistance); } else { - gSavedSettings.setF32("FSAutoTuneRenderFarClipTarget", LLPipeline::RenderFarClip); + gSavedSettings.setF32("AutoTuneRenderFarClipTarget", LLPipeline::RenderFarClip); } } @@ -182,9 +183,9 @@ BOOL FSFloaterPerformance::postBuild() void FSFloaterPerformance::resetMaxArtSlider() { - FSPerfStats::renderAvatarMaxART_ns = 0; - FSPerfStats::tunables.updateSettingsFromRenderCostLimit(); - FSPerfStats::tunables.applyUpdates(); + LLPerfStats::renderAvatarMaxART_ns = 0; + LLPerfStats::tunables.updateSettingsFromRenderCostLimit(); + LLPerfStats::tunables.applyUpdates(); updateMaxRenderTime(); } @@ -236,8 +237,10 @@ void FSFloaterPerformance::draw() constexpr auto NANOS = 1000000000; static LLCachedControl fpsCap(gSavedSettings, "FramePerSecondLimit"); // user limited FPS - static LLCachedControl targetFPS(gSavedSettings, "FSTargetFPS"); // desired FPS - static LLCachedControl tuningStrategy(gSavedSettings, "FSTuningFPSStrategy"); + static LLCachedControl targetFPS(gSavedSettings, "TargetFPS"); // desired FPS + static LLCachedControl tuningStrategy(gSavedSettings, "TuningFPSStrategy"); + static LLCachedControl vsyncEnabled(gSavedSettings, "RenderVSyncEnable"); + if (mUpdateTimer->hasExpired()) { @@ -248,47 +251,47 @@ void FSFloaterPerformance::draw() auto target_frame_time_ns = NANOS/(targetFPS==0?1:targetFPS); - FSPerfStats::bufferToggleLock.lock(); // prevent toggle for a moment + LLPerfStats::bufferToggleLock.lock(); // prevent toggle for a moment - auto tot_frame_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FRAME); + auto tot_frame_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FRAME); // cumulative avatar time (includes idle processing, attachments and base av) - auto tot_avatar_time_raw = FSPerfStats::StatsRecorder::getSum(AvType, FSPerfStats::StatType_t::RENDER_COMBINED); + auto tot_avatar_time_raw = LLPerfStats::StatsRecorder::getSum(AvType, LLPerfStats::StatType_t::RENDER_COMBINED); // cumulative avatar render specific time (a bit arbitrary as the processing is too.) - // auto tot_av_idle_time_raw = FSPerfStats::StatsRecorder::getSum(AvType, FSPerfStats::StatType_t::RENDER_IDLE); + // auto tot_av_idle_time_raw = LLPerfStats::StatsRecorder::getSum(AvType, LLPerfStats::StatType_t::RENDER_IDLE); // auto tot_avatar_render_time_raw = tot_avatar_time_raw - tot_av_idle_time_raw; // the time spent this frame on the "display()" call. Treated as "tot time rendering" - auto tot_render_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_DISPLAY); + auto tot_render_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_DISPLAY); // sleep time is basically forced sleep when window out of focus - auto tot_sleep_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_SLEEP); + auto tot_sleep_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SLEEP); // time spent on UI - auto tot_ui_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_UI); + auto tot_ui_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_UI); // cumulative time spent rendering HUDS - auto tot_huds_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_HUDS); + auto tot_huds_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_HUDS); // "idle" time. This is the time spent in the idle poll section of the main loop - auto tot_idle_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_IDLE); + auto tot_idle_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_IDLE); // similar to sleep time, induced by FPS limit - auto tot_limit_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FPSLIMIT); + auto tot_limit_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FPSLIMIT); // swap time is time spent in swap buffer - auto tot_swap_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_SWAP); + auto tot_swap_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SWAP); - FSPerfStats::bufferToggleLock.unlock(); + LLPerfStats::bufferToggleLock.unlock(); auto unreliable = false; // if there is something to skew the stats such as sleep of fps cap - auto tot_frame_time_ns = FSPerfStats::raw_to_ns(tot_frame_time_raw); - auto tot_avatar_time_ns = FSPerfStats::raw_to_ns( tot_avatar_time_raw ); - auto tot_huds_time_ns = FSPerfStats::raw_to_ns( tot_huds_time_raw ); + auto tot_frame_time_ns = LLPerfStats::raw_to_ns(tot_frame_time_raw); + auto tot_avatar_time_ns = LLPerfStats::raw_to_ns( tot_avatar_time_raw ); + auto tot_huds_time_ns = LLPerfStats::raw_to_ns( tot_huds_time_raw ); // UI time includes HUD time so dedut that before we calc percentages - auto tot_ui_time_ns = FSPerfStats::raw_to_ns( tot_ui_time_raw - tot_huds_time_raw); + auto tot_ui_time_ns = LLPerfStats::raw_to_ns( tot_ui_time_raw - tot_huds_time_raw); - // auto tot_sleep_time_ns = FSPerfStats::raw_to_ns( tot_sleep_time_raw ); - // auto tot_limit_time_ns = FSPerfStats::raw_to_ns( tot_limit_time_raw ); + // auto tot_sleep_time_ns = LLPerfStats::raw_to_ns( tot_sleep_time_raw ); + // auto tot_limit_time_ns = LLPerfStats::raw_to_ns( tot_limit_time_raw ); - // auto tot_render_time_ns = FSPerfStats::raw_to_ns( tot_render_time_raw ); - auto tot_idle_time_ns = FSPerfStats::raw_to_ns( tot_idle_time_raw ); - auto tot_swap_time_ns = FSPerfStats::raw_to_ns( tot_swap_time_raw ); - auto tot_scene_time_ns = FSPerfStats::raw_to_ns( tot_render_time_raw - tot_avatar_time_raw - tot_swap_time_raw - tot_ui_time_raw); - // auto tot_overhead_time_ns = FSPerfStats::raw_to_ns( tot_frame_time_raw - tot_render_time_raw - tot_idle_time_raw ); + // auto tot_render_time_ns = LLPerfStats::raw_to_ns( tot_render_time_raw ); + auto tot_idle_time_ns = LLPerfStats::raw_to_ns( tot_idle_time_raw ); + auto tot_swap_time_ns = LLPerfStats::raw_to_ns( tot_swap_time_raw ); + auto tot_scene_time_ns = LLPerfStats::raw_to_ns( tot_render_time_raw - tot_avatar_time_raw - tot_swap_time_raw - tot_ui_time_raw); + // auto tot_overhead_time_ns = LLPerfStats::raw_to_ns( tot_frame_time_raw - tot_render_time_raw - tot_idle_time_raw ); // // remove time spent sleeping for fps limit or out of focus. // tot_frame_time_ns -= tot_limit_time_ns; @@ -314,7 +317,13 @@ void FSFloaterPerformance::draw() args["TOT_FRAME_TIME"] = llformat("%02u", (U32)llround(tot_frame_time_ns/1000000)); args["FPSCAP"] = llformat("%02u", (U32)fpsCap); args["FPSTARGET"] = llformat("%02u", (U32)targetFPS); + S32 refresh_rate = gViewerWindow->getWindow()->getRefreshRate(); + args["VSYNCFREQ"] = llformat("%02d", (U32)refresh_rate); auto textbox = getChild("fps_warning"); + // Note: the ordering of these is important. + // 1) background_yield should override others + // 2) viewer fps limits take place irrespective of vsync and so should come first. + // 3) vsync last. if (tot_sleep_time_raw > 0) // We are sleeping because view is not focussed { textbox->setVisible(true); @@ -329,7 +338,16 @@ void FSFloaterPerformance::draw() textbox->setColor(LLUIColorTable::instance().getColor("DrYellow")); unreliable = true; } - else if (FSPerfStats::tunables.userAutoTuneEnabled) + else if (vsyncEnabled) + { + textbox->setVisible(true); + textbox->setText(getString("max_fps", args)); + // TODO(Beq) : When FPS is more than the frequency we can notify the user. + // When the FPS is lower than the frequency and also lower than the core stats then VSync might be the constraint + // we can notify this too. For now just display the frequency until we are sure that refresh rate is detected properly. + textbox->setColor(LLUIColorTable::instance().getColor("green")); + } + else if (LLPerfStats::tunables.userAutoTuneEnabled) { textbox->setVisible(true); textbox->setText(getString("tuning_fps", args)); @@ -364,11 +382,11 @@ void FSFloaterPerformance::draw() getChild("frame_breakdown")->setText(getString("frame_stats", args)); auto button = getChild("AutoTuneFPS"); - if((bool)button->getToggleState() != FSPerfStats::tunables.userAutoTuneEnabled) + if((bool)button->getToggleState() != LLPerfStats::tunables.userAutoTuneEnabled) { button->toggleState(); } - if (FSPerfStats::tunables.userAutoTuneEnabled && !unreliable ) + if (LLPerfStats::tunables.userAutoTuneEnabled && !unreliable ) { // the tuning itself is managed from another thread but we can report progress here @@ -387,7 +405,7 @@ void FSFloaterPerformance::draw() textbox->setColor(LLUIColorTable::instance().getColor("red")); } } - else if (target_frame_time_ns > (tot_frame_time_ns + FSPerfStats::renderAvatarMaxART_ns)) + else if (target_frame_time_ns > (tot_frame_time_ns + LLPerfStats::renderAvatarMaxART_ns)) { // if we have more time to spare. Display this (the service will update things) textbox->setColor(LLUIColorTable::instance().getColor("green")); @@ -459,7 +477,7 @@ void FSFloaterPerformance::populateHUDList() max_complexity = llmax(max_complexity, (*iter).objectsCost); } - auto huds_max_render_time_raw = FSPerfStats::StatsRecorder::getMax(HudType, FSPerfStats::StatType_t::RENDER_GEOMETRY); + auto huds_max_render_time_raw = LLPerfStats::StatsRecorder::getMax(HudType, LLPerfStats::StatType_t::RENDER_GEOMETRY); for (iter = complexity_list.begin(); iter != end; ++iter) { LLHUDComplexity hud_object_complexity = *iter; @@ -469,7 +487,7 @@ void FSFloaterPerformance::populateHUDList() continue; } - auto hud_render_time_raw = FSPerfStats::StatsRecorder::get(HudType, hud_object_complexity.objectId, FSPerfStats::StatType_t::RENDER_GEOMETRY); + auto hud_render_time_raw = LLPerfStats::StatsRecorder::get(HudType, hud_object_complexity.objectId, LLPerfStats::StatType_t::RENDER_GEOMETRY); LLSD item; item["special_id"] = hud_object_complexity.objectId; @@ -485,7 +503,7 @@ void FSFloaterPerformance::populateHUDList() row[1]["column"] = "art_value"; row[1]["type"] = "text"; - row[1]["value"] = llformat( "%.2f",FSPerfStats::raw_to_us(hud_render_time_raw) ); + row[1]["value"] = llformat( "%.2f",LLPerfStats::raw_to_us(hud_render_time_raw) ); row[1]["font"]["name"] = "SANSSERIF"; row[2]["column"] = "name"; @@ -541,9 +559,9 @@ void FSFloaterPerformance::populateObjectList() // for consistency we lock the buffer while we build the list. In theory this is uncontended as th ebuffer should only toggle on end of frame { - std::lock_guard guard{FSPerfStats::bufferToggleLock}; - auto att_max_render_time_raw = FSPerfStats::StatsRecorder::getMax(AttType, FSPerfStats::StatType_t::RENDER_COMBINED); - auto att_sum_render_time_raw = FSPerfStats::StatsRecorder::getSum(AttType, FSPerfStats::StatType_t::RENDER_COMBINED); + std::lock_guard guard{LLPerfStats::bufferToggleLock}; + auto att_max_render_time_raw = LLPerfStats::StatsRecorder::getMax(AttType, LLPerfStats::StatType_t::RENDER_COMBINED); + auto att_sum_render_time_raw = LLPerfStats::StatsRecorder::getSum(AttType, LLPerfStats::StatType_t::RENDER_COMBINED); LL_DEBUGS("PerfFloater") << "Attachments for frame : " << gFrameCount << " Max:" << att_max_render_time_raw << LL_ENDL; for (iter = attachment_list.begin(); iter != end; ++iter) { @@ -552,8 +570,8 @@ void FSFloaterPerformance::populateObjectList() auto& attID{attachment_complexity.objectId}; auto& attName{attachment_complexity.objectName}; - auto attach_render_time_raw = FSPerfStats::StatsRecorder::get(AttType, attID, FSPerfStats::StatType_t::RENDER_COMBINED); - LL_DEBUGS("PerfFloater") << "Att: " << attName << " (" << attID.asString() << ") Cost: " << FSPerfStats::raw_to_us(attach_render_time_raw) << LL_ENDL; + auto attach_render_time_raw = LLPerfStats::StatsRecorder::get(AttType, attID, LLPerfStats::StatType_t::RENDER_COMBINED); + LL_DEBUGS("PerfFloater") << "Att: " << attName << " (" << attID.asString() << ") Cost: " << LLPerfStats::raw_to_us(attach_render_time_raw) << LL_ENDL; LLSD item; item["special_id"] = attID; item["target"] = LLNameListCtrl::SPECIAL; @@ -569,7 +587,7 @@ void FSFloaterPerformance::populateObjectList() row[1]["column"] = "art_value"; row[1]["type"] = "text"; // row[1]["value"] = std::to_string(obj_cost_short); - row[1]["value"] = llformat( "%.2f", FSPerfStats::raw_to_us(attach_render_time_raw) ); + row[1]["value"] = llformat( "%.2f", LLPerfStats::raw_to_us(attach_render_time_raw) ); row[1]["font"]["name"] = "SANSSERIF"; row[2]["column"] = "complex_value"; @@ -603,7 +621,7 @@ void FSFloaterPerformance::populateObjectList() auto textbox = getChild("tot_att_count"); LLStringUtil::format_map_t args; args["TOT_ATT"] = llformat("%d", (int64_t)attachment_list.size()); - args["TOT_ATT_TIME"] = llformat("%.2f", FSPerfStats::raw_to_us(att_sum_render_time_raw)); + args["TOT_ATT_TIME"] = llformat("%.2f", LLPerfStats::raw_to_us(att_sum_render_time_raw)); textbox->setText(getString("tot_att_template", args)); } @@ -615,7 +633,7 @@ void FSFloaterPerformance::populateObjectList() void FSFloaterPerformance::populateNearbyList() { - static LLCachedControl showTunedART(gSavedSettings, "FSShowTunedART"); + static LLCachedControl showTunedART(gSavedSettings, "ShowTunedART"); S32 prev_pos = mNearbyList->getScrollPos(); LLUUID prev_selected_id = mNearbyList->getStringUUIDSelectedItem(); std::string current_sort_col = mNearbyList->getSortColumnName(); @@ -635,10 +653,10 @@ void FSFloaterPerformance::populateNearbyList() std::vector::iterator char_iter = valid_nearby_avs.begin(); - FSPerfStats::bufferToggleLock.lock(); - auto av_render_max_raw = FSPerfStats::StatsRecorder::getMax(AvType, FSPerfStats::StatType_t::RENDER_COMBINED); - auto av_render_tot_raw = FSPerfStats::StatsRecorder::getSum(AvType, FSPerfStats::StatType_t::RENDER_COMBINED); - FSPerfStats::bufferToggleLock.unlock(); + LLPerfStats::bufferToggleLock.lock(); + auto av_render_max_raw = LLPerfStats::StatsRecorder::getMax(AvType, LLPerfStats::StatType_t::RENDER_COMBINED); + auto av_render_tot_raw = LLPerfStats::StatsRecorder::getSum(AvType, LLPerfStats::StatType_t::RENDER_COMBINED); + LLPerfStats::bufferToggleLock.unlock(); // FSPlot("max ART", (int64_t)av_render_max_raw); // FSPlot("Num av", (int64_t)valid_nearby_avs.size()); @@ -657,85 +675,128 @@ void FSFloaterPerformance::populateNearbyList() S32 complexity_short = llmax((S32)avatar->getVisualComplexity() / 1000, 1); - FSPerfStats::bufferToggleLock.lock(); - auto render_av_raw = FSPerfStats::StatsRecorder::get(AvType, avatar->getID(),FSPerfStats::StatType_t::RENDER_COMBINED); - FSPerfStats::bufferToggleLock.unlock(); + LLPerfStats::bufferToggleLock.lock(); + auto render_av_raw = LLPerfStats::StatsRecorder::get(AvType, avatar->getID(),LLPerfStats::StatType_t::RENDER_COMBINED); + auto render_av_geom = LLPerfStats::StatsRecorder::get(AvType, avatar->getID(),LLPerfStats::StatType_t::RENDER_GEOMETRY); + auto render_av_shadow = LLPerfStats::StatsRecorder::get(AvType, avatar->getID(),LLPerfStats::StatType_t::RENDER_SHADOWS); + auto render_av_idle = LLPerfStats::StatsRecorder::get(AvType, avatar->getID(),LLPerfStats::StatType_t::RENDER_IDLE); + LLPerfStats::bufferToggleLock.unlock(); auto is_slow = avatar->isTooSlowWithShadows(); LLSD item; item["id"] = avatar->getID(); LLSD& row = item["columns"]; - row[0]["column"] = "art_visual"; - row[0]["type"] = "bar"; - LLSD& value = row[0]["value"]; + int colno = 0; + row[colno]["column"] = "art_visual"; + row[colno]["type"] = "bar"; + LLSD& value = row[colno]["value"]; // The ratio used in the bar is the current cost, as soon as we take action this changes so we keep the // pre-tune value for the numerical column and sorting. value["ratio"] = (double)render_av_raw / av_render_max_raw; value["bottom"] = BAR_BOTTOM_PAD; value["left_pad"] = BAR_LEFT_PAD; value["right_pad"] = BAR_RIGHT_PAD; + colno++; - row[1]["column"] = "art_value"; - row[1]["type"] = "text"; - if (is_slow && !showTunedART) + row[colno]["column"] = "art_value"; + row[colno]["type"] = "text"; + if (is_slow) { - row[1]["value"] = llformat( "%.2f", FSPerfStats::raw_to_us( avatar->getLastART() ) ); + row[colno]["value"] = llformat( "%.2f", LLPerfStats::raw_to_us( avatar->getLastART() ) ); } else { - row[1]["value"] = llformat( "%.2f", FSPerfStats::raw_to_us( render_av_raw ) ); + row[colno]["value"] = llformat( "%.2f", LLPerfStats::raw_to_us( render_av_raw ) ); } - row[1]["font"]["name"] = "SANSSERIF"; - row[1]["width"] = "50"; + row[colno]["font"]["name"] = "SANSSERIF"; + row[colno]["width"] = "50"; + colno++; - row[2]["column"] = "complex_value"; - row[2]["type"] = "text"; - row[2]["value"] = std::to_string(complexity_short); - row[2]["font"]["name"] = "SANSSERIF"; - row[2]["width"] = "50"; + if (showTunedART) + { + row[colno]["column"] = "adj_art_value"; + row[colno]["type"] = "text"; + if (is_slow ) + { + row[colno]["value"] = llformat( "%.2f", LLPerfStats::raw_to_us( render_av_raw ) ); + } + else + { + row[colno]["value"] = llformat( "--" ); + } + row[colno]["font"]["name"] = "SANSSERIF"; + row[colno]["width"] = "50"; + colno++; + } - row[3]["column"] = "state"; - row[3]["type"] = "text"; + row[colno]["column"] = "complex_value"; + row[colno]["type"] = "text"; + row[colno]["value"] = std::to_string(complexity_short); + row[colno]["font"]["name"] = "SANSSERIF"; + row[colno]["width"] = "50"; + + colno++; + row[colno]["column"] = "state"; + row[colno]["type"] = "text"; if (is_slow) { if (avatar->isTooSlowWithoutShadows()) { - row[3]["value"] = std::string{"I"}; + row[colno]["value"] = std::string{"I"}; } else { - row[3]["value"] = std::string{"S"}; + row[colno]["value"] = std::string{"S"}; } } else { - row[3]["value"] = std::string{" "}; + row[colno]["value"] = std::string{" "}; } - row[3]["font"]["name"] = "SANSSERIF"; + row[colno]["font"]["name"] = "SANSSERIF"; - row[4]["column"] = "name"; + colno++; + row[colno]["column"] = "name"; + colno++; + row[colno]["column"] = "breakdown"; + row[colno]["type"] = "text"; + row[colno]["value"] = llformat( "%.2f/%.2f/%.2f", LLPerfStats::raw_to_us( render_av_geom ), LLPerfStats::raw_to_us( render_av_shadow ), LLPerfStats::raw_to_us( render_av_idle ) ); + colno++; LLScrollListItem* av_item = mNearbyList->addElement(item); if (av_item) { - LLScrollListText* art_text = dynamic_cast(av_item->getColumn(1)); + int colno{1}; + LLScrollListText* art_text = dynamic_cast(av_item->getColumn(colno)); if (art_text) { art_text->setAlignment(LLFontGL::RIGHT); } - LLScrollListText* value_text = dynamic_cast(av_item->getColumn(2)); + colno++; + LLScrollListText* value_text = dynamic_cast(av_item->getColumn(colno)); if (value_text) { value_text->setAlignment(LLFontGL::RIGHT); } - LLScrollListText* state_text = dynamic_cast(av_item->getColumn(3)); + colno++; + if (showTunedART) + { + LLScrollListText* value_text = dynamic_cast(av_item->getColumn(colno)); + if (value_text) + { + value_text->setAlignment(LLFontGL::RIGHT); + } + colno++; + } + LLScrollListText* state_text = dynamic_cast(av_item->getColumn(colno)); if (state_text) { state_text->setAlignment(LLFontGL::HCENTER); } - LLScrollListText* name_text = dynamic_cast(av_item->getColumn(4)); + colno++; + LLScrollListText* name_text = dynamic_cast(av_item->getColumn(colno)); if (name_text) { if (avatar->isSelf()) @@ -761,6 +822,7 @@ void FSFloaterPerformance::populateNearbyList() name_text->setColor(LLUIColorTable::instance().getColor(color)); } } + colno++; } } char_iter++; @@ -772,7 +834,7 @@ void FSFloaterPerformance::populateNearbyList() auto textbox = getChild("tot_av_count"); LLStringUtil::format_map_t args; args["TOT_AV"] = llformat("%d", (int64_t)valid_nearby_avs.size()); - args["TOT_AV_TIME"] = llformat("%.2f", FSPerfStats::raw_to_us(av_render_tot_raw)); + args["TOT_AV_TIME"] = llformat("%.2f", LLPerfStats::raw_to_us(av_render_tot_raw)); textbox->setText(getString("tot_av_template", args)); } @@ -820,7 +882,7 @@ void FSFloaterPerformance::onClickHideAvatars() void FSFloaterPerformance::onClickFocusAvatar() { - FSPerfStats::StatsRecorder::setFocusAv(mNearbyCombo->getSelectedValue().asUUID()); + LLPerfStats::StatsRecorder::setFocusAv(mNearbyCombo->getSelectedValue().asUUID()); } void FSFloaterPerformance::onClickExceptions() @@ -850,8 +912,8 @@ void FSFloaterPerformance::updateMaxRenderTime() void FSFloaterPerformance::updateMaxRenderTimeText() { LLAvatarComplexityControls::setRenderTimeText( - gSavedSettings.getF32("FSRenderAvatarMaxART"), - mNearbyPanel->getChild("FSRenderAvatarMaxARTText", true), + gSavedSettings.getF32("RenderAvatarMaxART"), + mNearbyPanel->getChild("RenderAvatarMaxARTText", true), true); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7fb93b2c67..96281ea350 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -287,7 +287,6 @@ using namespace LL; #include "fsassetblacklist.h" // #include "fstelemetry.h" // Tracy profiler support -#include "fsperfstats.h" // performance stats support #if LL_LINUX && LL_GTK #include "glib.h" @@ -1608,44 +1607,42 @@ bool LLAppViewer::doFrame() LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); LLSD newFrame; + LLTimer frameTimer; // relocated - FIRE-22297: FPS limiter not working properly on Mac/Linux { + LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE); // perf stats // profiling enablement. // This ifdef is optional but better to avoid even low overhead code in main loop where not needed. #ifdef TRACY_ENABLE - static bool one_time{false}; - static LLCachedControl defer_profiling(gSavedSettings, "DeferProfilingUntilConnected"); - if( !one_time && (gFrameCount % 10 == 0) ) - { - - // LL_INFOS() << "Profiler active: " << (LLProfiler::active?"True":"False") << LL_ENDL; - // LL_INFOS() << "deferred_profiling: " << (defer_profiling?"True":"False") << LL_ENDL; - // LL_INFOS() << "connected: " << (LL_PROFILE_IS_CONNECTED?"True":"False") << LL_ENDL; - - if( ( !LLProfiler::active ) && ( defer_profiling && LL_PROFILE_IS_CONNECTED ) ) + static bool one_time{false}; + static LLCachedControl defer_profiling(gSavedSettings, "DeferProfilingUntilConnected"); + if( !one_time && (gFrameCount % 10 == 0) ) { - LLProfiler::active = true; - gSavedSettings.setBOOL( "ProfilingActive", LLProfiler::active ); - one_time=true; // prevent reset race if we disable manually. - LL_INFOS() << "Profiler or collector connected" << LL_ENDL; + + // LL_INFOS() << "Profiler active: " << (LLProfiler::active?"True":"False") << LL_ENDL; + // LL_INFOS() << "deferred_profiling: " << (defer_profiling?"True":"False") << LL_ENDL; + // LL_INFOS() << "connected: " << (LL_PROFILE_IS_CONNECTED?"True":"False") << LL_ENDL; + + if( ( !LLProfiler::active ) && ( defer_profiling && LL_PROFILE_IS_CONNECTED ) ) + { + LLProfiler::active = true; + gSavedSettings.setBOOL( "ProfilingActive", LLProfiler::active ); + one_time=true; // prevent reset race if we disable manually. + LL_INFOS() << "Profiler or collector connected" << LL_ENDL; + } + if( !defer_profiling ) + { + // no point in checking if we are not waiting. + // TODO(Beq): At the moment we have only two options + // 1) start capturing immediately + // 2) start capturing only when a profiler is connected + // Ideally we could have another flag to control profiling at start + // this would then allow a fully manual enablement. + one_time = true; + LL_INFOS() << "Manual profiling control selected" << LL_ENDL; + } } - if( !defer_profiling ) - { - // no point in checking if we are not waiting. - // TODO(Beq): At the moment we have only two options - // 1) start capturing immediately - // 2) start capturing only when a profiler is connected - // Ideally we could have another flag to control profiling at start - // this would then allow a fully manual enablement. - one_time = true; - LL_INFOS() << "Manual profiling control selected" << LL_ENDL; - } - } #endif // - // FIRE-22297: FPS limiter not working properly on Mac/Linux - LLTimer frameTimer; - LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE); // perf stats - nd::etw::logFrame(); // Write the start of each frame. Even if our Provider (Firestorm) would be enabled, this has only light impact. Does nothing on OSX and Linux. { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLTrace"); @@ -1662,11 +1659,11 @@ bool LLAppViewer::doFrame() //clear call stack records LL_CLEAR_CALLSTACKS(); - } // perf stats (close NonRender/IDLE tracking starting at event pump) + } { { - - LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df processMiscNativeEvents") + LLPerfStats::RecordSceneTime T(LLPerfStats::StatType_t::RENDER_IDLE); // ensure we have the entire top scope of frame covered (input event and coro) + LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df processMiscNativeEvents"); pingMainloopTimeout("Main:MiscNativeWindowEvents"); if (gViewerWindow) @@ -1870,8 +1867,6 @@ bool LLAppViewer::doFrame() // instrument image decodes { LL_PROFILE_ZONE_NAMED_CATEGORY_APP("updateTextureThreads"); - // FSPlot("max_time_ms",max_time); - // work_pending += updateTextureThreads(max_time); } // instrument image decodes @@ -1926,7 +1921,7 @@ bool LLAppViewer::doFrame() if (fsLimitFramerate && LLStartUp::getStartupState() == STATE_STARTED && !gTeleportDisplay && !logoutRequestSent() && max_fps > F_APPROXIMATELY_ZERO) { // Sleep a while to limit frame rate. - FSPerfStats::RecordSceneTime T ( FSPerfStats::StatType_t::RENDER_FPSLIMIT ); + LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_FPSLIMIT ); F32 min_frame_time = 1.f / (F32)max_fps; S32 milliseconds_to_sleep = llclamp((S32)((min_frame_time - frameTimer.getElapsedTimeF64()) * 1000.f), 0, 1000); if (milliseconds_to_sleep > 0) @@ -5855,7 +5850,7 @@ void LLAppViewer::idle() if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { - FSPerfStats::tunedAvatars=0; // reset the number of avatars that have been tweaked. + LLPerfStats::tunedAvatars=0; // reset the number of avatars that have been tweaked. gObjectList.update(gAgent); } } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 77d4ad8fce..e047c4e55c 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -60,7 +60,6 @@ // void drawBoxOutline(const LLVector3& pos,const LLVector3& size); // llspatialpartition.cpp // #include "llnetmap.h" -#include "fsperfstats.h" // performance stats support static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK; diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 8f6bebd183..0c066a775c 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -547,8 +547,6 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) { LLDrawInfo& params = **k; - // Capture render times - LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject(); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 2e26f284d4..662119412a 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -60,7 +60,7 @@ // [RLVa:KB] - Checked: RLVa-2.0.0 #include "rlvhandler.h" // [/RLVa:KB] -#include "fsperfstats.h" // performance stats support +#include "llperfstats.h" #if LL_LINUX // Work-around spurious used before init warning on Vector4a diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 1a0e5842e2..c6871d0d93 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -37,11 +37,22 @@ extern LLControlGroup gSavedSettings; namespace LLPerfStats { +// extra profiling + #ifdef USAGE_TRACKING + std::atomic inUse{0}; + std::atomic inUseAvatar{0}; + std::atomic inUseScene{0}; + std::atomic inUseAttachment{0}; + std::atomic inUseAttachmentRigged{0}; + std::atomic inUseAttachmentUnRigged{0}; +#endif +// std::atomic tunedAvatars{0}; std::atomic renderAvatarMaxART_ns{(U64)(ART_UNLIMITED_NANOS)}; // highest render time we'll allow without culling features bool belowTargetFPS{false}; U32 lastGlobalPrefChange{0}; std::mutex bufferToggleLock{}; + F64 cpu_hertz{0.0}; // reinstate threadsafe frequency Tunables tunables; @@ -126,6 +137,7 @@ namespace LLPerfStats // create a queue // create a thread to consume from the queue tunables.initialiseFromSettings(); + LLPerfStats::cpu_hertz = (F64)LLTrace::BlockTimer::countsPerSecond(); // reinstate threadsafe frequency t.detach(); } @@ -156,11 +168,13 @@ namespace LLPerfStats StatType_t::RENDER_COMBINED, StatType_t::RENDER_IDLE }; - - if( /*sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)] != 0 ||*/ sceneStats[static_cast(StatType_t::RENDER_SLEEP)] != 0 ) + // restore FPSLimit reporting + // if( /*sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)] != 0 ||*/ sceneStats[static_cast(StatType_t::RENDER_SLEEP)] != 0 ) + if( sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)] != 0 || sceneStats[static_cast(StatType_t::RENDER_SLEEP)] != 0 ) + // { unreliable = true; - //lastStats[static_cast(StatType_t::RENDER_FPSLIMIT)] = sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)]; + lastStats[static_cast(StatType_t::RENDER_FPSLIMIT)] = sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)];// restore FPSLimit reporting lastStats[static_cast(StatType_t::RENDER_SLEEP)] = sceneStats[static_cast(StatType_t::RENDER_SLEEP)]; lastStats[static_cast(StatType_t::RENDER_FRAME)] = sceneStats[static_cast(StatType_t::RENDER_FRAME)]; // bring over the total frame render time to deal with region crossing overlap issues } @@ -316,7 +330,7 @@ namespace LLPerfStats // sleep time is basically forced sleep when window out of focus auto tot_sleep_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_SLEEP); // similar to sleep time, induced by FPS limit - //auto tot_limit_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FPSLIMIT); + auto tot_limit_time_raw = LLPerfStats::StatsRecorder::getSceneStat(LLPerfStats::StatType_t::RENDER_FPSLIMIT);// restore FPSLimit reporting // the time spent this frame on the "doFrame" call. Treated as "tot time for frame" @@ -332,15 +346,15 @@ namespace LLPerfStats } // The frametime budget we have based on the target FPS selected - auto target_frame_time_raw = (U64)llround((F64)LLTrace::BlockTimer::countsPerSecond()/(tunables.userTargetFPS==0?1:tunables.userTargetFPS)); + auto target_frame_time_raw = (U64)llround(LLPerfStats::cpu_hertz/(tunables.userTargetFPS==0?1:tunables.userTargetFPS));// reinstate threadsafe frequency // LL_INFOS() << "Effective FPS(raw):" << tot_frame_time_raw << " Target:" << target_frame_time_raw << LL_ENDL; auto inferredFPS{1000/(U32)std::max(raw_to_ms(tot_frame_time_raw),1.0)}; U32 settingsChangeFrequency{inferredFPS > 25?inferredFPS:25}; - /*if( tot_limit_time_raw != 0) + if( tot_limit_time_raw != 0)// restore FPSLimit reporting { // This could be problematic. tot_frame_time_raw -= tot_limit_time_raw; - }*/ + }// restore FPSLimit reporting // 1) Is the target frame time lower than current? if( target_frame_time_raw <= tot_frame_time_raw ) { diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h index 961594f18c..e0414da759 100644 --- a/indra/newview/llperfstats.h +++ b/indra/newview/llperfstats.h @@ -34,14 +34,36 @@ #include #include "lluuid.h" #include "llfasttimer.h" +#include "blockingconcurrentqueue.h" // reinstate faster queues #include "llapp.h" #include "llprofiler.h" #include "pipeline.h" +// Additional logging options. These can skew inworld numbers so onyl use for debugging and tracking issues +#ifdef TRACY_ENABLE +// USAGE_TRACKING - displays overlapping stats that may imply double counting. +// ATTACHMENT_TRACKING - displays detailed tracking info for Avatar and Attachment. very heavy overhead. +// #define USAGE_TRACKING +#define ATTACHMENT_TRACKING +#else +#undef USAGE_TRACKING +#undef ATTACHMENT_TRACKING +#endif +// extern U32 gFrameCount; extern LLUUID gAgentID; namespace LLPerfStats { +// Additional logging options. These can skew inworld numbers so onyl use for debugging and tracking issues +#ifdef USAGE_TRACKING + extern std::atomic inUse; + extern std::atomic inUseAvatar; + extern std::atomic inUseScene; + extern std::atomic inUseAttachment; + extern std::atomic inUseAttachmentRigged; + extern std::atomic inUseAttachmentUnRigged; +#endif +// // Note if changing these, they should correspond with the log range of the correpsonding sliders static constexpr U64 ART_UNLIMITED_NANOS{50000000}; static constexpr U64 ART_MINIMUM_NANOS{100000}; @@ -54,6 +76,7 @@ namespace LLPerfStats static constexpr U32 TUNE_AVATARS_ONLY{0}; static constexpr U32 TUNE_SCENE_AND_AVATARS{1}; + extern F64 cpu_hertz; // reinstate thread safety extern std::atomic tunedAvatars; extern std::atomic renderAvatarMaxART_ns; @@ -80,7 +103,7 @@ namespace LLPerfStats RENDER_SLEEP, RENDER_LFS, RENDER_MESHREPO, - //RENDER_FPSLIMIT, + RENDER_FPSLIMIT,// restore this for FS RENDER_FPS, RENDER_IDLE, RENDER_DONE, // toggle buffer & clearbuffer (see processUpdate for hackery) @@ -156,7 +179,10 @@ namespace LLPerfStats extern Tunables tunables; class StatsRecorder{ - using Queue = LLThreadSafeQueue; + // we don't want to be using lock based queues + // using Queue = LLThreadSafeQueue; + using Queue = moodycamel::BlockingConcurrentQueue; + // public: static inline StatsRecorder& getInstance() @@ -166,10 +192,14 @@ namespace LLPerfStats } static inline void setFocusAv(const LLUUID& avID){focusAv = avID;}; static inline const LLUUID& getFocusAv(){return focusAv;}; - static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.pushFront(std::move(upd));}; - static void endFrame(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});}; - static void clearStats(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});}; - + // We do not want to use lock based queues + // static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.pushFront(std::move(upd));}; + // static void endFrame(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});}; + // static void clearStats(){StatsRecorder::getInstance().q.pushFront(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});}; + static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.enqueue(std::move(upd));}; + static void endFrame(){StatsRecorder::getInstance().q.enqueue(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});}; + static void clearStats(){StatsRecorder::getInstance().q.enqueue(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});}; + // static inline void setEnabled(bool on_or_off){collectionEnabled=on_or_off;}; static inline void enable() { collectionEnabled=true; }; static inline void disable() { collectionEnabled=false; }; @@ -201,7 +231,7 @@ namespace LLPerfStats static int countNearbyAvatars(S32 distance); // StatsArray is a uint64_t for each possible statistic type. using StatsArray = std::array(LLPerfStats::StatType_t::STATS_COUNT)>; - using StatsMap = std::unordered_map>; + using StatsMap = std::unordered_map; // using StatsTypeMatrix = std::array(LLPerfStats::ObjType_t::OT_COUNT)>; using StatsSummaryArray = std::array(LLPerfStats::ObjType_t::OT_COUNT)>; @@ -241,6 +271,13 @@ namespace LLPerfStats auto& avKey{upd.avID}; auto type {upd.statType}; auto val {upd.time}; + // markup to support coverage testing on stats collection + #ifdef TRACY_ENABLE + LL_PROFILE_ZONE_TEXT(key.toStringFast(obstr), 36); + LL_PROFILE_ZONE_TEXT(avKey.toStringFast(avstr), 36); + LL_PROFILE_ZONE_NUM(val); + #endif + // if (ot == ObjType_t::OT_GENERAL) { @@ -317,19 +354,24 @@ namespace LLPerfStats while( enabled() && !LLApp::isExiting() ) { - auto count = 0; - while (count < 10) - { - if (instance.q.tryPopFor(std::chrono::milliseconds(10), upd[count])) - { - count++; - } - else - { - break; - } - } - //LL_PROFILER_THREAD_BEGIN("PerfStats"); + // We don't want these queues + // auto count = 0; + // while (count < 10) + // { + // if (instance.q.tryPopFor(std::chrono::milliseconds(10), upd[count])) + // { + // count++; + // } + // else + // { + // break; + // } + // } + // //LL_PROFILER_THREAD_BEGIN("PerfStats"); + + auto count = instance.q.wait_dequeue_bulk_timed(upd, 10, std::chrono::milliseconds(10)); + LL_PROFILER_THREAD_BEGIN("PerfStats"); + // if(count) { // LL_INFOS("perfstats") << "processing " << count << " updates." << LL_ENDL; @@ -338,7 +380,7 @@ namespace LLPerfStats instance.processUpdate(upd[i]); } } - //LL_PROFILER_THREAD_END("PerfStats"); + LL_PROFILER_THREAD_END("PerfStats"); // } } @@ -366,7 +408,35 @@ namespace LLPerfStats start{LLTrace::BlockTimer::getCPUClockCount64()}, stat{type, ObjTypeDiscriminator, std::move(av), std::move(id), 0, isRiggedAtt, isHUDAtt} { - //LL_PROFILE_ZONE_COLOR(tracy::Color::Orange); + // extra profiling coverage tracking + // LL_PROFILE_ZONE_COLOR(tracy::Color::Orange); + LL_PROFILE_ZONE_COLOR(tracy::Color::Orange); + #ifdef USAGE_TRACKING + if(stat.objType == FSPerfStats::ObjType_t::OT_ATTACHMENT) + { + LL_PROFILE_PLOT_CONFIG_SQUARE("InUse"); + LL_PROFILE_PLOT_CONFIG_SQUARE("InUseAttachment"); + LL_PROFILE_PLOT_CONFIG_SQUARE("InUseAttachmentRigged"); + LL_PROFILE_PLOT_CONFIG_SQUARE("InUseAttachmentUnRigged"); + + if(!stat.isRigged && FSPerfStats::inUseAvatar){LL_PROFILE_ZONE_TEXT("OVERLAP AVATAR",14);} + FSPerfStats::inUse++; + LL_PROFILE_PLOT("InUse", (int64_t)FSPerfStats::inUse); + FSPerfStats::inUseAttachment++; + LL_PROFILE_PLOT("InUseAttachment", (int64_t)FSPerfStats::inUseAttachment); + if (stat.isRigged) + { + FSPerfStats::inUseAttachmentRigged++; + LL_PROFILE_PLOT("InUseAttachmentRigged", (int64_t)FSPerfStats::inUseAttachmentRigged); + } + else + { + FSPerfStats::inUseAttachmentUnRigged++; + LL_PROFILE_PLOT("InUseAttachmentUnRigged", (int64_t)FSPerfStats::inUseAttachmentUnRigged); + } + } + #endif + // }; template < ObjType_t OD = ObjTypeDiscriminator, @@ -374,13 +444,31 @@ namespace LLPerfStats explicit RecordTime( StatType_t type ):RecordTime(LLUUID::null, LLUUID::null, type ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + // extra profiling coverage tracking + #ifdef USAGE_TRACKING + LLPerfStats::inUseScene++; + LL_PROFILE_PLOT("InUseScene", (int64_t)LLPerfStats::inUseScene); + LLPerfStats::inUse++; + LL_PROFILE_PLOT("InUse", (int64_t)LLPerfStats::inUse); + #endif + // }; template < ObjType_t OD = ObjTypeDiscriminator, std::enable_if_t * = nullptr> RecordTime( const LLUUID & av, StatType_t type ):RecordTime(std::move(av), LLUUID::null, type) { - //LL_PROFILE_ZONE_COLOR(tracy::Color::Purple); + // extra profiling coverage tracking + // LL_PROFILE_ZONE_COLOR(tracy::Color::Purple) + LL_PROFILE_ZONE_COLOR(tracy::Color::Purple); + #ifdef USAGE_TRACKING + if(LLPerfStats::inUseAvatar){LL_PROFILE_ZONE_TEXT("OVERLAP AVATAR",14);} + FSPerfStats::inUseAvatar++; + LL_PROFILE_PLOT("InUseAv", (int64_t)LLPerfStats::inUseAvatar); + LLPerfStats::inUse++; + LL_PROFILE_PLOT("InUse", (int64_t)LLPerfStats::inUse); + #endif + // }; ~RecordTime() @@ -392,15 +480,60 @@ namespace LLPerfStats //LL_PROFILE_ZONE_COLOR(tracy::Color::Red); + // extra profiling coverage tracking + #ifdef USAGE_TRACKING + --FSPerfStats::inUse; + LL_PROFILE_PLOT("InUse", (int64_t)FSPerfStats::inUse); + if (stat.objType == FSPerfStats::ObjType_t::OT_ATTACHMENT) + { + --FSPerfStats::inUseAttachment; + LL_PROFILE_PLOT("InUseAttachment", (int64_t)FSPerfStats::inUseAttachment); + if (stat.isRigged) + { + --FSPerfStats::inUseAttachmentRigged; + LL_PROFILE_PLOT("InUseAttachmentRigged", (int64_t)FSPerfStats::inUseAttachmentRigged); + } + else + { + --FSPerfStats::inUseAttachmentUnRigged; + LL_PROFILE_PLOT("InUseAttachmentUnRigged", (int64_t)FSPerfStats::inUseAttachmentUnRigged); + } + } + if (stat.objType == FSPerfStats::ObjType_t::OT_GENERAL) + { + --FSPerfStats::inUseScene; + LL_PROFILE_PLOT("InUseScene", (int64_t)FSPerfStats::inUseScene); + } + if( stat.objType == FSPerfStats::ObjType_t::OT_AVATAR ) + { + --FSPerfStats::inUseAvatar; + LL_PROFILE_PLOT("InUseAv", (int64_t)FSPerfStats::inUseAvatar); + } + #endif + // stat.time = LLTrace::BlockTimer::getCPUClockCount64() - start; + // extra profiling coverage tracking + #ifdef ATTACHMENT_TRACKING + static char obstr[36]; + static char avstr[36]; + LL_PROFILE_ZONE_NUM(static_cast(stat.objType)); + LL_PROFILE_ZONE_TEXT(stat.avID.toStringFast(avstr), 36); + LL_PROFILE_ZONE_TEXT(stat.objID.toStringFast(obstr), 36); + LL_PROFILE_ZONE_NUM(stat.time); + #endif + // StatsRecorder::send(std::move(stat)); }; }; - + // use thread safe/low overhead cpu frequency tracking (might need to add refresh to this) + // inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + // inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + // inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; - inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; - inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; - inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / LLPerfStats::cpu_hertz; }; + inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / LLPerfStats::cpu_hertz; }; + inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / LLPerfStats::cpu_hertz; }; + // using RecordSceneTime = RecordTime; using RecordAvatarTime = RecordTime; @@ -435,6 +568,20 @@ static inline void trackAttachments(const T * vobj, bool isRigged, RATptr* ratPt auto& obj = rootAtt->getAttachmentItemID(); if (!*ratPtrp || (*ratPtrp)->stat.objID != obj || (*ratPtrp)->stat.avID != av) { + // extra profiling coverage tracking + #if TRACY_ENABLE && defined(ATTACHMENT_TRACKING) + LL_PROFILE_ZONE_NAMED_COLOR( "trackAttachments:new", tracy::Color::Red); + auto& str = rootAtt->getAttachmentItemName(); + LL_PROFILE_ZONE_TEXT(str.c_str(), str.size()); + LL_PROFILE_ZONE_TEXT(isRigged ? "Rigged" : "Unrigged", 8); + static char avStr[36]; + av.toStringFast(avStr); + static char obStr[4]; + obj.toShortString(obStr); + LL_PROFILE_ZONE_TEXT( avStr, 36); + LL_PROFILE_ZONE_TEXT( obStr, 4); + #endif + // if (*ratPtrp) { // deliberately reset to ensure destruction before construction of replacement. diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 800b5b34db..1d21442d89 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -42,7 +42,7 @@ #include "llagentcamera.h" #include "llfile.h" #include "quickprefs.h" -#include "fsperfstats.h" // avoid triggering reloads while autotuning +#include "llperfstats.h" LLPresetsManager::LLPresetsManager() // Graphic preset controls independent from XUI @@ -723,7 +723,7 @@ void LLPresetsManager::handleGraphicPresetControlChanged(LLControlVariablePtr co if (!mIsLoadingPreset && (!mIsDrawDistanceSteppingActive || control->getName() != "RenderFarClip") && - (!FSPerfStats::tunables.userAutoTuneEnabled) ) + (!LLPerfStats::tunables.userAutoTuneEnabled) ) { LL_DEBUGS() << "Trigger graphic preset control changed signal" << LL_ENDL; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c2b7990397..1d5fce225c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -212,7 +212,6 @@ #include "llenvironment.h" #include "llstacktrace.h" -#include "fsperfstats.h" #include "threadpool.h" #include "llperfstats.h" @@ -4388,10 +4387,6 @@ bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y // unpack login data needed by the application text = response["agent_id"].asString(); if(!text.empty()) gAgentID.set(text); - // Performance floater initialisation - FSPerfStats::StatsRecorder::setEnabled(gSavedSettings.getBOOL("FSPerfStatsCaptureEnabled")); - FSPerfStats::StatsRecorder::setFocusAv(gAgentID); - // // gDebugInfo["AgentID"] = text; // [SL:KB] - Patch: Viewer-CrashReporting | Checked: 2010-11-16 (Catznip-2.6.0a) | Added: Catznip-2.4.0b if (gCrashSettings.getBOOL("CrashSubmitName")) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 355d387e26..af81265a6a 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -108,7 +108,7 @@ #include "llfloaterpathfindingconsole.h" #include "llfloaterpathfindinglinksets.h" #include "llfloaterpay.h" -// #include "llfloaterperformance.h" rename to fs as ll version no released +// #include "llfloaterperformance.h" restore fsperf floater #include "fsfloaterperformance.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" @@ -395,6 +395,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); //LLFloaterReg::add("performance", "floater_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("performance", "floater_performance_fs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -514,7 +515,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("media_lists", "floater_media_lists.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("money_tracker", "floater_fs_money_tracker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("particle_editor","floater_particle_editor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("performance", "floater_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + // LLFloaterReg::add("performance", "floater_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); // restore perf floater + LLFloaterReg::add("performance", "floater_performance_fs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add(PHOTOTOOLS_FLOATER, "floater_phototools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("phototools_camera", "floater_phototools_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("quickprefs", "floater_quickprefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); From 72b1cfc76b6deda8771935b086f040b887ffe804 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 9 Nov 2022 14:42:27 +0200 Subject: [PATCH 42/99] SL-18586 FIXED Crash when opening 360 snapshot --- doc/contributions.txt | 1 + indra/newview/llfloater360capture.cpp | 11 +---------- indra/newview/llperfstats.cpp | 6 +++++- indra/newview/llperfstats.h | 8 +++++--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index b0d54b23c9..14cf503df2 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -283,6 +283,7 @@ Beq Janus SL-15709 SL-16021 SL-18202 + SL-18586 Beth Walcher Bezilon Kasei Biancaluce Robbiani diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index c075f7e8bd..a70cd903c5 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -319,13 +319,7 @@ const std::string LLFloater360Capture::getHTMLBaseFolder() // triggered when the 'capture' button in the UI is pressed void LLFloater360Capture::onCapture360ImagesBtn() { - // launch the main capture code in a coroutine so we can - // yield/suspend at some points to give the main UI - // thread a look-in occasionally. - LLCoros::instance().launch("capture360cap", [this]() - { - capture360Images(); - }); + capture360Images(); } // Gets the full path name for a given JavaScript file in the HTML folder. We @@ -680,9 +674,6 @@ void LLFloater360Capture::capture360Images() mCaptureBtn->setEnabled(true); mSaveLocalBtn->setEnabled(true); - // allow the UI to update by suspending and waiting for the - // main render loop to update the UI - suspendForAFrame(); } // once the request is made to navigate to the web page containing the code diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index 1a0e5842e2..3bf88bb2a6 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -43,6 +43,8 @@ namespace LLPerfStats U32 lastGlobalPrefChange{0}; std::mutex bufferToggleLock{}; + F64 cpu_hertz{0.0}; + Tunables tunables; std::atomic StatsRecorder::writeBuffer{0}; @@ -126,6 +128,8 @@ namespace LLPerfStats // create a queue // create a thread to consume from the queue tunables.initialiseFromSettings(); + LLPerfStats::cpu_hertz = (F64)LLTrace::BlockTimer::countsPerSecond(); + t.detach(); } @@ -332,7 +336,7 @@ namespace LLPerfStats } // The frametime budget we have based on the target FPS selected - auto target_frame_time_raw = (U64)llround((F64)LLTrace::BlockTimer::countsPerSecond()/(tunables.userTargetFPS==0?1:tunables.userTargetFPS)); + auto target_frame_time_raw = (U64)llround(LLPerfStats::cpu_hertz/(tunables.userTargetFPS==0?1:tunables.userTargetFPS)); // LL_INFOS() << "Effective FPS(raw):" << tot_frame_time_raw << " Target:" << target_frame_time_raw << LL_ENDL; auto inferredFPS{1000/(U32)std::max(raw_to_ms(tot_frame_time_raw),1.0)}; U32 settingsChangeFrequency{inferredFPS > 25?inferredFPS:25}; diff --git a/indra/newview/llperfstats.h b/indra/newview/llperfstats.h index 961594f18c..ac44afe5db 100644 --- a/indra/newview/llperfstats.h +++ b/indra/newview/llperfstats.h @@ -55,6 +55,8 @@ namespace LLPerfStats static constexpr U32 TUNE_AVATARS_ONLY{0}; static constexpr U32 TUNE_SCENE_AND_AVATARS{1}; + extern F64 cpu_hertz; + extern std::atomic tunedAvatars; extern std::atomic renderAvatarMaxART_ns; extern bool belowTargetFPS; @@ -398,9 +400,9 @@ namespace LLPerfStats }; - inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; - inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; - inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / (F64)LLTrace::BlockTimer::countsPerSecond(); }; + inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / LLPerfStats::cpu_hertz; }; + inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / LLPerfStats::cpu_hertz; }; + inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / LLPerfStats::cpu_hertz; }; using RecordSceneTime = RecordTime; using RecordAvatarTime = RecordTime; From 69f4ef7cd4e44c2c7d8a1a19ea43e612fc04bcb8 Mon Sep 17 00:00:00 2001 From: Beq Date: Fri, 11 Nov 2022 16:25:53 +0000 Subject: [PATCH 43/99] A few more fixes. --- indra/newview/llappviewer.cpp | 1 - indra/newview/llfloaterpreference.cpp | 22 +- .../xui/en/panel_preferences_graphics1.xml | 271 +----------------- 3 files changed, 12 insertions(+), 282 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 45ea0da8ed..cf3abaee37 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1710,7 +1710,6 @@ bool LLAppViewer::doFrame() llcoro::suspend(); } } - }// ensure we have the entire top scope of frame covered (close input event and coro "idle") if (!LLApp::isExiting()) { diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index fbf2f91ae7..eb93eb6d9a 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -167,8 +167,6 @@ #endif // -#include "fsperfstats.h"// perfstats - // FIRE-19539 - Include the alert messages in Prefs>Notifications>Alerts in preference Search. #include "llfiltereditor.h" #include "llviewershadermgr.h" @@ -470,7 +468,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) // mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); mCommitCallbackRegistrar.add("Pref.RenderExceptions", boost::bind(&LLFloaterPreference::onClickRenderExceptions, this)); - mCommitCallbackRegistrar.add("Pref.AutoAdjustments", boost::bind(&LLFloaterPreference::onClickAutoAdjustments, this)); + // mCommitCallbackRegistrar.add("Pref.AutoAdjustments", boost::bind(&LLFloaterPreference::onClickAutoAdjustments, this)); // Not required in FS at present mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this)); mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, this)); @@ -3027,14 +3025,16 @@ void LLFloaterPreference::onClickRenderExceptions() LLFloaterReg::showInstance("avatar_render_settings"); } -void LLFloaterPreference::onClickAutoAdjustments() -{ - LLFloaterPerformance* performance_floater = LLFloaterReg::showTypedInstance("performance"); - if (performance_floater) - { - performance_floater->showAutoadjustmentsPanel(); - } -} +// Not currently used in FS +// void LLFloaterPreference::onClickAutoAdjustments() +// { +// LLFloaterPerformance* performance_floater = LLFloaterReg::showTypedInstance("performance"); +// if (performance_floater) +// { +// performance_floater->showAutoadjustmentsPanel(); +// } +// } +// void LLFloaterPreference::onClickAdvanced() { diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index d2a4c2f5fd..6b5068bcb6 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -30,197 +30,6 @@ follows="all" label="General" name="General" > - - Preset in use: - - - - (None) - - - - Quality & speed: - - - Low - - - Mid - - - High - - - Ultra - - - Faster - - - Better - - - - - - - - - - - - - - - - m - - - - - - - - 0 - - -[https://community.secondlife.com/t5/Featured-News/Why-are-all-these-people-made-of-colored-jelly/ba-p/3031255 What's this?] - - Date: Fri, 11 Nov 2022 23:26:07 +0100 Subject: [PATCH 44/99] Cleanup orphaned files --- indra/newview/app_settings/toolbars.xml | 30 -- indra/newview/fsperfstats.cpp | 483 -------------------- indra/newview/fsperfstats.h | 561 ------------------------ 3 files changed, 1074 deletions(-) delete mode 100644 indra/newview/app_settings/toolbars.xml delete mode 100644 indra/newview/fsperfstats.cpp delete mode 100644 indra/newview/fsperfstats.h diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml deleted file mode 100644 index a1c9d6d9ee..0000000000 --- a/indra/newview/app_settings/toolbars.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/fsperfstats.cpp b/indra/newview/fsperfstats.cpp deleted file mode 100644 index 9b283feb00..0000000000 --- a/indra/newview/fsperfstats.cpp +++ /dev/null @@ -1,483 +0,0 @@ -/** - * @file fsperfstats.cpp - * @brief Stats collection to support perf floater and auto tune - * - * $LicenseInfo:firstyear=2021&license=fsviewerlgpl$ - * Phoenix Firestorm Viewer Source Code - * Copyright (C) 2021, The Phoenix Firestorm Project, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA - * http://www.firestormviewer.org - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "fsperfstats.h" -#include "llcontrol.h" -#include "pipeline.h" -#include "llagentcamera.h" -#include "llvoavatar.h" -#include "llworld.h" -#include - -extern LLControlGroup gSavedSettings; - -namespace FSPerfStats -{ - #ifdef USAGE_TRACKING - std::atomic inUse{0}; - std::atomic inUseAvatar{0}; - std::atomic inUseScene{0}; - std::atomic inUseAttachment{0}; - std::atomic inUseAttachmentRigged{0}; - std::atomic inUseAttachmentUnRigged{0}; -#endif - - std::atomic tunedAvatars{0}; - std::atomic renderAvatarMaxART_ns{(U64)(ART_UNLIMITED_NANOS)}; // highest render time we'll allow without culling features - bool belowTargetFPS{false}; - U32 lastGlobalPrefChange{0}; - std::mutex bufferToggleLock{}; - - F64 cpu_hertz{0.0}; - - Tunables tunables; - - std::atomic StatsRecorder::writeBuffer{0}; - bool StatsRecorder::collectionEnabled{true}; - LLUUID StatsRecorder::focusAv{LLUUID::null}; - std::array StatsRecorder::statsDoubleBuffer{ {} }; - std::array StatsRecorder::max{ {} }; - std::array StatsRecorder::sum{ {} }; - - void Tunables::applyUpdates() - { - assert_main_thread(); - // these following variables are proxies for pipeline statics we do not need a two way update (no llviewercontrol handler) - if( tuningFlag & NonImpostors ){ gSavedSettings.setU32("IndirectMaxNonImpostors", nonImpostors); }; - if( tuningFlag & ReflectionDetail ){ gSavedSettings.setS32("RenderReflectionDetail", reflectionDetail); }; - if( tuningFlag & FarClip ){ gSavedSettings.setF32("RenderFarClip", farClip); }; - if( tuningFlag & UserMinDrawDistance ){ gSavedSettings.setF32("FSAutoTuneRenderFarClipMin", userMinDrawDistance); }; - if( tuningFlag & UserTargetDrawDistance ){ gSavedSettings.setF32("FSAutoTuneRenderFarClipTarget", userTargetDrawDistance); }; - if( tuningFlag & UserImpostorDistance ){ gSavedSettings.setF32("FSAutoTuneImpostorFarAwayDistance", userImpostorDistance); }; - if( tuningFlag & UserImpostorDistanceTuningEnabled ){ gSavedSettings.setBOOL("FSAutoTuneImpostorByDistEnabled", userImpostorDistanceTuningEnabled); }; - if( tuningFlag & UserFPSTuningStrategy ){ gSavedSettings.setU32("FSTuningFPSStrategy", userFPSTuningStrategy); }; - if( tuningFlag & UserAutoTuneEnabled ){ gSavedSettings.setBOOL("FSAutoTuneFPS", userAutoTuneEnabled); }; - if( tuningFlag & UserAutoTuneLock ){ gSavedSettings.setBOOL("FSAutoTuneLock", userAutoTuneLock); }; - if( tuningFlag & UserTargetFPS ){ gSavedSettings.setU32("FSTargetFPS", userTargetFPS); }; - if( tuningFlag & UserTargetReflections ){ gSavedSettings.setS32("FSUserTargetReflections", userTargetReflections); }; - // Note: The Max ART slider is logarithmic and thus we have an intermediate proxy value - if( tuningFlag & UserARTCutoff ){ gSavedSettings.setF32("FSRenderAvatarMaxART", userARTCutoffSliderValue); }; - resetChanges(); - } - - void Tunables::updateRenderCostLimitFromSettings() - { - assert_main_thread(); - const auto newval = gSavedSettings.getF32("FSRenderAvatarMaxART"); - if(newval < log10(FSPerfStats::ART_UNLIMITED_NANOS/1000)) - { - FSPerfStats::renderAvatarMaxART_ns = pow(10,newval)*1000; - } - else - { - FSPerfStats::renderAvatarMaxART_ns = 0; - }; - } - - // static - void Tunables::updateSettingsFromRenderCostLimit() - { - if( userARTCutoffSliderValue != log10( ( (F32)FSPerfStats::renderAvatarMaxART_ns )/1000 ) ) - { - if( FSPerfStats::renderAvatarMaxART_ns != 0 ) - { - updateUserARTCutoffSlider(log10( ( (F32)FSPerfStats::renderAvatarMaxART_ns )/1000 ) ); - } - else - { - updateUserARTCutoffSlider(log10( (F32)FSPerfStats::ART_UNLIMITED_NANOS/1000 ) ); - } - } - } - - void Tunables::initialiseFromSettings() - { - assert_main_thread(); - // the following variables are two way and have "push" in llviewercontrol - FSPerfStats::tunables.userMinDrawDistance = gSavedSettings.getF32("FSAutoTuneRenderFarClipMin"); - FSPerfStats::tunables.userTargetDrawDistance = gSavedSettings.getF32("FSAutoTuneRenderFarClipTarget"); - FSPerfStats::tunables.userImpostorDistance = gSavedSettings.getF32("FSAutoTuneImpostorFarAwayDistance"); - FSPerfStats::tunables.userImpostorDistanceTuningEnabled = gSavedSettings.getBOOL("FSAutoTuneImpostorByDistEnabled"); - FSPerfStats::tunables.userFPSTuningStrategy = gSavedSettings.getU32("FSTuningFPSStrategy"); - FSPerfStats::tunables.userTargetFPS = gSavedSettings.getU32("FSTargetFPS"); - FSPerfStats::tunables.userTargetReflections = gSavedSettings.getS32("FSUserTargetReflections"); - FSPerfStats::tunables.userAutoTuneEnabled = gSavedSettings.getBOOL("FSAutoTuneFPS"); - FSPerfStats::tunables.userAutoTuneLock = gSavedSettings.getBOOL("FSAutoTuneLock"); - // Note: The Max ART slider is logarithmic and thus we have an intermediate proxy value - updateRenderCostLimitFromSettings(); - resetChanges(); - } - - StatsRecorder::StatsRecorder():q(1024*16),t(&StatsRecorder::run) - { - // create a queue - // create a thread to consume from the queue - tunables.initialiseFromSettings(); - FSPerfStats::cpu_hertz = (F64)LLTrace::BlockTimer::countsPerSecond(); - - t.detach(); - } - - // static - void StatsRecorder::toggleBuffer() - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - using ST = StatType_t; - - bool unreliable{false}; - FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FRAME); - auto& sceneStats = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null]; - auto& lastStats = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null]; - - static constexpr std::initializer_list sceneStatsToAvg = { - StatType_t::RENDER_FRAME, - StatType_t::RENDER_DISPLAY, - StatType_t::RENDER_HUDS, - StatType_t::RENDER_UI, - StatType_t::RENDER_SWAP, - // RENDER_LFS, - // RENDER_MESHREPO, - StatType_t::RENDER_IDLE }; - - static constexpr std::initializer_list avatarStatsToAvg = { - StatType_t::RENDER_GEOMETRY, - StatType_t::RENDER_SHADOWS, - StatType_t::RENDER_COMBINED, - StatType_t::RENDER_IDLE }; - - - if( sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)] != 0 || sceneStats[static_cast(StatType_t::RENDER_SLEEP)] != 0 ) - { - unreliable = true; - lastStats[static_cast(StatType_t::RENDER_FPSLIMIT)] = sceneStats[static_cast(StatType_t::RENDER_FPSLIMIT)]; - lastStats[static_cast(StatType_t::RENDER_SLEEP)] = sceneStats[static_cast(StatType_t::RENDER_SLEEP)]; - lastStats[static_cast(StatType_t::RENDER_FRAME)] = sceneStats[static_cast(StatType_t::RENDER_FRAME)]; // bring over the total frame render time to deal with region crossing overlap issues - } - - if(!unreliable) - { - // only use these stats when things are reliable. - - for(auto & statEntry : sceneStatsToAvg) - { - auto avg = lastStats[static_cast(statEntry)]; - auto val = sceneStats[static_cast(statEntry)]; - sceneStats[static_cast(statEntry)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); - // LL_INFOS("scenestats") << "Scenestat: " << static_cast(statEntry) << " before=" << avg << " new=" << val << " newavg=" << statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null][static_cast(statEntry)] << LL_ENDL; - } - } -// Allow attachment times etc to update even when FPS limited or sleeping. - auto& statsMap = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_ATTACHMENT)]; - for(auto& stat_entry : statsMap) - { - auto val = stat_entry.second[static_cast(ST::RENDER_COMBINED)]; - if(val > SMOOTHING_PERIODS){ - auto avg = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_ATTACHMENT)][stat_entry.first][static_cast(ST::RENDER_COMBINED)]; - stat_entry.second[static_cast(ST::RENDER_COMBINED)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); - } - } - - - auto& statsMapAv = statsDoubleBuffer[writeBuffer][static_cast(ObjType_t::OT_AVATAR)]; - for(auto& stat_entry : statsMapAv) - { - for(auto& stat : avatarStatsToAvg) - { - auto val = stat_entry.second[static_cast(stat)]; - if(val > SMOOTHING_PERIODS) - { - auto avg = statsDoubleBuffer[writeBuffer ^ 1][static_cast(ObjType_t::OT_AVATAR)][stat_entry.first][static_cast(stat)]; - stat_entry.second[static_cast(stat)] = avg + (val / SMOOTHING_PERIODS) - (avg / SMOOTHING_PERIODS); - } - } - } - - // swap the buffers - if(enabled()) - { - std::lock_guard lock{bufferToggleLock}; - writeBuffer ^= 1; - }; // note we are relying on atomic updates here. The risk is low and would cause minor errors in the stats display. - - // clean the write maps in all cases. - auto& statsTypeMatrix = statsDoubleBuffer[writeBuffer]; - for(auto& statsMapByType : statsTypeMatrix) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("Clear stats maps"); - for(auto& stat_entry : statsMapByType) - { - std::fill_n(stat_entry.second.begin() ,static_cast(ST::STATS_COUNT),0); - } - statsMapByType.clear(); - } - for(int i=0; i< static_cast(ObjType_t::OT_COUNT); i++) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("clear max/sum"); - max[writeBuffer][i].fill(0); - sum[writeBuffer][i].fill(0); - } - - // and now adjust the proxy vars so that the main thread can adjust the visuals. - if(tunables.userAutoTuneEnabled) - { - updateAvatarParams(); - } - } - - // clear buffers when we change region or need a hard reset. - // static - void StatsRecorder::clearStatsBuffers() - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - using ST = StatType_t; - - auto& statsTypeMatrix = statsDoubleBuffer[writeBuffer]; - for(auto& statsMap : statsTypeMatrix) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("Clear stats maps"); - for(auto& stat_entry : statsMap) - { - std::fill_n(stat_entry.second.begin() ,static_cast(ST::STATS_COUNT),0); - } - statsMap.clear(); - } - for(int i=0; i< static_cast(ObjType_t::OT_COUNT); i++) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("clear max/sum"); - max[writeBuffer][i].fill(0); - sum[writeBuffer][i].fill(0); - } - // swap the clean buffers in - if(enabled()) - { - std::lock_guard lock{bufferToggleLock}; - writeBuffer ^= 1; - }; - // repeat before we start processing new stuff - for(auto& statsMap : statsTypeMatrix) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("Clear stats maps"); - for(auto& stat_entry : statsMap) - { - std::fill_n(stat_entry.second.begin() ,static_cast(ST::STATS_COUNT),0); - } - statsMap.clear(); - } - for(int i=0; i< static_cast(ObjType_t::OT_COUNT); i++) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_STATS("clear max/sum"); - max[writeBuffer][i].fill(0); - sum[writeBuffer][i].fill(0); - } - } - - //static - int StatsRecorder::countNearbyAvatars(S32 distance) - { - const auto our_pos = gAgentCamera.getCameraPositionGlobal(); - - std::vector positions; - uuid_vec_t avatar_ids; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance); - return positions.size(); - } - - // static - void StatsRecorder::updateAvatarParams() - { - - if(tunables.userImpostorDistanceTuningEnabled) - { - // if we have less than the user's "max Non-Impostors" avatars within the desired range then adjust the limit. - // also adjusts back up again for nearby crowds. - auto count = countNearbyAvatars(std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance)); - if( count != tunables.nonImpostors ) - { - tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER ); - LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; - } - } - - auto av_render_max_raw = FSPerfStats::StatsRecorder::getMax(ObjType_t::OT_AVATAR, FSPerfStats::StatType_t::RENDER_COMBINED); - // Is our target frame time lower than current? If so we need to take action to reduce draw overheads. - // cumulative avatar time (includes idle processing, attachments and base av) - auto tot_avatar_time_raw = FSPerfStats::StatsRecorder::getSum(ObjType_t::OT_AVATAR, FSPerfStats::StatType_t::RENDER_COMBINED); - // sleep time is basically forced sleep when window out of focus - auto tot_sleep_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_SLEEP); - // similar to sleep time, induced by FPS limit - auto tot_limit_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FPSLIMIT); - - - // the time spent this frame on the "doFrame" call. Treated as "tot time for frame" - auto tot_frame_time_raw = FSPerfStats::StatsRecorder::getSceneStat(FSPerfStats::StatType_t::RENDER_FRAME); - - if( tot_sleep_time_raw != 0 ) - { - // Note: we do not average sleep - // if at some point we need to, the averaging will need to take this into account or - // we forever think we're in the background due to residuals. - LL_DEBUGS() << "No tuning when not in focus" << LL_ENDL; - return; - } - - // The frametime budget we have based on the target FPS selected - auto target_frame_time_raw = (U64)llround(FSPerfStats::cpu_hertz/(tunables.userTargetFPS==0?1:tunables.userTargetFPS)); - // LL_INFOS() << "Effective FPS(raw):" << tot_frame_time_raw << " Target:" << target_frame_time_raw << LL_ENDL; - auto inferredFPS{1000/(U32)std::max(raw_to_ms(tot_frame_time_raw),1.0)}; - U32 settingsChangeFrequency{inferredFPS > 25?inferredFPS:25}; - if( tot_limit_time_raw != 0) - { - // This could be problematic. - tot_frame_time_raw -= tot_limit_time_raw; - } - // 1) Is the target frame time lower than current? - if( target_frame_time_raw <= tot_frame_time_raw ) - { - if(belowTargetFPS == false) - { - // this is the first frame under. hold fire to add a little hysteresis - belowTargetFPS = true; - FSPerfStats::lastGlobalPrefChange = gFrameCount; - } - // if so we've got work to do - - // how much of the frame was spent on non avatar related work? - U64 non_avatar_time_raw = tot_frame_time_raw - tot_avatar_time_raw; - - // If the target frame time < scene time (estimated as non_avatar time) - U64 target_avatar_time_raw; - if(target_frame_time_raw < non_avatar_time_raw) - { - // we cannnot do this by avatar adjustment alone. - if((gFrameCount - FSPerfStats::lastGlobalPrefChange) > settingsChangeFrequency) // give changes a short time to take effect. - { - if(tunables.userFPSTuningStrategy == TUNE_SCENE_AND_AVATARS) - { - // 1 - hack the water to opaque. all non opaque have a significant hit, this is a big boost for (arguably) a minor visual hit. - // the other reflection options make comparatively little change and if this overshoots we'll be stepping back up later - if(LLPipeline::RenderReflectionDetail != -2) - { - FSPerfStats::tunables.updateReflectionDetail(-2); - FSPerfStats::lastGlobalPrefChange = gFrameCount; - return; - } - else // deliberately "else" here so we only do one of these in any given frame - { - // step down the DD by 10m per update - auto new_dd = (LLPipeline::RenderFarClip - DD_STEP > tunables.userMinDrawDistance)?(LLPipeline::RenderFarClip - DD_STEP) : tunables.userMinDrawDistance; - if(new_dd != LLPipeline::RenderFarClip) - { - FSPerfStats::tunables.updateFarClip( new_dd ); - FSPerfStats::lastGlobalPrefChange = gFrameCount; - return; - } - } - } - // if we reach here, we've no more changes to make to tune scenery so we'll resort to agressive Avatar tuning - // Note: moved from outside "if changefrequency elapsed" to stop fallthrough and allow scenery changes time to take effect. - target_avatar_time_raw = 0; - } - else - { - // we made a settings change recently so let's give it time. - return; - } - } - else - { - // set desired avatar budget. - target_avatar_time_raw = target_frame_time_raw - non_avatar_time_raw; - } - - if( target_avatar_time_raw < tot_avatar_time_raw ) - { - // we need to spend less time drawing avatars to meet our budget - auto new_render_limit_ns {FSPerfStats::raw_to_ns(av_render_max_raw)}; - // max render this frame may be higher than the last (cos new entrants and jitter) so make sure we are heading in the right direction - if( new_render_limit_ns > renderAvatarMaxART_ns ) - { - new_render_limit_ns = renderAvatarMaxART_ns; - } - new_render_limit_ns -= FSPerfStats::ART_MIN_ADJUST_DOWN_NANOS; - - // bounce at the bottom to prevent "no limit" - new_render_limit_ns = std::max((U64)new_render_limit_ns, (U64)FSPerfStats::ART_MINIMUM_NANOS); - - // assign the new value - if(renderAvatarMaxART_ns != new_render_limit_ns) - { - renderAvatarMaxART_ns = new_render_limit_ns; - tunables.updateSettingsFromRenderCostLimit(); - } - // LL_DEBUGS() << "AUTO_TUNE: avatar_budget adjusted to:" << new_render_limit_ns << LL_ENDL; - } - // LL_DEBUGS() << "AUTO_TUNE: Target frame time:"<< FSPerfStats::raw_to_us(target_frame_time_raw) << "usecs (non_avatar is " << FSPerfStats::raw_to_us(non_avatar_time_raw) << "usecs) Max cost limited=" << renderAvatarMaxART_ns << LL_ENDL; - } - else if( FSPerfStats::raw_to_ns(target_frame_time_raw) > (FSPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns) ) - { - if(belowTargetFPS == true) - { - // we reached target, force a pause - lastGlobalPrefChange = gFrameCount; - belowTargetFPS = false; - } - - // once we're over the FPS target we slow down further - if((gFrameCount - lastGlobalPrefChange) > settingsChangeFrequency*3) - { - if(!tunables.userAutoTuneLock) - { - // we've reached the target and stayed long enough to consider stable. - // turn off if we are not locked. - tunables.updateUserAutoTuneEnabled(false); - } - if( FSPerfStats::tunedAvatars > 0 ) - { - // if we have more time to spare let's shift up little in the hope we'll restore an avatar. - renderAvatarMaxART_ns += FSPerfStats::ART_MIN_ADJUST_UP_NANOS; - tunables.updateSettingsFromRenderCostLimit(); - return; - } - if(tunables.userFPSTuningStrategy == TUNE_SCENE_AND_AVATARS) - { - if( LLPipeline::RenderFarClip < tunables.userTargetDrawDistance ) - { - FSPerfStats::tunables.updateFarClip( std::min(LLPipeline::RenderFarClip + DD_STEP, tunables.userTargetDrawDistance) ); - FSPerfStats::lastGlobalPrefChange = gFrameCount; - return; - } - if( (tot_frame_time_raw * 1.5) < target_frame_time_raw ) - { - // if everything else is "max" and we have >50% headroom let's knock the water quality up a notch at a time. - FSPerfStats::tunables.updateReflectionDetail( std::min(LLPipeline::RenderReflectionDetail + 1, tunables.userTargetReflections) ); - } - } - } - } - } -} \ No newline at end of file diff --git a/indra/newview/fsperfstats.h b/indra/newview/fsperfstats.h deleted file mode 100644 index 2e610d08c0..0000000000 --- a/indra/newview/fsperfstats.h +++ /dev/null @@ -1,561 +0,0 @@ -#pragma once -#ifndef FS_PERFSTATS_H_INCLUDED -#define FS_PERFSTATS_H_INCLUDED -/** - * @file fsperfstats.h - * @brief Statistics collection to support autotune and perf flaoter. - * - * $LicenseInfo:firstyear=2021&license=fsviewerlgpl$ - * Phoenix Firestorm Viewer Source Code - * Copyright (C) 2021, The Phoenix Firestorm Project, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA - * http://www.firestormviewer.org - * $/LicenseInfo$ - */ - -#include -#include -#include -#include -#include -#include "lluuid.h" -#include "llfasttimer.h" -#include "blockingconcurrentqueue.h" -#include "llapp.h" -#include "llprofiler.h" -#include "pipeline.h" - -// Additional logging options. These can skew inworld numbers so onyl use for debugging and tracking issues -#ifdef TRACY_ENABLE -// USAGE_TRACKING - displays overlapping stats that may imply double counting. -// ATTACHMENT_TRACKING - displays detailed tracking info for Avatar and Attachment. very heavy overhead. -// #define USAGE_TRACKING -#define ATTACHMENT_TRACKING -#else -#undef USAGE_TRACKING -#undef ATTACHMENT_TRACKING -#endif - -extern U32 gFrameCount; -extern LLUUID gAgentID; -namespace FSPerfStats -{ -#ifdef USAGE_TRACKING - extern std::atomic inUse; - extern std::atomic inUseAvatar; - extern std::atomic inUseScene; - extern std::atomic inUseAttachment; - extern std::atomic inUseAttachmentRigged; - extern std::atomic inUseAttachmentUnRigged; -#endif -// Note if changing these, they should correspond with the log range of the correpsonding sliders - static constexpr U64 ART_UNLIMITED_NANOS{50000000}; - static constexpr U64 ART_MINIMUM_NANOS{100000}; - static constexpr U64 ART_MIN_ADJUST_UP_NANOS{10000}; - static constexpr U64 ART_MIN_ADJUST_DOWN_NANOS{10000}; - - static constexpr F32 PREFERRED_DD{180}; - static constexpr U32 SMOOTHING_PERIODS{50}; - static constexpr U32 DD_STEP{10}; - - static constexpr U32 TUNE_AVATARS_ONLY{0}; - static constexpr U32 TUNE_SCENE_AND_AVATARS{1}; - - extern F64 cpu_hertz; - - extern std::atomic tunedAvatars; - extern std::atomic renderAvatarMaxART_ns; - extern bool belowTargetFPS; - extern U32 lastGlobalPrefChange; - extern std::mutex bufferToggleLock; - - enum class ObjType_t{ - OT_GENERAL=0, // Also Unknown. Used for n/a type stats such as scenery - OT_AVATAR, - OT_ATTACHMENT, - OT_HUD, - OT_COUNT - }; - enum class StatType_t{ - RENDER_GEOMETRY=0, - RENDER_SHADOWS, - RENDER_HUDS, - RENDER_UI, - RENDER_COMBINED, - RENDER_SWAP, - RENDER_FRAME, - RENDER_DISPLAY, - RENDER_SLEEP, - RENDER_LFS, - RENDER_MESHREPO, - RENDER_FPSLIMIT, - RENDER_FPS, - RENDER_IDLE, - RENDER_DONE, // toggle buffer & clearbuffer (see processUpdate for hackery) - STATS_COUNT - }; - - struct StatsRecord - { - StatType_t statType; - ObjType_t objType; - LLUUID avID; - LLUUID objID; - uint64_t time; - bool isRigged; - bool isHUD; - }; - - struct Tunables - { - static constexpr U32 Nothing{0}; - static constexpr U32 NonImpostors{1}; - static constexpr U32 ReflectionDetail{2}; - static constexpr U32 FarClip{4}; - static constexpr U32 UserMinDrawDistance{8}; - static constexpr U32 UserTargetDrawDistance{16}; - static constexpr U32 UserImpostorDistance{32}; - static constexpr U32 UserImpostorDistanceTuningEnabled{64}; - static constexpr U32 UserFPSTuningStrategy{128}; - static constexpr U32 UserAutoTuneEnabled{256}; - static constexpr U32 UserTargetFPS{512}; - static constexpr U32 UserARTCutoff{1024}; - static constexpr U32 UserTargetReflections{2048}; - static constexpr U32 UserAutoTuneLock{4096}; - - U32 tuningFlag{0}; // bit mask for changed settings - - // proxy variables, used to pas the new value to be set via the mainthread - U32 nonImpostors{0}; - S32 reflectionDetail{0}; - F32 farClip{0.0}; - F32 userMinDrawDistance{0.0}; - F32 userTargetDrawDistance{0.0}; - F32 userImpostorDistance{0.0}; - bool userImpostorDistanceTuningEnabled{false}; - U32 userFPSTuningStrategy{0}; - bool userAutoTuneEnabled{false}; - bool userAutoTuneLock{true}; - U32 userTargetFPS{0}; - F32 userARTCutoffSliderValue{0}; - S32 userTargetReflections{0}; - - void updateNonImposters(U32 nv){nonImpostors=nv; tuningFlag |= NonImpostors;}; - void updateReflectionDetail(S32 nv){reflectionDetail=nv; tuningFlag |= ReflectionDetail;}; - void updateFarClip(F32 nv){farClip=nv; tuningFlag |= FarClip;}; - void updateUserMinDrawDistance(F32 nv){userMinDrawDistance=nv; tuningFlag |= UserMinDrawDistance;}; - void updateUserTargetDrawDistance(F32 nv){userTargetDrawDistance=nv; tuningFlag |= UserTargetDrawDistance;}; - void updateImposterDistance(F32 nv){userImpostorDistance=nv; tuningFlag |= UserImpostorDistance;}; - void updateImposterDistanceTuningEnabled(bool nv){userImpostorDistanceTuningEnabled=nv; tuningFlag |= UserImpostorDistanceTuningEnabled;}; - void updateUserFPSTuningStrategy(U32 nv){userFPSTuningStrategy=nv; tuningFlag |= UserFPSTuningStrategy;}; - void updateTargetFps(U32 nv){userTargetFPS=nv; tuningFlag |= UserTargetFPS;}; - void updateUserARTCutoffSlider(F32 nv){userARTCutoffSliderValue=nv; tuningFlag |= UserARTCutoff;}; - void updateUserAutoTuneEnabled(bool nv){userAutoTuneEnabled=nv; tuningFlag |= UserAutoTuneEnabled;}; - void updateUserAutoTuneLock(bool nv){userAutoTuneLock=nv; tuningFlag |= UserAutoTuneLock;}; - void updateUserTargetReflections(S32 nv){userTargetReflections=nv; tuningFlag |= UserTargetReflections;}; - - void resetChanges(){tuningFlag=Nothing;}; - void initialiseFromSettings(); - void updateRenderCostLimitFromSettings(); - void updateSettingsFromRenderCostLimit(); - void applyUpdates(); - }; - - extern Tunables tunables; - - class StatsRecorder{ - using Queue = moodycamel::BlockingConcurrentQueue; - public: - - static inline StatsRecorder& getInstance() - { - static StatsRecorder instance; - return instance; - } - static inline void setFocusAv(const LLUUID& avID){focusAv = avID;}; - static inline const LLUUID& getFocusAv(){return focusAv;}; - static inline void send(StatsRecord && upd){StatsRecorder::getInstance().q.enqueue(std::move(upd));}; - static void endFrame(){StatsRecorder::getInstance().q.enqueue(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 0});}; - static void clearStats(){StatsRecorder::getInstance().q.enqueue(StatsRecord{StatType_t::RENDER_DONE, ObjType_t::OT_GENERAL, LLUUID::null, LLUUID::null, 1});}; - - static inline void setEnabled(bool on_or_off){collectionEnabled=on_or_off;}; - static inline void enable() { collectionEnabled=true; }; - static inline void disable() { collectionEnabled=false; }; - static inline bool enabled() { return collectionEnabled; }; - - static inline int getReadBufferIndex() { return (writeBuffer ^ 1); }; - // static inline const StatsTypeMatrix& getCurrentStatsMatrix(){ return statsDoubleBuffer[getReadBufferIndex()];} - static inline uint64_t get(ObjType_t otype, LLUUID id, StatType_t type) - { - return statsDoubleBuffer[getReadBufferIndex()][static_cast(otype)][id][static_cast(type)]; - } - static inline uint64_t getSceneStat(StatType_t type) - { - return statsDoubleBuffer[getReadBufferIndex()][static_cast(ObjType_t::OT_GENERAL)][LLUUID::null][static_cast(type)]; - } - - static inline uint64_t getSum(ObjType_t otype, StatType_t type) - { - return sum[getReadBufferIndex()][static_cast(otype)][static_cast(type)]; - } - static inline uint64_t getMax(ObjType_t otype, StatType_t type) - { - return max[getReadBufferIndex()][static_cast(otype)][static_cast(type)]; - } - static void updateAvatarParams(); - private: - StatsRecorder(); - - static int countNearbyAvatars(S32 distance); -// StatsArray is a uint64_t for each possible statistic type. - using StatsArray = std::array(FSPerfStats::StatType_t::STATS_COUNT)>; - using StatsMap = std::unordered_map; - using StatsTypeMatrix = std::array(FSPerfStats::ObjType_t::OT_COUNT)>; - using StatsSummaryArray = std::array(FSPerfStats::ObjType_t::OT_COUNT)>; - - static std::atomic writeBuffer; - static LLUUID focusAv; - static std::array statsDoubleBuffer; - static std::array max; - static std::array sum; - static bool collectionEnabled; - - - void processUpdate(const StatsRecord& upd) const - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - // LL_INFOS("perfstats") << "processing update:" << LL_ENDL; - // Note: nullptr is used as the key for global stats - #ifdef TRACY_ENABLE - static char avstr[36]; - static char obstr[36]; - #endif - - if (upd.statType == StatType_t::RENDER_DONE && upd.objType == ObjType_t::OT_GENERAL && upd.time == 0) - { - // LL_INFOS("perfstats") << "End of Frame Toggle Buffer:" << gFrameCount << LL_ENDL; - toggleBuffer(); - return; - } - if (upd.statType == StatType_t::RENDER_DONE && upd.objType == ObjType_t::OT_GENERAL && upd.time == 1) - { - // LL_INFOS("perfstats") << "New region - clear buffers:" << gFrameCount << LL_ENDL; - clearStatsBuffers(); - return; - } - - auto ot{upd.objType}; - auto& key{upd.objID}; - auto& avKey{upd.avID}; - auto type {upd.statType}; - auto val {upd.time}; - - #ifdef TRACY_ENABLE - LL_PROFILE_ZONE_TEXT(key.toStringFast(obstr), 36); - LL_PROFILE_ZONE_TEXT(avKey.toStringFast(avstr), 36); - LL_PROFILE_ZONE_NUM(val); - #endif - - if (ot == ObjType_t::OT_GENERAL) - { - // LL_INFOS("perfstats") << "General update:" << LL_ENDL; - doUpd(key, ot, type,val); - return; - } - - if (ot == ObjType_t::OT_AVATAR) - { - // LL_INFOS("perfstats") << "Avatar update:" << LL_ENDL; - doUpd(avKey, ot, type, val); - return; - } - - if (ot == ObjType_t::OT_ATTACHMENT) - { - if( !upd.isHUD ) // don't include HUD cost in self. - { - LL_PROFILE_ZONE_NAMED("Att as Av") - // For all attachments that are not rigged we add them to the avatar (for all avatars) cost. - doUpd(avKey, ObjType_t::OT_AVATAR, type, val); - } - if( avKey == focusAv ) - { - LL_PROFILE_ZONE_NAMED("Att as Att") - // For attachments that are for the focusAv (self for now) we record them for the attachment/complexity view - if(upd.isHUD) - { - ot = ObjType_t::OT_HUD; - } - // LL_INFOS("perfstats") << "frame: " << gFrameCount << " Attachment update("<< (type==StatType_t::RENDER_GEOMETRY?"GEOMETRY":"SHADOW") << ": " << key.asString() << " = " << val << LL_ENDL; - doUpd(key, ot, type, val); - } - // else - // { - // // LL_INFOS("perfstats") << "frame: " << gFrameCount << " non-self Att update("<< (type==StatType_t::RENDER_GEOMETRY?"GEOMETRY":"SHADOW") << ": " << key.asString() << " = " << val << " for av " << avKey.asString() << LL_ENDL; - // } - } - } - - static inline void doUpd(const LLUUID& key, ObjType_t ot, StatType_t type, uint64_t val) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - using ST = StatType_t; - StatsMap& stm {statsDoubleBuffer[writeBuffer][static_cast(ot)]}; - auto& thisAsset = stm[key]; - - thisAsset[static_cast(type)] += val; - thisAsset[static_cast(ST::RENDER_COMBINED)] += val; - - sum[writeBuffer][static_cast(ot)][static_cast(type)] += val; - sum[writeBuffer][static_cast(ot)][static_cast(ST::RENDER_COMBINED)] += val; - - if(max[writeBuffer][static_cast(ot)][static_cast(type)] < thisAsset[static_cast(type)]) - { - max[writeBuffer][static_cast(ot)][static_cast(type)] = thisAsset[static_cast(type)]; - } - if(max[writeBuffer][static_cast(ot)][static_cast(ST::RENDER_COMBINED)] < thisAsset[static_cast(ST::RENDER_COMBINED)]) - { - max[writeBuffer][static_cast(ot)][static_cast(ST::RENDER_COMBINED)] = thisAsset[static_cast(ST::RENDER_COMBINED)]; - } - } - - static void toggleBuffer(); - static void clearStatsBuffers(); - - // thread entry - static void run() - { - StatsRecord upd[10]; - auto & instance {StatsRecorder::getInstance()}; - LL_PROFILER_SET_THREAD_NAME("PerfStats"); - - while( enabled() && !LLApp::isExiting() ) - { - auto count = instance.q.wait_dequeue_bulk_timed(upd, 10, std::chrono::milliseconds(10)); - LL_PROFILER_THREAD_BEGIN("PerfStats"); - if(count) - { - // LL_INFOS("perfstats") << "processing " << count << " updates." << LL_ENDL; - for(auto i =0; i < count; i++) - { - instance.processUpdate(upd[i]); - } - } - LL_PROFILER_THREAD_END("PerfStats"); - } - } - - Queue q; - std::thread t; - - ~StatsRecorder() = default; - StatsRecorder(const StatsRecorder&) = delete; - StatsRecorder& operator=(const StatsRecorder&) = delete; - - }; - - template - class RecordTime - { - - private: - RecordTime(const RecordTime&) = delete; - RecordTime() = delete; - U64 start; - public: - StatsRecord stat; - - RecordTime( const LLUUID& av, const LLUUID& id, StatType_t type, bool isRiggedAtt=false, bool isHUDAtt=false): - start{LLTrace::BlockTimer::getCPUClockCount64()}, - stat{type, ObjTypeDiscriminator, std::move(av), std::move(id), 0, isRiggedAtt, isHUDAtt} - { - LL_PROFILE_ZONE_COLOR(tracy::Color::Orange); - #ifdef USAGE_TRACKING - if(stat.objType == FSPerfStats::ObjType_t::OT_ATTACHMENT) - { - if(!stat.isRigged && FSPerfStats::inUseAvatar){LL_PROFILE_ZONE_TEXT("OVERLAP AVATAR",14);} - - LL_PROFILE_PLOT_SQ("InUse", (int64_t)FSPerfStats::inUse, (int64_t)FSPerfStats::inUse+1); - FSPerfStats::inUse++; - LL_PROFILE_PLOT_SQ("InUseAttachment", (int64_t)FSPerfStats::inUseAttachment, (int64_t)FSPerfStats::inUseAttachment+1); - FSPerfStats::inUseAttachment++; - if (stat.isRigged) - { - LL_PROFILE_PLOT_SQ("InUseAttachmentRigged", (int64_t)FSPerfStats::inUseAttachmentRigged,(int64_t)FSPerfStats::inUseAttachmentRigged+1); - FSPerfStats::inUseAttachmentRigged++; - } - else - { - LL_PROFILE_PLOT_SQ("InUseAttachmentUnRigged", (int64_t)FSPerfStats::inUseAttachmentUnRigged,(int64_t)FSPerfStats::inUseAttachmentUnRigged+1); - FSPerfStats::inUseAttachmentUnRigged++; - } - } - #endif - - }; - - template < ObjType_t OD = ObjTypeDiscriminator, - std::enable_if_t * = nullptr> - explicit RecordTime( StatType_t type ):RecordTime(LLUUID::null, LLUUID::null, type ) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - #ifdef USAGE_TRACKING - LL_PROFILE_PLOT_SQ("InUseScene", (int64_t)FSPerfStats::inUseScene, (int64_t)FSPerfStats::inUseScene+1); - FSPerfStats::inUseScene++; - LL_PROFILE_PLOT_SQ("InUse", (int64_t)FSPerfStats::inUse, (int64_t)FSPerfStats::inUse+1); - FSPerfStats::inUse++; - #endif - }; - - template < ObjType_t OD = ObjTypeDiscriminator, - std::enable_if_t * = nullptr> - RecordTime( const LLUUID & av, StatType_t type ):RecordTime(std::move(av), LLUUID::null, type) - { - LL_PROFILE_ZONE_COLOR(tracy::Color::Purple); - - #ifdef USAGE_TRACKING - if(FSPerfStats::inUseAvatar){LL_PROFILE_ZONE_TEXT("OVERLAP AVATAR",14);} - - LL_PROFILE_PLOT_SQ("InUseAv", (int64_t)FSPerfStats::inUseAvatar, (int64_t)FSPerfStats::inUseAvatar+1); - FSPerfStats::inUseAvatar++; - LL_PROFILE_PLOT_SQ("InUse", (int64_t)FSPerfStats::inUse, (int64_t)FSPerfStats::inUse+1); - FSPerfStats::inUse++; - #endif - - }; - - ~RecordTime() - { - if(!FSPerfStats::StatsRecorder::enabled()) - { - return; - } - - LL_PROFILE_ZONE_COLOR(tracy::Color::Red); - - #ifdef USAGE_TRACKING - LL_PROFILE_PLOT_SQ("InUse", (int64_t)FSPerfStats::inUse,(int64_t)FSPerfStats::inUse-1); - --FSPerfStats::inUse; - if (stat.objType == FSPerfStats::ObjType_t::OT_ATTACHMENT) - { - LL_PROFILE_PLOT_SQ("InUseAttachment", (int64_t)FSPerfStats::inUseAttachment,(int64_t)FSPerfStats::inUseAttachment-1); - --FSPerfStats::inUseAttachment; - if (stat.isRigged) - { - LL_PROFILE_PLOT_SQ("InUseAttachmentRigged", (int64_t)FSPerfStats::inUseAttachmentRigged,(int64_t)FSPerfStats::inUseAttachmentRigged-1); - --FSPerfStats::inUseAttachmentRigged; - } - else - { - LL_PROFILE_PLOT_SQ("InUseAttachmentUnRigged", (int64_t)FSPerfStats::inUseAttachmentUnRigged,(int64_t)FSPerfStats::inUseAttachmentUnRigged-1); - --FSPerfStats::inUseAttachmentUnRigged; - } - } - if (stat.objType == FSPerfStats::ObjType_t::OT_GENERAL) - { - LL_PROFILE_PLOT_SQ("InUseScene", (int64_t)FSPerfStats::inUseScene,(int64_t)FSPerfStats::inUseScene-1); - --FSPerfStats::inUseScene; - } - if( stat.objType == FSPerfStats::ObjType_t::OT_AVATAR ) - { - LL_PROFILE_PLOT_SQ("InUseAv", (int64_t)FSPerfStats::inUseAvatar, (int64_t)FSPerfStats::inUseAvatar-1); - --FSPerfStats::inUseAvatar; - } - #endif - stat.time = LLTrace::BlockTimer::getCPUClockCount64() - start; - - #ifdef ATTACHMENT_TRACKING - static char obstr[36]; - static char avstr[36]; - LL_PROFILE_ZONE_NUM(static_cast(stat.objType)); - LL_PROFILE_ZONE_TEXT(stat.avID.toStringFast(avstr), 36); - LL_PROFILE_ZONE_TEXT(stat.objID.toStringFast(obstr), 36); - LL_PROFILE_ZONE_NUM(stat.time); - #endif - - StatsRecorder::send(std::move(stat)); - }; - }; - - - inline double raw_to_ns(U64 raw) { return (static_cast(raw) * 1000000000.0) / FSPerfStats::cpu_hertz; }; - inline double raw_to_us(U64 raw) { return (static_cast(raw) * 1000000.0) / FSPerfStats::cpu_hertz; }; - inline double raw_to_ms(U64 raw) { return (static_cast(raw) * 1000.0) / FSPerfStats::cpu_hertz; }; - - using RecordSceneTime = RecordTime; - using RecordAvatarTime = RecordTime; - using RecordAttachmentTime = RecordTime; - using RecordHudAttachmentTime = RecordTime; - -};// namespace FSPerfStats - -// helper functions -using RATptr = std::unique_ptr; -using RSTptr = std::unique_ptr; - -template -static inline void trackAttachments(const T * vobj, bool isRigged, RATptr* ratPtrp) -{ - if( !vobj ){ ratPtrp->reset(); return;}; - - const T* rootAtt{vobj}; - if (rootAtt->isAttachment()) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; - - while( !rootAtt->isRootEdit() ) - { - rootAtt = (T*)(rootAtt->getParent()); - } - - auto avPtr = (T*)(rootAtt->getParent()); - if(!avPtr){ratPtrp->reset(); return;} - - auto& av = avPtr->getID(); - auto& obj = rootAtt->getAttachmentItemID(); - if (!*ratPtrp || (*ratPtrp)->stat.objID != obj || (*ratPtrp)->stat.avID != av) - { - #if TRACY_ENABLE && defined(ATTACHMENT_TRACKING) - LL_PROFILE_ZONE_NAMED_COLOR( "trackAttachments:new", tracy::Color::Red); - auto& str = rootAtt->getAttachmentItemName(); - LL_PROFILE_ZONE_TEXT(str.c_str(), str.size()); - LL_PROFILE_ZONE_TEXT(isRigged ? "Rigged" : "Unrigged", 8); - static char avStr[36]; - av.toStringFast(avStr); - static char obStr[4]; - obj.toShortString(obStr); - LL_PROFILE_ZONE_TEXT( avStr, 36); - LL_PROFILE_ZONE_TEXT( obStr, 4); - #endif - if (*ratPtrp) - { - // deliberately reset to ensure destruction before construction of replacement. - ratPtrp->reset(); - }; - *ratPtrp = std::make_unique( - av, - obj, - ( LLPipeline::sShadowRender?FSPerfStats::StatType_t::RENDER_SHADOWS : FSPerfStats::StatType_t::RENDER_GEOMETRY ), - isRigged, - rootAtt->isHUDAttachment()); - } - } - return; -}; - -#endif \ No newline at end of file From 78953e3166b12d650a55af9671643482989d401e Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 12 Nov 2022 00:08:02 +0100 Subject: [PATCH 45/99] Bring some XUI files in line with FS naming scheme --- indra/newview/llviewerfloaterreg.cpp | 4 +--- ...r_performance_fs.xml => floater_fs_performance.xml} | 10 +++++----- ...totune_fs.xml => panel_fs_performance_autotune.xml} | 0 ...xity_fs.xml => panel_fs_performance_complexity.xml} | 0 ...mance_huds_fs.xml => panel_fs_performance_huds.xml} | 0 ...e_nearby_fs.xml => panel_fs_performance_nearby.xml} | 0 ...ces_fs.xml => panel_fs_performance_preferences.xml} | 0 7 files changed, 6 insertions(+), 8 deletions(-) rename indra/newview/skins/default/xui/en/{floater_performance_fs.xml => floater_fs_performance.xml} (98%) rename indra/newview/skins/default/xui/en/{panel_performance_autotune_fs.xml => panel_fs_performance_autotune.xml} (100%) rename indra/newview/skins/default/xui/en/{panel_performance_complexity_fs.xml => panel_fs_performance_complexity.xml} (100%) rename indra/newview/skins/default/xui/en/{panel_performance_huds_fs.xml => panel_fs_performance_huds.xml} (100%) rename indra/newview/skins/default/xui/en/{panel_performance_nearby_fs.xml => panel_fs_performance_nearby.xml} (100%) rename indra/newview/skins/default/xui/en/{panel_performance_preferences_fs.xml => panel_fs_performance_preferences.xml} (100%) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index af81265a6a..762942b95e 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -395,7 +395,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("pathfinding_console", "floater_pathfinding_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("people", "floater_people.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); //LLFloaterReg::add("performance", "floater_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("performance", "floater_performance_fs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("perms_default", "floater_perms_default.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); @@ -515,8 +514,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("media_lists", "floater_media_lists.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("money_tracker", "floater_fs_money_tracker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("particle_editor","floater_particle_editor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - // LLFloaterReg::add("performance", "floater_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); // restore perf floater - LLFloaterReg::add("performance", "floater_performance_fs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("performance", "floater_fs_performance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add(PHOTOTOOLS_FLOATER, "floater_phototools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("phototools_camera", "floater_phototools_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("quickprefs", "floater_quickprefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_performance_fs.xml b/indra/newview/skins/default/xui/en/floater_fs_performance.xml similarity index 98% rename from indra/newview/skins/default/xui/en/floater_performance_fs.xml rename to indra/newview/skins/default/xui/en/floater_fs_performance.xml index 5e814ba099..66d7b77e93 100644 --- a/indra/newview/skins/default/xui/en/floater_performance_fs.xml +++ b/indra/newview/skins/default/xui/en/floater_fs_performance.xml @@ -564,7 +564,7 @@ HUDs Date: Sat, 12 Nov 2022 00:18:50 +0100 Subject: [PATCH 46/99] Rename performance floater related language files --- .../de/{floater_performance.xml => floater_fs_performance.xml} | 0 ...performance_autotune.xml => panel_fs_performance_autotune.xml} | 0 ...ormance_complexity.xml => panel_fs_performance_complexity.xml} | 0 .../{panel_performance_huds.xml => panel_fs_performance_huds.xml} | 0 ...nel_performance_nearby.xml => panel_fs_performance_nearby.xml} | 0 ...mance_preferences.xml => panel_fs_performance_preferences.xml} | 0 .../fr/{floater_performance.xml => floater_fs_performance.xml} | 0 ...performance_autotune.xml => panel_fs_performance_autotune.xml} | 0 ...ormance_complexity.xml => panel_fs_performance_complexity.xml} | 0 .../{panel_performance_huds.xml => panel_fs_performance_huds.xml} | 0 ...nel_performance_nearby.xml => panel_fs_performance_nearby.xml} | 0 ...mance_preferences.xml => panel_fs_performance_preferences.xml} | 0 .../it/{floater_performance.xml => floater_fs_performance.xml} | 0 ...performance_autotune.xml => panel_fs_performance_autotune.xml} | 0 ...ormance_complexity.xml => panel_fs_performance_complexity.xml} | 0 .../{panel_performance_huds.xml => panel_fs_performance_huds.xml} | 0 ...nel_performance_nearby.xml => panel_fs_performance_nearby.xml} | 0 ...mance_preferences.xml => panel_fs_performance_preferences.xml} | 0 .../pl/{floater_performance.xml => floater_fs_performance.xml} | 0 ...performance_autotune.xml => panel_fs_performance_autotune.xml} | 0 ...ormance_complexity.xml => panel_fs_performance_complexity.xml} | 0 .../{panel_performance_huds.xml => panel_fs_performance_huds.xml} | 0 ...nel_performance_nearby.xml => panel_fs_performance_nearby.xml} | 0 ...mance_preferences.xml => panel_fs_performance_preferences.xml} | 0 .../ru/{floater_performance.xml => floater_fs_performance.xml} | 0 ...performance_autotune.xml => panel_fs_performance_autotune.xml} | 0 ...ormance_complexity.xml => panel_fs_performance_complexity.xml} | 0 .../{panel_performance_huds.xml => panel_fs_performance_huds.xml} | 0 ...nel_performance_nearby.xml => panel_fs_performance_nearby.xml} | 0 ...mance_preferences.xml => panel_fs_performance_preferences.xml} | 0 30 files changed, 0 insertions(+), 0 deletions(-) rename indra/newview/skins/default/xui/de/{floater_performance.xml => floater_fs_performance.xml} (100%) rename indra/newview/skins/default/xui/de/{panel_performance_autotune.xml => panel_fs_performance_autotune.xml} (100%) rename indra/newview/skins/default/xui/de/{panel_performance_complexity.xml => panel_fs_performance_complexity.xml} (100%) rename indra/newview/skins/default/xui/de/{panel_performance_huds.xml => panel_fs_performance_huds.xml} (100%) rename indra/newview/skins/default/xui/de/{panel_performance_nearby.xml => panel_fs_performance_nearby.xml} (100%) rename indra/newview/skins/default/xui/de/{panel_performance_preferences.xml => panel_fs_performance_preferences.xml} (100%) rename indra/newview/skins/default/xui/fr/{floater_performance.xml => floater_fs_performance.xml} (100%) rename indra/newview/skins/default/xui/fr/{panel_performance_autotune.xml => panel_fs_performance_autotune.xml} (100%) rename indra/newview/skins/default/xui/fr/{panel_performance_complexity.xml => panel_fs_performance_complexity.xml} (100%) rename indra/newview/skins/default/xui/fr/{panel_performance_huds.xml => panel_fs_performance_huds.xml} (100%) rename indra/newview/skins/default/xui/fr/{panel_performance_nearby.xml => panel_fs_performance_nearby.xml} (100%) rename indra/newview/skins/default/xui/fr/{panel_performance_preferences.xml => panel_fs_performance_preferences.xml} (100%) rename indra/newview/skins/default/xui/it/{floater_performance.xml => floater_fs_performance.xml} (100%) rename indra/newview/skins/default/xui/it/{panel_performance_autotune.xml => panel_fs_performance_autotune.xml} (100%) rename indra/newview/skins/default/xui/it/{panel_performance_complexity.xml => panel_fs_performance_complexity.xml} (100%) rename indra/newview/skins/default/xui/it/{panel_performance_huds.xml => panel_fs_performance_huds.xml} (100%) rename indra/newview/skins/default/xui/it/{panel_performance_nearby.xml => panel_fs_performance_nearby.xml} (100%) rename indra/newview/skins/default/xui/it/{panel_performance_preferences.xml => panel_fs_performance_preferences.xml} (100%) rename indra/newview/skins/default/xui/pl/{floater_performance.xml => floater_fs_performance.xml} (100%) rename indra/newview/skins/default/xui/pl/{panel_performance_autotune.xml => panel_fs_performance_autotune.xml} (100%) rename indra/newview/skins/default/xui/pl/{panel_performance_complexity.xml => panel_fs_performance_complexity.xml} (100%) rename indra/newview/skins/default/xui/pl/{panel_performance_huds.xml => panel_fs_performance_huds.xml} (100%) rename indra/newview/skins/default/xui/pl/{panel_performance_nearby.xml => panel_fs_performance_nearby.xml} (100%) rename indra/newview/skins/default/xui/pl/{panel_performance_preferences.xml => panel_fs_performance_preferences.xml} (100%) rename indra/newview/skins/default/xui/ru/{floater_performance.xml => floater_fs_performance.xml} (100%) rename indra/newview/skins/default/xui/ru/{panel_performance_autotune.xml => panel_fs_performance_autotune.xml} (100%) rename indra/newview/skins/default/xui/ru/{panel_performance_complexity.xml => panel_fs_performance_complexity.xml} (100%) rename indra/newview/skins/default/xui/ru/{panel_performance_huds.xml => panel_fs_performance_huds.xml} (100%) rename indra/newview/skins/default/xui/ru/{panel_performance_nearby.xml => panel_fs_performance_nearby.xml} (100%) rename indra/newview/skins/default/xui/ru/{panel_performance_preferences.xml => panel_fs_performance_preferences.xml} (100%) diff --git a/indra/newview/skins/default/xui/de/floater_performance.xml b/indra/newview/skins/default/xui/de/floater_fs_performance.xml similarity index 100% rename from indra/newview/skins/default/xui/de/floater_performance.xml rename to indra/newview/skins/default/xui/de/floater_fs_performance.xml diff --git a/indra/newview/skins/default/xui/de/panel_performance_autotune.xml b/indra/newview/skins/default/xui/de/panel_fs_performance_autotune.xml similarity index 100% rename from indra/newview/skins/default/xui/de/panel_performance_autotune.xml rename to indra/newview/skins/default/xui/de/panel_fs_performance_autotune.xml diff --git a/indra/newview/skins/default/xui/de/panel_performance_complexity.xml b/indra/newview/skins/default/xui/de/panel_fs_performance_complexity.xml similarity index 100% rename from indra/newview/skins/default/xui/de/panel_performance_complexity.xml rename to indra/newview/skins/default/xui/de/panel_fs_performance_complexity.xml diff --git a/indra/newview/skins/default/xui/de/panel_performance_huds.xml b/indra/newview/skins/default/xui/de/panel_fs_performance_huds.xml similarity index 100% rename from indra/newview/skins/default/xui/de/panel_performance_huds.xml rename to indra/newview/skins/default/xui/de/panel_fs_performance_huds.xml diff --git a/indra/newview/skins/default/xui/de/panel_performance_nearby.xml b/indra/newview/skins/default/xui/de/panel_fs_performance_nearby.xml similarity index 100% rename from indra/newview/skins/default/xui/de/panel_performance_nearby.xml rename to indra/newview/skins/default/xui/de/panel_fs_performance_nearby.xml diff --git a/indra/newview/skins/default/xui/de/panel_performance_preferences.xml b/indra/newview/skins/default/xui/de/panel_fs_performance_preferences.xml similarity index 100% rename from indra/newview/skins/default/xui/de/panel_performance_preferences.xml rename to indra/newview/skins/default/xui/de/panel_fs_performance_preferences.xml diff --git a/indra/newview/skins/default/xui/fr/floater_performance.xml b/indra/newview/skins/default/xui/fr/floater_fs_performance.xml similarity index 100% rename from indra/newview/skins/default/xui/fr/floater_performance.xml rename to indra/newview/skins/default/xui/fr/floater_fs_performance.xml diff --git a/indra/newview/skins/default/xui/fr/panel_performance_autotune.xml b/indra/newview/skins/default/xui/fr/panel_fs_performance_autotune.xml similarity index 100% rename from indra/newview/skins/default/xui/fr/panel_performance_autotune.xml rename to indra/newview/skins/default/xui/fr/panel_fs_performance_autotune.xml diff --git a/indra/newview/skins/default/xui/fr/panel_performance_complexity.xml b/indra/newview/skins/default/xui/fr/panel_fs_performance_complexity.xml similarity index 100% rename from indra/newview/skins/default/xui/fr/panel_performance_complexity.xml rename to indra/newview/skins/default/xui/fr/panel_fs_performance_complexity.xml diff --git a/indra/newview/skins/default/xui/fr/panel_performance_huds.xml b/indra/newview/skins/default/xui/fr/panel_fs_performance_huds.xml similarity index 100% rename from indra/newview/skins/default/xui/fr/panel_performance_huds.xml rename to indra/newview/skins/default/xui/fr/panel_fs_performance_huds.xml diff --git a/indra/newview/skins/default/xui/fr/panel_performance_nearby.xml b/indra/newview/skins/default/xui/fr/panel_fs_performance_nearby.xml similarity index 100% rename from indra/newview/skins/default/xui/fr/panel_performance_nearby.xml rename to indra/newview/skins/default/xui/fr/panel_fs_performance_nearby.xml diff --git a/indra/newview/skins/default/xui/fr/panel_performance_preferences.xml b/indra/newview/skins/default/xui/fr/panel_fs_performance_preferences.xml similarity index 100% rename from indra/newview/skins/default/xui/fr/panel_performance_preferences.xml rename to indra/newview/skins/default/xui/fr/panel_fs_performance_preferences.xml diff --git a/indra/newview/skins/default/xui/it/floater_performance.xml b/indra/newview/skins/default/xui/it/floater_fs_performance.xml similarity index 100% rename from indra/newview/skins/default/xui/it/floater_performance.xml rename to indra/newview/skins/default/xui/it/floater_fs_performance.xml diff --git a/indra/newview/skins/default/xui/it/panel_performance_autotune.xml b/indra/newview/skins/default/xui/it/panel_fs_performance_autotune.xml similarity index 100% rename from indra/newview/skins/default/xui/it/panel_performance_autotune.xml rename to indra/newview/skins/default/xui/it/panel_fs_performance_autotune.xml diff --git a/indra/newview/skins/default/xui/it/panel_performance_complexity.xml b/indra/newview/skins/default/xui/it/panel_fs_performance_complexity.xml similarity index 100% rename from indra/newview/skins/default/xui/it/panel_performance_complexity.xml rename to indra/newview/skins/default/xui/it/panel_fs_performance_complexity.xml diff --git a/indra/newview/skins/default/xui/it/panel_performance_huds.xml b/indra/newview/skins/default/xui/it/panel_fs_performance_huds.xml similarity index 100% rename from indra/newview/skins/default/xui/it/panel_performance_huds.xml rename to indra/newview/skins/default/xui/it/panel_fs_performance_huds.xml diff --git a/indra/newview/skins/default/xui/it/panel_performance_nearby.xml b/indra/newview/skins/default/xui/it/panel_fs_performance_nearby.xml similarity index 100% rename from indra/newview/skins/default/xui/it/panel_performance_nearby.xml rename to indra/newview/skins/default/xui/it/panel_fs_performance_nearby.xml diff --git a/indra/newview/skins/default/xui/it/panel_performance_preferences.xml b/indra/newview/skins/default/xui/it/panel_fs_performance_preferences.xml similarity index 100% rename from indra/newview/skins/default/xui/it/panel_performance_preferences.xml rename to indra/newview/skins/default/xui/it/panel_fs_performance_preferences.xml diff --git a/indra/newview/skins/default/xui/pl/floater_performance.xml b/indra/newview/skins/default/xui/pl/floater_fs_performance.xml similarity index 100% rename from indra/newview/skins/default/xui/pl/floater_performance.xml rename to indra/newview/skins/default/xui/pl/floater_fs_performance.xml diff --git a/indra/newview/skins/default/xui/pl/panel_performance_autotune.xml b/indra/newview/skins/default/xui/pl/panel_fs_performance_autotune.xml similarity index 100% rename from indra/newview/skins/default/xui/pl/panel_performance_autotune.xml rename to indra/newview/skins/default/xui/pl/panel_fs_performance_autotune.xml diff --git a/indra/newview/skins/default/xui/pl/panel_performance_complexity.xml b/indra/newview/skins/default/xui/pl/panel_fs_performance_complexity.xml similarity index 100% rename from indra/newview/skins/default/xui/pl/panel_performance_complexity.xml rename to indra/newview/skins/default/xui/pl/panel_fs_performance_complexity.xml diff --git a/indra/newview/skins/default/xui/pl/panel_performance_huds.xml b/indra/newview/skins/default/xui/pl/panel_fs_performance_huds.xml similarity index 100% rename from indra/newview/skins/default/xui/pl/panel_performance_huds.xml rename to indra/newview/skins/default/xui/pl/panel_fs_performance_huds.xml diff --git a/indra/newview/skins/default/xui/pl/panel_performance_nearby.xml b/indra/newview/skins/default/xui/pl/panel_fs_performance_nearby.xml similarity index 100% rename from indra/newview/skins/default/xui/pl/panel_performance_nearby.xml rename to indra/newview/skins/default/xui/pl/panel_fs_performance_nearby.xml diff --git a/indra/newview/skins/default/xui/pl/panel_performance_preferences.xml b/indra/newview/skins/default/xui/pl/panel_fs_performance_preferences.xml similarity index 100% rename from indra/newview/skins/default/xui/pl/panel_performance_preferences.xml rename to indra/newview/skins/default/xui/pl/panel_fs_performance_preferences.xml diff --git a/indra/newview/skins/default/xui/ru/floater_performance.xml b/indra/newview/skins/default/xui/ru/floater_fs_performance.xml similarity index 100% rename from indra/newview/skins/default/xui/ru/floater_performance.xml rename to indra/newview/skins/default/xui/ru/floater_fs_performance.xml diff --git a/indra/newview/skins/default/xui/ru/panel_performance_autotune.xml b/indra/newview/skins/default/xui/ru/panel_fs_performance_autotune.xml similarity index 100% rename from indra/newview/skins/default/xui/ru/panel_performance_autotune.xml rename to indra/newview/skins/default/xui/ru/panel_fs_performance_autotune.xml diff --git a/indra/newview/skins/default/xui/ru/panel_performance_complexity.xml b/indra/newview/skins/default/xui/ru/panel_fs_performance_complexity.xml similarity index 100% rename from indra/newview/skins/default/xui/ru/panel_performance_complexity.xml rename to indra/newview/skins/default/xui/ru/panel_fs_performance_complexity.xml diff --git a/indra/newview/skins/default/xui/ru/panel_performance_huds.xml b/indra/newview/skins/default/xui/ru/panel_fs_performance_huds.xml similarity index 100% rename from indra/newview/skins/default/xui/ru/panel_performance_huds.xml rename to indra/newview/skins/default/xui/ru/panel_fs_performance_huds.xml diff --git a/indra/newview/skins/default/xui/ru/panel_performance_nearby.xml b/indra/newview/skins/default/xui/ru/panel_fs_performance_nearby.xml similarity index 100% rename from indra/newview/skins/default/xui/ru/panel_performance_nearby.xml rename to indra/newview/skins/default/xui/ru/panel_fs_performance_nearby.xml diff --git a/indra/newview/skins/default/xui/ru/panel_performance_preferences.xml b/indra/newview/skins/default/xui/ru/panel_fs_performance_preferences.xml similarity index 100% rename from indra/newview/skins/default/xui/ru/panel_performance_preferences.xml rename to indra/newview/skins/default/xui/ru/panel_fs_performance_preferences.xml From 0ee82f5264067e22013c49abf19344172c2f658b Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Thu, 17 Nov 2022 15:04:38 +0200 Subject: [PATCH 47/99] SL-18641 fix for 'Always display friends in full detail' setting --- indra/newview/lldrawpoolavatar.cpp | 2 +- indra/newview/llfloaterperformance.cpp | 2 +- indra/newview/llviewerpartsim.cpp | 2 +- indra/newview/llvoavatar.cpp | 20 ++++++++++++++++---- indra/newview/llvoavatar.h | 8 +++----- indra/newview/pipeline.cpp | 6 +++--- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 02dea6b828..4ffa903cca 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -386,7 +386,7 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) LLVOAvatar::AvatarOverallAppearance oa = avatarp->getOverallAppearance(); BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor(); // no shadows if the shadows are causing this avatar to breach the limit. - if (avatarp->isTooSlowWithShadows() || impostor || (oa == LLVOAvatar::AOA_INVISIBLE)) + if (avatarp->isTooSlow() || impostor || (oa == LLVOAvatar::AOA_INVISIBLE)) { // No shadows for impostored (including jellydolled) or invisible avs. return; diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 10595f5b6a..51eb137d82 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -372,7 +372,7 @@ void LLFloaterPerformance::populateNearbyList() auto render_av_raw = LLPerfStats::StatsRecorder::get(AvType, avatar->getID(),LLPerfStats::StatType_t::RENDER_COMBINED); LLPerfStats::bufferToggleLock.unlock(); - auto is_slow = avatar->isTooSlowWithShadows(); + auto is_slow = avatar->isTooSlow(); LLSD item; item["id"] = avatar->getID(); LLSD& row = item["columns"]; diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index a440f3232a..449fd4ba43 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -716,7 +716,7 @@ void LLViewerPartSim::updateSimulation() if (upd && vobj && (vobj->getPCode() == LL_PCODE_VOLUME)) { - if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex() && vobj->getAvatar()->isTooSlowWithShadows()) + if(vobj->getAvatar() && vobj->getAvatar()->isTooComplex() && vobj->getAvatar()->isTooSlow()) { upd = FALSE; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 776223da9d..c0835e3ed0 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3137,7 +3137,7 @@ void LLVOAvatar::idleUpdateLoadingEffect() LLPartData::LL_PART_TARGET_POS_MASK ); // do not generate particles for dummy or overly-complex avatars - if (!mIsDummy && !isTooComplex() && !isTooSlowWithShadows()) + if (!mIsDummy && !isTooComplex() && !isTooSlow()) { setParticleSource(particle_parameters, getID()); } @@ -3718,7 +3718,7 @@ bool LLVOAvatar::isVisuallyMuted() } else { - muted = isTooComplex() || isTooSlowWithShadows(); + muted = isTooComplex() || isTooSlow(); } } @@ -8288,6 +8288,18 @@ bool LLVOAvatar::isTooComplex() const return too_complex; } +bool LLVOAvatar::isTooSlow() const +{ + static LLCachedControl always_render_friends(gSavedSettings, "AlwaysRenderFriends"); + bool render_friend = (LLAvatarTracker::instance().isBuddy(getID()) && always_render_friends); + + if (render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) + { + return false; + } + return mTooSlow; +} + // use Avatar Render Time as complexity metric // markARTStale - Mark stale and set the frameupdate to now so that we can wait at least one frame to get a revised number. void LLVOAvatar::markARTStale() @@ -11189,7 +11201,7 @@ LLVOAvatar::AvatarOverallAppearance LLVOAvatar::getOverallAppearance() const { // Always want to see this AV as an impostor result = AOA_JELLYDOLL; } - else if (isTooComplex() || isTooSlowWithShadows()) + else if (isTooComplex() || isTooSlow()) { result = AOA_JELLYDOLL; } @@ -11216,7 +11228,7 @@ void LLVOAvatar::calcMutedAVColor() new_color = LLColor4::grey4; change_msg = " blocked: color is grey4"; } - else if (!isTooComplex() && !isTooSlowWithShadows()) + else if (!isTooComplex() && !isTooSlow()) { new_color = LLColor4::white; change_msg = " simple imposter "; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index a27327d8a3..3429f47dc9 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -354,12 +354,10 @@ public: // check and return current state relative to limits // default will test only the geometry (combined=false). // this allows us to disable shadows separately on complex avatars. - inline bool isTooSlowWithShadows() const {return mTooSlow;}; + inline bool isTooSlowWithoutShadows() const {return mTooSlowWithoutShadows;}; - inline bool isTooSlow(bool combined = false) const - { - return(combined?mTooSlow:mTooSlowWithoutShadows); - } + bool isTooSlow() const; + void updateTooSlow(); bool isTooComplex() const; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 500cea98fb..3e78c9b82c 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -5993,7 +5993,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) LLDrawable* drawable = light->drawable; const LLViewerObject *vobj = light->drawable->getVObj(); if(vobj && vobj->getAvatar() - && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlowWithShadows()) + && (vobj->getAvatar()->isTooComplex() || vobj->getAvatar()->isInMuteList() || vobj->getAvatar()->isTooSlow()) ) { drawable->clearState(LLDrawable::NEARBY_LIGHT); @@ -6072,7 +6072,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) continue; } LLVOAvatar * av = light->getAvatar(); - if (av && (av->isTooComplex() || av->isInMuteList() || av->isTooSlowWithShadows())) + if (av && (av->isTooComplex() || av->isInMuteList() || av->isTooSlow())) { // avatars that are already in the list will be removed by removeMutedAVsLights continue; @@ -10856,7 +10856,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) << " is " << ( too_complex ? "" : "not ") << "too complex" << LL_ENDL; - bool too_slow = avatar->isTooSlowWithShadows(); + bool too_slow = avatar->isTooSlow(); pushRenderTypeMask(); From d2766f34c549508feb61b91633caf2aad813923f Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Sat, 19 Nov 2022 11:40:14 +0200 Subject: [PATCH 48/99] SL-18675 Display render time as 1 even it's actually less --- indra/newview/llfloaterperformance.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 51eb137d82..36912971d9 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -262,7 +262,7 @@ void LLFloaterPerformance::populateHUDList() row[1]["column"] = "complex_value"; row[1]["type"] = "text"; - row[1]["value"] = llformat( "%.f",LLPerfStats::raw_to_us(hud_render_time_raw) ); + row[1]["value"] = llformat( "%.f", llmax(LLPerfStats::raw_to_us(hud_render_time_raw), (double)1)); row[1]["font"]["name"] = "SANSSERIF"; row[2]["column"] = "name"; @@ -321,7 +321,7 @@ void LLFloaterPerformance::populateObjectList() row[1]["column"] = "complex_value"; row[1]["type"] = "text"; - row[1]["value"] = llformat("%.f", LLPerfStats::raw_to_us(attach_render_time_raw)); + row[1]["value"] = llformat("%.f", llmax(LLPerfStats::raw_to_us(attach_render_time_raw), (double)1)); row[1]["font"]["name"] = "SANSSERIF"; row[2]["column"] = "name"; From f0809019f807bdcfec719f32538582ea86edf9e3 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Sat, 19 Nov 2022 12:04:33 +0200 Subject: [PATCH 49/99] SL-18670 change limits of RenderVolumeLODFactor in Preference similar to Distance detail ctrl; update slider text correctly --- indra/newview/llfloaterpreferencesgraphicsadvanced.cpp | 10 ++++++++-- indra/newview/llfloaterpreferencesgraphicsadvanced.h | 2 ++ .../xui/en/floater_preferences_graphics_advanced.xml | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index 98ebe7d4e8..a976b97831 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -58,6 +58,7 @@ LLFloaterPreferenceGraphicsAdvanced::LLFloaterPreferenceGraphicsAdvanced(const L LLFloaterPreferenceGraphicsAdvanced::~LLFloaterPreferenceGraphicsAdvanced() { mComplexityChangedSignal.disconnect(); + mLODFactorChangedSignal.disconnect(); } BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() @@ -77,8 +78,8 @@ BOOL LLFloaterPreferenceGraphicsAdvanced::postBuild() use_HiDPI->setVisible(FALSE); #endif - mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateComplexityText, this)); - + mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateComplexityText, this)); + mLODFactorChangedSignal = gSavedSettings.getControl("RenderVolumeLODFactor")->getCommitSignal()->connect(boost::bind(&LLFloaterPreferenceGraphicsAdvanced::updateObjectMeshDetailText, this)); return TRUE; } @@ -164,6 +165,11 @@ void LLFloaterPreferenceGraphicsAdvanced::updateComplexityText() getChild("IndirectMaxComplexityText", true)); } +void LLFloaterPreferenceGraphicsAdvanced::updateObjectMeshDetailText() +{ + updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); +} + void LLFloaterPreferenceGraphicsAdvanced::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { if (text_box == NULL || ctrl== NULL) diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.h b/indra/newview/llfloaterpreferencesgraphicsadvanced.h index 7f26ff8b00..2c92f3dbf1 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.h +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.h @@ -49,6 +49,7 @@ public: void setMaxNonImpostorsText(U32 value, LLTextBox* text_box); void updateMaxComplexity(); void updateComplexityText(); + void updateObjectMeshDetailText(); void refresh(); // callback for when client modifies a render option void onRenderOptionEnable(); @@ -60,6 +61,7 @@ protected: void onBtnCancel(const LLSD& userdata); boost::signals2::connection mComplexityChangedSignal; + boost::signals2::connection mLODFactorChangedSignal; }; #endif //LLFLOATERPREFERENCEGRAPHICSADVANCED_H diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 9da6ec093b..11c2d11987 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -522,8 +522,8 @@ label_width="185" layout="topleft" left="420" - min_val="1" - max_val="2" + min_val="0" + max_val="4" name="ObjectMeshDetail" show_text="false" top_delta="16" From baecfe14c2b841b520a94b7b95fec8881ea06113 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Sat, 19 Nov 2022 12:19:56 +0200 Subject: [PATCH 50/99] restore correct glh_linear version --- autobuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 1d303b3e95..5a5ffa2898 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -830,9 +830,9 @@ archive hash - 650e836255b6c2ecb93d3f1f7220051c + dce3f3c01fddb400cb143c3283fe9259 url - http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/55011/511905/glh_linear-0.0.0-common-538981.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/82754/775367/glh_linear-0.0.0-common-560278.tar.bz2 name common From dcd8d384ffa3aebed0127e8c61c9158c23a9f002 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 23 Nov 2022 11:04:11 +0100 Subject: [PATCH 51/99] Fix build --- indra/newview/fsfloaterperformance.cpp | 2 +- indra/newview/llperfstats.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/fsfloaterperformance.cpp b/indra/newview/fsfloaterperformance.cpp index ec7c2cbffe..23da5a884c 100644 --- a/indra/newview/fsfloaterperformance.cpp +++ b/indra/newview/fsfloaterperformance.cpp @@ -682,7 +682,7 @@ void FSFloaterPerformance::populateNearbyList() auto render_av_idle = LLPerfStats::StatsRecorder::get(AvType, avatar->getID(),LLPerfStats::StatType_t::RENDER_IDLE); LLPerfStats::bufferToggleLock.unlock(); - auto is_slow = avatar->isTooSlowWithShadows(); + auto is_slow = avatar->isTooSlow(); LLSD item; item["id"] = avatar->getID(); diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index a589d44636..fe544c6168 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -52,7 +52,6 @@ namespace LLPerfStats bool belowTargetFPS{false}; U32 lastGlobalPrefChange{0}; std::mutex bufferToggleLock{}; - F64 cpu_hertz{0.0}; // reinstate threadsafe frequency F64 cpu_hertz{0.0}; From a783d6c02e1a111ac3e2361f9a5d669a7be39904 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Tue, 13 Dec 2022 15:36:47 +0200 Subject: [PATCH 52/99] retrigger build --- indra/edit-me-to-trigger-new-build.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/indra/edit-me-to-trigger-new-build.txt b/indra/edit-me-to-trigger-new-build.txt index eab7c17b71..139597f9cb 100644 --- a/indra/edit-me-to-trigger-new-build.txt +++ b/indra/edit-me-to-trigger-new-build.txt @@ -1,4 +1,2 @@ -euclid 5/29/2020 -euclid 7/23/2020 -euclid 4/29/2021 -euclid 10/5/2021 DRTVWR-546 + + From 61a08406c750a618058cac90de6db325355da8d3 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 4 Jan 2023 20:27:12 +0200 Subject: [PATCH 53/99] SL-18892 FIXED Mac build fails locally --- indra/cmake/Copy3rdPartyLibs.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 7495de00d5..e1508ed0c0 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -295,6 +295,6 @@ if(DARWIN) # that end up in any of the above SHARED_LIB_STAGING_DIR_MUMBLE # directories. add_custom_command( TARGET stage_third_party_libs POST_BUILD - COMMAND cmake -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/sharedlibs/Resources + COMMAND ${CMAKE_COMMAND} -E create_symlink ${SHARED_LIB_STAGING_DIR} ${CMAKE_BINARY_DIR}/sharedlibs/Resources ) endif() From 24839c8cf601cac5dbc9ca49166470f0263f7e3c Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Thu, 5 Jan 2023 19:13:57 +0200 Subject: [PATCH 54/99] SL-18884 Remove dead spot from Back button --- .../xui/en/panel_performance_autoadjustments.xml | 12 +++++++----- .../default/xui/en/panel_performance_complexity.xml | 12 +++++++----- .../skins/default/xui/en/panel_performance_huds.xml | 12 +++++++----- .../default/xui/en/panel_performance_nearby.xml | 12 +++++++----- .../default/xui/en/panel_performance_preferences.xml | 12 +++++++----- 5 files changed, 35 insertions(+), 25 deletions(-) diff --git a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml index 5d4ffd232b..ab7b4d3ee7 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_autoadjustments.xml @@ -24,12 +24,14 @@ + width="32"> Back Preferred frame rate diff --git a/indra/newview/skins/default/xui/en/panel_performance_complexity.xml b/indra/newview/skins/default/xui/en/panel_performance_complexity.xml index 954fd0a8c1..cd3f610a92 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_complexity.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_complexity.xml @@ -24,12 +24,14 @@ + width="32"> Back Your avatar complexity diff --git a/indra/newview/skins/default/xui/en/panel_performance_huds.xml b/indra/newview/skins/default/xui/en/panel_performance_huds.xml index 289f865eb7..2fddcb3b9e 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_huds.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_huds.xml @@ -24,12 +24,14 @@ + width="32"> Back Your active HUDs diff --git a/indra/newview/skins/default/xui/en/panel_performance_nearby.xml b/indra/newview/skins/default/xui/en/panel_performance_nearby.xml index e80bf592e4..cb795e59a9 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_nearby.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_nearby.xml @@ -24,12 +24,14 @@ + width="32"> Back Avatars nearby diff --git a/indra/newview/skins/default/xui/en/panel_performance_preferences.xml b/indra/newview/skins/default/xui/en/panel_performance_preferences.xml index ee8105eac9..9c1a3ebd9e 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_preferences.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_preferences.xml @@ -24,12 +24,14 @@ + width="32"> Back Graphics settings From 495e34b84fa34ae5394f33f6f1175e959c56e769 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Tue, 10 Jan 2023 16:29:28 +0200 Subject: [PATCH 55/99] SL-18922 FIXED Imposters load with attachments using Perf floater --- indra/newview/pipeline.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ad47b3d154..51d7082b40 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -10871,11 +10871,9 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar) << " is " << ( too_complex ? "" : "not ") << "too complex" << LL_ENDL; - bool too_slow = avatar->isTooSlow(); - pushRenderTypeMask(); - if ( !too_slow && ( visually_muted || too_complex ) ) + if (visually_muted || too_complex) { // only show jelly doll geometry andRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, From 020bfa66ba9f1fee3e403595a1d6c95332bb16f7 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Tue, 10 Jan 2023 22:53:32 +0200 Subject: [PATCH 56/99] SL-18923 Add Reset to default settings button --- indra/newview/llfloaterperformance.cpp | 10 ++++++++ indra/newview/llfloaterperformance.h | 1 + indra/newview/llfloaterpreference.cpp | 6 +++++ indra/newview/llfloaterpreference.h | 2 ++ .../xui/en/panel_performance_preferences.xml | 25 +++++++++++++------ 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index 36912971d9..88319b170f 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -127,6 +127,7 @@ BOOL LLFloaterPerformance::postBuild() mObjectList->setIconClickedCallback(boost::bind(&LLFloaterPerformance::detachItem, this, _1)); mSettingsPanel->getChild("advanced_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickAdvanced, this)); + mSettingsPanel->getChild("defaults_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickDefaults, this)); mSettingsPanel->getChild("graphics_quality")->setCommitCallback(boost::bind(&LLFloaterPerformance::onChangeQuality, this, _2)); mSettingsPanel->getChild("advanced_lighting_model")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickAdvancedLighting, this)); mSettingsPanel->getChild("ShadowDetail")->setMouseDownCallback(boost::bind(&LLFloaterPerformance::onClickShadows, this)); @@ -477,6 +478,15 @@ void LLFloaterPerformance::onClickAdvanced() LLFloaterReg::showInstance("prefs_graphics_advanced"); } +void LLFloaterPerformance::onClickDefaults() +{ + LLFloaterPreference* instance = LLFloaterReg::getTypedInstance("preferences"); + if (instance) + { + instance->setRecommendedSettings(); + } +} + void LLFloaterPerformance::onChangeQuality(const LLSD& data) { LLFloaterPreference* instance = LLFloaterReg::getTypedInstance("preferences"); diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h index 09bcd18bb5..6a72f3d7c5 100644 --- a/indra/newview/llfloaterperformance.h +++ b/indra/newview/llfloaterperformance.h @@ -61,6 +61,7 @@ private: void setFPSText(); void onClickAdvanced(); + void onClickDefaults(); void onChangeQuality(const LLSD& data); void onClickHideAvatars(); void onClickExceptions(); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 76633a46a9..bb4ddf5969 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -788,6 +788,12 @@ void LLFloaterPreference::setHardwareDefaults() saveGraphicsPreset(preset_graphic_active); saveSettings(); // save here to be able to return to the previous preset by Cancel } + setRecommendedSettings(); +} + +void LLFloaterPreference::setRecommendedSettings() +{ + gSavedSettings.setBOOL("AutoTuneFPS", FALSE); LLFeatureManager::getInstance()->applyRecommendedSettings(); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index d5d0aca939..32a55a2948 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -199,6 +199,8 @@ public: void saveCameraPreset(std::string& preset); void saveGraphicsPreset(std::string& preset); + void setRecommendedSettings(); + private: void onDeleteTranscripts(); diff --git a/indra/newview/skins/default/xui/en/panel_performance_preferences.xml b/indra/newview/skins/default/xui/en/panel_performance_preferences.xml index 9c1a3ebd9e..b52c19d5e3 100644 --- a/indra/newview/skins/default/xui/en/panel_performance_preferences.xml +++ b/indra/newview/skins/default/xui/en/panel_performance_preferences.xml @@ -47,14 +47,23 @@ Graphics settings - - + name="display_desc" + top_delta="5" + left_pad="15" + wrap="true" + width="225"> + Your display supports up to [FPS_LIMIT] fps. + + width="115"> Settings affect + width="160"> + + From 788ba76bdf5dcc0a018a6b53bc1cc8f359e85f34 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Thu, 2 Feb 2023 16:17:09 +0200 Subject: [PATCH 67/99] SL-19094 Move Desired frame rate button to top level --- indra/newview/llfloaterperformance.cpp | 1 + .../default/xui/en/floater_performance.xml | 95 ++++++++++--------- .../en/panel_performance_autoadjustments.xml | 11 ++- 3 files changed, 59 insertions(+), 48 deletions(-) diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp index ba45648bd9..5eb58b9482 100644 --- a/indra/newview/llfloaterperformance.cpp +++ b/indra/newview/llfloaterperformance.cpp @@ -151,6 +151,7 @@ BOOL LLFloaterPerformance::postBuild() LLStringExplicit fps_limit(llformat("%d", gViewerWindow->getWindow()->getRefreshRate())); mAutoadjustmentsPanel->getChild("vsync_desc_limit")->setTextArg("[FPS_LIMIT]", fps_limit); mAutoadjustmentsPanel->getChild("display_desc")->setTextArg("[FPS_LIMIT]", fps_limit); + mAutoadjustmentsPanel->getChild("defaults_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickDefaults, this)); mStartAutotuneBtn = mAutoadjustmentsPanel->getChild("start_autotune"); mStopAutotuneBtn = mAutoadjustmentsPanel->getChild("stop_autotune"); diff --git a/indra/newview/skins/default/xui/en/floater_performance.xml b/indra/newview/skins/default/xui/en/floater_performance.xml index ee88701037..d1a1119f77 100644 --- a/indra/newview/skins/default/xui/en/floater_performance.xml +++ b/indra/newview/skins/default/xui/en/floater_performance.xml @@ -4,6 +4,7 @@ layout="topleft" name="performance" save_rect="true" + reuse_instance="true" title="IMPROVE GRAPHICS SPEED" width="580"> + + Auto-adjust settings (recommended) + + + Allow automatic adjustments to reach your preferred frame rate. + + + + - - - Preferred frame rate - - - Allow automatic adjustments to reach your preferred frame rate (advanced). - - - - Preferred frame rate + Auto-adjust settings + + + Level of Detail (LOD) Distance Factors: + - Date: Fri, 3 Feb 2023 17:19:36 +0100 Subject: [PATCH 69/99] Fix control name --- indra/newview/skins/default/xui/en/panel_presets_pulldown.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml index 9fd7e4b715..735ab59881 100644 --- a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml @@ -67,7 +67,7 @@ function="Presets.GoGraphicsPrefs" />