Impostor by distance & enable autotune prefs panel

* enables autotune setting panel
* adds help_topic fs_performance_floater (placeholder page created)
* adds new optional control of maxnonimpostors based on distance from camera.
meow-7.2.2
Beq 2021-11-10 10:58:20 +00:00
parent 0fca12bdc9
commit a499734c81
7 changed files with 263 additions and 25 deletions

View File

@ -25789,6 +25789,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>FSAutoTuneImpostorByDistEnabled</key>
<map>
<key>Comment</key>
<string>Enable/disable using MaxNonImpostor to limit avatar rendering by distance.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FSRenderAvatarMaxART</key>
<map>
<key>Comment</key>
@ -25800,10 +25811,43 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<real>4.699</real>
</map>
<key>FSAutoTuneRenderFarClipMin</key>
<map>
<key>Comment</key>
<string>The lowest draw distance that auto tune is allowed to use</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>32.0</real>
</map>
<key>FSAutoTuneRenderFarClipTarget</key>
<map>
<key>Comment</key>
<string>The draw distance that auto tune will try to achieve</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>256.0</real>
</map>
<key>FSAutoTuneImpostorFarAwayDistance</key>
<map>
<key>Comment</key>
<string>Avatars beyond this range will automatically be optimized</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>64.0</real>
</map>
<key>FSTuningFPSStrategy</key>
<map>
<key>Comment</key>
<string>Stategy to use when tuning FPS. 0=Tune avatar rendering only, 1=Tune both avatar and global scene settings.</string>
<string>Strategy to use when tuning FPS. 0=Tune avatar rendering only, 1=Tune both avatar and global scene settings.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>

View File

