diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e7d141eb12..e27ef4c0e4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -25789,6 +25789,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + FSAutoTuneImpostorByDistEnabled + + Comment + Enable/disable using MaxNonImpostor to limit avatar rendering by distance. + Persist + 1 + Type + Boolean + Value + 1 + FSRenderAvatarMaxART Comment @@ -25800,10 +25811,43 @@ Change of this parameter will affect the layout of buttons in notification toast 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 - Stategy to use when tuning FPS. 0=Tune avatar rendering only, 1=Tune both avatar and global scene settings. + Strategy to use when tuning FPS. 0=Tune avatar rendering only, 1=Tune both avatar and global scene settings. Persist 1 Type diff --git a/indra/newview/fsfloaterperformance.cpp b/indra/newview/fsfloaterperformance.cpp index 3a6a9f0e78..64a3855efa 100644 --- a/indra/newview/fsfloaterperformance.cpp +++ b/indra/newview/fsfloaterperformance.cpp @@ -109,29 +109,24 @@ BOOL FSFloaterPerformance::postBuild() mComplexityPanel = getChild("panel_performance_complexity"); mSettingsPanel = getChild("panel_performance_preferences"); mHUDsPanel = getChild("panel_performance_huds"); - // Doesn't exist - //mAutoTunePanel = getChild("panel_performance_autotune"); + mAutoTunePanel = getChild("panel_performance_autotune"); getChild("nearby_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mNearbyPanel)); getChild("complexity_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mComplexityPanel)); getChild("settings_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mSettingsPanel)); getChild("huds_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mHUDsPanel)); - // Doesn't exist - //auto tgt_panel = getChild("target_subpanel"); - //if (tgt_panel) - //{ - // tgt_panel->getChild("target_button")->setCommitCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mAutoTunePanel)); - // // tgt_panel->getChild("fwd_lbl")->setShowCursorHand(false); - // // tgt_panel->getChild("fwd_lbl")->setSoundFlags(LLView::MOUSE_UP); - // // tgt_panel->getChild("fwd_lbl")->setClickedCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mAutoTunePanel)); - //} + + auto tgt_panel = getChild("target_subpanel"); + if (tgt_panel) + { + tgt_panel->getChild("target_btn")->setCommitCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mAutoTunePanel)); + } initBackBtn(mNearbyPanel); initBackBtn(mComplexityPanel); initBackBtn(mSettingsPanel); initBackBtn(mHUDsPanel); - // Doesn't exist - //initBackBtn(mAutoTunePanel); + initBackBtn(mAutoTunePanel); mHUDList = mHUDsPanel->getChild("hud_list"); mHUDList->setNameListType(LLNameListCtrl::SPECIAL); @@ -359,14 +354,12 @@ void FSFloaterPerformance::hidePanels() mComplexityPanel->setVisible(FALSE); mHUDsPanel->setVisible(FALSE); mSettingsPanel->setVisible(FALSE); - // Doesn't exist - //mAutoTunePanel->setVisible(FALSE); + mAutoTunePanel->setVisible(FALSE); } void FSFloaterPerformance::initBackBtn(LLPanel* panel) { panel->getChild("back_btn")->setCommitCallback(boost::bind(&FSFloaterPerformance::showMainPanel, this)); - panel->getChild("back_lbl")->setShowCursorHand(false); panel->getChild("back_lbl")->setSoundFlags(LLView::MOUSE_UP); panel->getChild("back_lbl")->setClickedCallback(boost::bind(&FSFloaterPerformance::showMainPanel, this)); diff --git a/indra/newview/fsfloaterperformance.h b/indra/newview/fsfloaterperformance.h index 881eb643a4..034c772ae2 100644 --- a/indra/newview/fsfloaterperformance.h +++ b/indra/newview/fsfloaterperformance.h @@ -79,7 +79,7 @@ private: LLPanel* mComplexityPanel; LLPanel* mHUDsPanel; LLPanel* mSettingsPanel; - //LLPanel* mAutoTunePanel; // Doesn't exist + LLPanel* mAutoTunePanel; LLNameListCtrl* mHUDList; LLNameListCtrl* mObjectList; LLNameListCtrl* mNearbyList; diff --git a/indra/newview/fsperfstats.cpp b/indra/newview/fsperfstats.cpp index 963a00a561..3f94f9cf1d 100644 --- a/indra/newview/fsperfstats.cpp +++ b/indra/newview/fsperfstats.cpp @@ -29,6 +29,9 @@ #include "fsperfstats.h" #include "llcontrol.h" #include "pipeline.h" +#include "llagentcamera.h" +#include "llvoavatar.h" +#include "llworld.h" extern LLControlGroup gSavedSettings; @@ -256,10 +259,38 @@ namespace FSPerfStats }; } + //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() { static LLCachedControl drawDistance(gSavedSettings, "RenderFarClip"); + static LLCachedControl userMinDrawDistance(gSavedSettings, "FSAutoTuneRenderFarClipMin"); + static LLCachedControl userTargetDrawDistance(gSavedSettings, "FSAutoTuneRenderFarClipTarget"); + static LLCachedControl impostorDistance(gSavedSettings, "FSAutoTuneImpostorFarAwayDistance"); + static LLCachedControl impostorDistanceTuning(gSavedSettings, "FSAutoTuneImpostorByDistEnabled"); + static LLCachedControl maxNonImpostors (gSavedSettings, "IndirectMaxNonImpostors"); + + if(impostorDistanceTuning) + { + // 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(drawDistance, impostorDistance)); + if( count != maxNonImpostors ) + { + gSavedSettings.setU32("IndirectMaxNonImpostors", (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER); + LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(drawDistance, impostorDistance) << "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. @@ -320,7 +351,7 @@ namespace FSPerfStats else // deliberately "else" here so we only do these in steps { // step down the DD by 10m per update - auto new_dd = (drawDistance>42)?(drawDistance - 10) : 32; + auto new_dd = (drawDistance-10>userMinDrawDistance)?(drawDistance - 10) : userMinDrawDistance; if(new_dd != drawDistance) { gSavedSettings.setF32("RenderFarClip", new_dd); @@ -370,13 +401,13 @@ namespace FSPerfStats // 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; } - if( drawDistance < FSPerfStats::PREFERRED_DD ) // TODO(Beq) make this less arbitrary + if( drawDistance < userTargetDrawDistance ) { gSavedSettings.setF32("RenderFarClip", drawDistance + 10.); } if( (target_frame_time_raw * 1.5) > tot_frame_time_raw && FSPerfStats::tunedAvatars == 0 && - drawDistance >= FSPerfStats::PREFERRED_DD ) + drawDistance >= userTargetDrawDistance) { // if everything else is "max" and we have 50% headroom let's knock the water quality up a notch at a time. auto water = gSavedSettings.getS32("RenderReflectionDetail"); diff --git a/indra/newview/fsperfstats.h b/indra/newview/fsperfstats.h index 8f64482cc3..df6afda31f 100644 --- a/indra/newview/fsperfstats.h +++ b/indra/newview/fsperfstats.h @@ -68,6 +68,7 @@ namespace FSPerfStats constexpr U64 ART_MINIMUM_NANOS{100000}; constexpr U64 ART_MIN_ADJUST_UP_NANOS{10000}; constexpr U64 ART_MIN_ADJUST_DOWN_NANOS{10000}; + constexpr F32 PREFERRED_DD{180}; extern std::atomic tunedAvatars; @@ -161,6 +162,7 @@ namespace FSPerfStats 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; diff --git a/indra/newview/skins/default/xui/en/floater_performance.xml b/indra/newview/skins/default/xui/en/floater_performance.xml index 867ce324e7..64d214f486 100644 --- a/indra/newview/skins/default/xui/en/floater_performance.xml +++ b/indra/newview/skins/default/xui/en/floater_performance.xml @@ -3,6 +3,7 @@ height="652" layout="topleft" name="performance" + help_topic="fs_performance_floater" save_rect="true" title="Improve Graphics Speed (Experimental)" width="580"> @@ -200,7 +201,6 @@ Frame breakdown will appear here. min_val="1" width="40" label="" /> - - diff --git a/indra/newview/skins/default/xui/en/panel_performance_autotune.xml b/indra/newview/skins/default/xui/en/panel_performance_autotune.xml new file mode 100644 index 0000000000..299fac6771 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_performance_autotune.xml @@ -0,0 +1,171 @@ + + + + + Back + + +Auto Tune Preferences + + + +Distant Avatars + + + + + +Avatars that are further away still have a high impact. +Control how far away an avatar should before being optimized. + + + +Visibility distance tuning limits + + + + + + +When adjusting scene parameters, autotune will optimise draw distance to between the minimum and the preferred. + +