SL-14142 - impostor management cleanup

master
Brad Payne (Vir Linden) 2020-10-20 13:51:58 +01:00
parent b6b3e30df3
commit caea7260c7
9 changed files with 27 additions and 31 deletions

View File

@ -30,7 +30,6 @@
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 1024;
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 1024;
const S32 LLAvatarAppearanceDefines::IMPOSTOR_PERIOD = 2;
using namespace LLAvatarAppearanceDefines;

View File

@ -39,7 +39,6 @@ namespace LLAvatarAppearanceDefines
extern const S32 SCRATCH_TEX_WIDTH;
extern const S32 SCRATCH_TEX_HEIGHT;
extern const S32 IMPOSTOR_PERIOD;
static const U32 AVATAR_HOVER = 11001;

View File

@ -1485,7 +1485,7 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>*
LLVOAvatar* avatarp = (LLVOAvatar*) objparent;
if (avatarp->isVisible())
{
impostor = objparent->isAvatar() && !LLPipeline::sImpostorRenderAVVO && ((LLVOAvatar*) objparent)->isImpostor();
impostor = objparent->isAvatar() && !LLPipeline::sImpostorRender && ((LLVOAvatar*) objparent)->isImpostor();
loaded = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isFullyLoaded();
}
else
@ -1570,7 +1570,7 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
if (mDrawable->getVObj())
{
// Don't update if we are part of impostor, unles it's an impostor pass
if (!LLPipeline::sImpostorRenderAVVO && mDrawable->getVObj()->isAttachment())
if (!LLPipeline::sImpostorRender && mDrawable->getVObj()->isAttachment())
{
LLDrawable* parent = mDrawable->getParent();
if (parent && parent->getVObj())

View File

@ -574,7 +574,7 @@ void LLDrawPoolAvatar::renderShadow(S32 pass)
return;
}
LLVOAvatar::AvatarOverallAppearance oa = avatarp->getOverallAppearance();
BOOL impostor = !LLPipeline::sImpostorRenderAVVO && avatarp->isImpostor();
BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor();
if (oa == LLVOAvatar::AOA_INVISIBLE ||
(impostor && oa == LLVOAvatar::AOA_JELLYDOLL))
{
@ -1511,7 +1511,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
return;
}
BOOL impostor = !LLPipeline::sImpostorRenderAVVO && avatarp->isImpostor() && !single_avatar;
BOOL impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor() && !single_avatar;
if (( avatarp->isInMuteList()
|| impostor

View File

@ -1473,7 +1473,7 @@ void LLAvatarComplexityControls::setIndirectMaxNonImpostors()
{
U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors");
// for this one, we just need to make zero, which means off, the max value of the slider
U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::IMPOSTORS_OFF : max_non_impostors;
U32 indirect_max_non_impostors = (0 == max_non_impostors) ? LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER : max_non_impostors;
gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors);
}
@ -1973,7 +1973,7 @@ void LLFloaterPreferenceGraphicsAdvanced::updateMaxNonImpostors()
LLSliderCtrl* ctrl = getChild<LLSliderCtrl>("IndirectMaxNonImpostors",true);
U32 value = ctrl->getValue().asInteger();
if (0 == value || LLVOAvatar::IMPOSTORS_OFF <= value)
if (0 == value || LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER <= value)
{
value=0;
}

View File

@ -4029,7 +4029,7 @@ void LLVOAvatar::computeUpdatePeriod()
// impostor camera near clip plane
mUpdatePeriod = 1;
}
else if ( shouldImpostor(4) )
else if ( shouldImpostor(4.0) )
{ //background avatars are REALLY slow updating impostors
mUpdatePeriod = 16;
}
@ -4038,7 +4038,7 @@ void LLVOAvatar::computeUpdatePeriod()
// Don't update cloud avatars too often
mUpdatePeriod = 8;
}
else if ( shouldImpostor(3) )
else if ( shouldImpostor(3.0) )
{ //back 25% of max visible avatars are slow updating impostors
mUpdatePeriod = 8;
}
@ -4046,7 +4046,7 @@ void LLVOAvatar::computeUpdatePeriod()
{ // stuff in between gets an update period based on pixel area
mUpdatePeriod = llclamp((S32) sqrtf(impostor_area*4.f/mImpostorPixelArea), 2, 8);
}
else
else // shouldImpostor() at some rank in range (1.0-3.0)
{
//nearby avatars, update the impostors more frequently.
mUpdatePeriod = 4;
@ -10063,7 +10063,7 @@ BOOL LLVOAvatar::updateLOD()
return FALSE;
}
if (!LLPipeline::sImpostorRenderAVVO && isImpostor() && 0 != mDrawable->getNumFaces() && mDrawable->getFace(0)->hasGeometry())
if (!LLPipeline::sImpostorRender && isImpostor() && 0 != mDrawable->getNumFaces() && mDrawable->getFace(0)->hasGeometry())
{
return TRUE;
}
@ -10253,7 +10253,6 @@ void LLVOAvatar::updateImpostors()
for (std::vector<LLCharacter*>::iterator iter = instances_copy.begin();
iter != instances_copy.end(); ++iter)
{
// FIXME state spaghetti! Can we just use shouldImpostor() here?
LLVOAvatar* avatar = (LLVOAvatar*) *iter;
if (!avatar->isDead()
&& avatar->isVisible()
@ -10271,17 +10270,20 @@ void LLVOAvatar::updateImpostors()
// virtual
BOOL LLVOAvatar::isImpostor()
{
// FIXME this doesn't seem to actually mean that the avatar is currently shown as an impostor, or should be.
// un-impostored avs have mUpdatePeriod 1. IMPOSTOR_PERIOD is 2.
//return sUseImpostors && (isVisuallyMuted() || (mUpdatePeriod >= IMPOSTOR_PERIOD));
return (isVisuallyMuted() || (sUseImpostors && (mUpdatePeriod >= IMPOSTOR_PERIOD))) ? TRUE : FALSE;
return isVisuallyMuted() || (sUseImpostors && (mUpdatePeriod > 1));
}
BOOL LLVOAvatar::shouldImpostor(const U32 rank_factor)
BOOL LLVOAvatar::shouldImpostor(const F32 rank_factor)
{
// FIXME sUseImpostors question
//return (!isSelf() && sUseImpostors && mVisibilityRank > (sMaxNonImpostors * rank_factor));
return (!isSelf() && (sUseImpostors || isVisuallyMuted()) && mVisibilityRank > (sMaxNonImpostors * rank_factor));
if (isSelf())
{
return false;
}
if (isVisuallyMuted())
{
return true;
}
return sUseImpostors && (mVisibilityRank > (sMaxNonImpostors * rank_factor));
}
BOOL LLVOAvatar::needsImpostorUpdate() const
@ -10324,7 +10326,7 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d
}
// static
const U32 LLVOAvatar::IMPOSTORS_OFF = 66; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
const U32 LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER = 66; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
* slider in panel_preferences_graphics1.xml */
// static
@ -10333,7 +10335,7 @@ void LLVOAvatar::updateImpostorRendering(U32 newMaxNonImpostorsValue)
U32 oldmax = sMaxNonImpostors;
bool oldflg = sUseImpostors;
if (IMPOSTORS_OFF <= newMaxNonImpostorsValue)
if (NON_IMPOSTORS_MAX_SLIDER <= newMaxNonImpostorsValue)
{
sMaxNonImpostors = 0;
}

View File

@ -315,8 +315,8 @@ public:
public:
static S32 sRenderName;
static BOOL sRenderGroupTitles;
static const U32 IMPOSTORS_OFF; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
* slider in panel_preferences_graphics1.xml */
static const U32 NON_IMPOSTORS_MAX_SLIDER; /* Must equal the maximum allowed the RenderAvatarMaxNonImpostors
* slider in panel_preferences_graphics1.xml */
static U32 sMaxNonImpostors; //(affected by control "RenderAvatarMaxNonImpostors")
static F32 sRenderDistance; //distance at which avatars will render.
static BOOL sShowAnimationDebug; // show animation debug info
@ -554,7 +554,7 @@ private:
//--------------------------------------------------------------------
public:
virtual BOOL isImpostor();
BOOL shouldImpostor(const U32 rank_factor = 1);
BOOL shouldImpostor(const F32 rank_factor = 1.0);
BOOL needsImpostorUpdate() const;
const LLVector3& getImpostorOffset() const;
const LLVector2& getImpostorDim() const;

View File

@ -340,7 +340,6 @@ bool LLPipeline::sRenderGlow = false;
bool LLPipeline::sReflectionRender = false;
bool LLPipeline::sDistortionRender = false;
bool LLPipeline::sImpostorRender = false;
bool LLPipeline::sImpostorRenderAVVO = false;
bool LLPipeline::sImpostorRenderAlphaDepthPass = false;
bool LLPipeline::sUnderWaterRender = false;
bool LLPipeline::sTextureBindTest = false;
@ -3077,7 +3076,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
{
LLVOAvatar* av = vobj->asAvatar();
if (av &&
((!sImpostorRenderAVVO && av->isImpostor()) //ignore impostor flag during impostor pass
((!sImpostorRender && av->isImpostor()) //ignore impostor flag during impostor pass
|| av->isInMuteList()
|| (LLVOAvatar::AOA_JELLYDOLL == av->getOverallAppearance() && !av->needsImpostorUpdate()) ))
{
@ -10921,7 +10920,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
{
LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_MARK_VISIBLE);
markVisible(avatar->mDrawable, *viewer_camera);
sImpostorRenderAVVO = true;
LLVOAvatar::attachment_map_t::iterator iter;
for (iter = avatar->mAttachmentPoints.begin();
@ -11161,7 +11159,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
avatar->setImpostorDim(tdim);
sImpostorRenderAVVO = false;
sUseOcclusion = occlusion;
sReflectionRender = false;
sImpostorRender = false;

View File

@ -590,7 +590,6 @@ public:
static bool sReflectionRender;
static bool sDistortionRender;
static bool sImpostorRender;
static bool sImpostorRenderAVVO;
static bool sImpostorRenderAlphaDepthPass;
static bool sUnderWaterRender;
static bool sRenderGlow;