@ -109,29 +109,24 @@ BOOL FSFloaterPerformance::postBuild()
mComplexityPanel = getChild<LLPanel>("panel_performance_complexity");
mSettingsPanel = getChild<LLPanel>("panel_performance_preferences");
mHUDsPanel = getChild<LLPanel>("panel_performance_huds");
// Doesn't exist
//mAutoTunePanel = getChild<LLPanel>("panel_performance_autotune");
mAutoTunePanel = getChild<LLPanel>("panel_performance_autotune");
getChild<LLPanel>("nearby_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mNearbyPanel));
getChild<LLPanel>("complexity_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mComplexityPanel));
getChild<LLPanel>("settings_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mSettingsPanel));
getChild<LLPanel>("huds_subpanel")->setMouseDownCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mHUDsPanel));
// Doesn't exist
//auto tgt_panel = getChild<LLPanel>("target_subpanel");
//if (tgt_panel)
//{
// tgt_panel->getChild<LLButton>("target_button")->setCommitCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mAutoTunePanel));
// // tgt_panel->getChild<LLTextBox>("fwd_lbl")->setShowCursorHand(false);
// // tgt_panel->getChild<LLTextBox>("fwd_lbl")->setSoundFlags(LLView::MOUSE_UP);
// // tgt_panel->getChild<LLTextBox>("fwd_lbl")->setClickedCallback(boost::bind(&FSFloaterPerformance::showSelectedPanel, this, mAutoTunePanel));
//}
auto tgt_panel = getChild<LLPanel>("target_subpanel");
if (tgt_panel)
{
tgt_panel->getChild<LLButton>("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<LLNameListCtrl>("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<LLButton>("back_btn")->setCommitCallback(boost::bind(&FSFloaterPerformance::showMainPanel, this));
panel->getChild<LLTextBox>("back_lbl")->setShowCursorHand(false);
panel->getChild<LLTextBox>("back_lbl")->setSoundFlags(LLView::MOUSE_UP);
panel->getChild<LLTextBox>("back_lbl")->setClickedCallback(boost::bind(&FSFloaterPerformance::showMainPanel, this));

View File

@ -79,7 +79,7 @@ private:
LLPanel* mComplexityPanel;
LLPanel* mHUDsPanel;
LLPanel* mSettingsPanel;
//LLPanel* mAutoTunePanel; // Doesn't exist
LLPanel* mAutoTunePanel;
LLNameListCtrl* mHUDList;
LLNameListCtrl* mObjectList;
LLNameListCtrl* mNearbyList;

View File

@ -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<LLVector3d> positions;
uuid_vec_t avatar_ids;
LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, our_pos, distance);
return positions.size();
}
// static
void StatsRecorder::updateAvatarParams()
{
static LLCachedControl<F32> drawDistance(gSavedSettings, "RenderFarClip");
static LLCachedControl<F32> userMinDrawDistance(gSavedSettings, "FSAutoTuneRenderFarClipMin");
static LLCachedControl<F32> userTargetDrawDistance(gSavedSettings, "FSAutoTuneRenderFarClipTarget");
static LLCachedControl<F32> impostorDistance(gSavedSettings, "FSAutoTuneImpostorFarAwayDistance");
static LLCachedControl<bool> impostorDistanceTuning(gSavedSettings, "FSAutoTuneImpostorByDistEnabled");
static LLCachedControl<U32> 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");

View File

@ -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<int64_t> 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<uint64_t, static_cast<size_t>(FSPerfStats::StatType_t::STATS_COUNT)>;
using StatsMap = std::unordered_map<LLUUID, StatsArray, FSUUIDHash>;

View File

@ -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="" />
<!--
<button
height="16"
width="16"
@ -215,7 +215,6 @@ Frame breakdown will appear here.
right="-20"
is_toggle="true">
</button>
-->
</panel>
</panel>
<panel
@ -498,7 +497,6 @@ HUDs
name="panel_performance_huds"
visible="false"
top="115" />
<!--
<panel
filename="panel_performance_autotune.xml"
follows="all"
@ -507,5 +505,4 @@ HUDs
name="panel_performance_autotune"
visible="false"
top="115" />
-->
</floater>

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
bevel_style="none"
follows="left|top"
height="530"
width="580"
name="panel_performance_autotune"
layout="topleft"
left="0"
top="0">
<button
height="16"
width="16"
layout="topleft"
mouse_opaque="true"
follows="left|top"
name="back_btn"
top="7"
image_selected="Arrow_Left_Off"
image_pressed="Arrow_Left_Off"
image_unselected="Arrow_Left_Off"
left="15"
is_toggle="true">
</button>
<text
follows="left|top"
height="20"
layout="topleft"
left_pad="3"
top="10"
name="back_lbl"
width="40">
Back
</text>
<text
follows="left|top"
font="SansSerifLarge"
text_color="white"
height="20"
layout="topleft"
left="20"
top_pad="10"
name="settings_title"
width="300">
Auto Tune Preferences
</text>
<view_border
bevel_style="in"
height="0"
layout="topleft"
name="border1"
left="20"
top_pad="8"
width="540" />
<text
follows="left|top"
font="SansSerifSmall"
text_color="White"
height="18"
layout="topleft"
top_pad="20"
left="20"
name="quality_lbl"
width="100">
Distant Avatars
</text>
<check_box
control_name="FSAutoTuneImpostorByDistEnabled"
height="19"
label="Enable distance based optimization"
layout="topleft"
follows="top|left"
left_pad="40"
name="FSAutoTuneImpostorByDistEnabled"
tool_tip="When enabled the viewer will adjust the MaxNonImpostors setting to limit fully rendered avatars to those within the defined radius."
top_delta="0"
width="190"
label_wrap="true" />
<spinner
control_name="FSAutoTuneImpostorFarAwayDistance"
height="20"
layout="topleft"
label="Farthest full avatar"
label_width="80"
label_wrap="true"
follows="top|left"
name="min_dd_autotune"
left_pad="40"
decimal_digits="2"
min_val="16"
max_val="256"
width="140" >
</spinner>
<text
follows="left|top"
font="SansSerifSmall"
text_color="White"
height="28"
layout="topleft"
top_pad="15"
left="160"
name="distant_av_advice"
width="450">
Avatars that are further away still have a high impact.
Control how far away an avatar should before being optimized.
</text>
<view_border
bevel_style="in"
height="0"
layout="topleft"
name="border2"
top_pad="8"
left="20"
width="540" />
<text
follows="left|top"
font="SansSerifSmall"
text_color="White"
height="36"
layout="topleft"
top_pad="20"
left="20"
name="distance_lbl"
width="100"
wrap="true">
Visibility distance tuning limits
</text>
<spinner
control_name="FSAutoTuneRenderFarClipMin"
height="20"
layout="topleft"
label="Minimum Distance"
label_width="80"
label_wrap="true"
top_delta="0"
follows="top|left"
name="min_dd_autotune"
decimal_digits="2"
left_pad="40"
min_val="32"
max_val="256"
width="140">
</spinner>
<spinner
control_name="FSAutoTuneRenderFarClipTarget"
height="20"
layout="topleft"
label="Preferred distance"
label_width="80"
label_wrap="true"
follows="top|left"
name="min_dd_autotune"
left_pad="20"
min_val="32"
max_val="256"
width="140">
</spinner>
<text
follows="left|top"
font="SansSerifSmall"
text_color="White"
height="38"
layout="topleft"
top_pad="15"
left="160"
name="distance_desc1"
wrap="true"
width="400">
When adjusting scene parameters, autotune will optimise draw distance to between the minimum and the preferred.
</text>
</panel>