From d2dce17803a545378407d6b7c62fdcd3007a92bc Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 19 Oct 2021 02:26:41 +0000 Subject: SL-16197 Optimize LLEnvironment handling of shader uniforms. Instrument LLSD. Enable Fast Timers when Tracy is enabled to catch Fast Timer overhead. --- indra/llinventory/llsettingsbase.cpp | 4 ++++ indra/llinventory/llsettingssky.cpp | 3 +++ 2 files changed, 7 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 61b59e35aa..89a4eebf26 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -683,6 +683,7 @@ bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, S32 length) //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { + LL_PROFILE_ZONE_SCOPED; F64 res = setBlendFactor(blendf); llassert(res >= 0.0 && res <= 1.0); (void)res; @@ -713,6 +714,7 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ void LLSettingsBlender::triggerComplete() { + LL_PROFILE_ZONE_SCOPED; if (mTarget) mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon @@ -725,11 +727,13 @@ const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(FL LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { + LL_PROFILE_ZONE_SCOPED; return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } bool LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { + LL_PROFILE_ZONE_SCOPED; mTimeSpent += timedelta; if (mTimeSpent > mBlendSpan) diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 81937dbda5..00c1edb55a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -444,6 +444,7 @@ void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother) void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { + LL_PROFILE_ZONE_SCOPED; llassert(getSettingsType() == end->getSettingsType()); LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); @@ -1022,6 +1023,7 @@ LLColor3 LLSettingsSky::getLightDiffuse() const LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const { + LL_PROFILE_ZONE_SCOPED; if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) { return LLColor3(mSettings[SETTING_LEGACY_HAZE][key]); @@ -1035,6 +1037,7 @@ LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const { + LL_PROFILE_ZONE_SCOPED; if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) { return mSettings[SETTING_LEGACY_HAZE][key].asReal(); -- cgit v1.2.3 From a172c9d9cf358c3d9329a1777e30f627f50d5aaa Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 21 Oct 2021 16:46:06 -0700 Subject: SL-16127: Replace slow getLightTransmittance with faster version --- indra/llinventory/llsettingssky.cpp | 8 ++++++++ indra/llinventory/llsettingssky.h | 1 + 2 files changed, 9 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 81937dbda5..69b4a4929d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1206,6 +1206,14 @@ LLColor3 LLSettingsSky::getLightTransmittance(F32 distance) const return transmittance; } +// SL-16127: getTotalDensity() and getDensityMultiplier() call LLSettingsSky::getColor() and LLSettingsSky::getFloat() respectively which are S-L-O-W +LLColor3 LLSettingsSky::getLightTransmittanceFast( const LLColor3& total_density, const F32 density_multiplier, const F32 distance ) const +{ + // Transparency (-> density) from Beer's law + LLColor3 transmittance = componentExp(total_density * -(density_multiplier * distance)); + return transmittance; +} + // performs soft scale clip and gamma correction ala the shader implementation // scales colors down to 0 - 1 range preserving relative ratios LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 4127911643..77d9d8e87c 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -252,6 +252,7 @@ public: LLColor3 getLightAttenuation(F32 distance) const; LLColor3 getLightTransmittance(F32 distance) const; + LLColor3 getLightTransmittanceFast(const LLColor3& total_density, const F32 density_multiplier, const F32 distance) const; LLColor3 getTotalDensity() const; LLColor3 gammaCorrect(const LLColor3& in) const; -- cgit v1.2.3 From ad91d0fd92bdcb6b4dcd24fda1cdb08d4b9ad97e Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 26 Oct 2021 22:09:27 -0700 Subject: SL-16127: Make another pass removing redundant LLSD op [] calls, unused vars, and use atmospheric already calculated --- indra/llinventory/llsettingssky.cpp | 4 ++-- indra/llinventory/llsettingssky.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 82c67a1066..bdcf35faae 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1219,9 +1219,9 @@ LLColor3 LLSettingsSky::getLightTransmittanceFast( const LLColor3& total_density // performs soft scale clip and gamma correction ala the shader implementation // scales colors down to 0 - 1 range preserving relative ratios -LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const +LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in,const F32 &gamma) const { - F32 gamma = getGamma(); + //F32 gamma = getGamma(); // SL-16127: Use cached gamma from atmospheric vars LLColor3 v(in); // scale down to 0 to 1 range preserving relative ratio (aka homegenize) diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 77d9d8e87c..fa9326f006 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -254,7 +254,7 @@ public: LLColor3 getLightTransmittance(F32 distance) const; LLColor3 getLightTransmittanceFast(const LLColor3& total_density, const F32 density_multiplier, const F32 distance) const; LLColor3 getTotalDensity() const; - LLColor3 gammaCorrect(const LLColor3& in) const; + LLColor3 gammaCorrect(const LLColor3& in,const F32 &gamma) const; LLColor3 getBlueDensity() const; LLColor3 getBlueHorizon() const; -- cgit v1.2.3 From 8d20480c5f77fe1fab8149d3cda79bdd61e77656 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 28 Oct 2021 18:06:21 +0000 Subject: SL-16148 SL-16244 SL-16270 SL-16253 Remove most BlockTimers, remove LLMemTracked, introduce alignas, hook most/all reamining allocs, disable synchronous occlusion, and convert frequently accessed LLSingletons to LLSimpleton --- indra/llinventory/llinventory.cpp | 24 +++--------------------- indra/llinventory/llinventory.h | 2 +- indra/llinventory/llsettingsdaycycle.cpp | 3 --- indra/llinventory/llsettingssky.cpp | 7 +------ indra/llinventory/llsettingswater.cpp | 8 -------- 5 files changed, 5 insertions(+), 39 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 18bc1b5a91..81261f0767 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -74,20 +74,17 @@ LLInventoryObject::LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType type, const std::string& name) -: LLTrace::MemTrackable("LLInventoryObject"), - mUUID(uuid), +: mUUID(uuid), mParentUUID(parent_uuid), mType(type), mName(name), mCreationDate(0) { - claimMem(mName); correctInventoryName(mName); } LLInventoryObject::LLInventoryObject() -: LLTrace::MemTrackable("LLInventoryObject"), - mType(LLAssetType::AT_NONE), +: mType(LLAssetType::AT_NONE), mCreationDate(0) { } @@ -101,9 +98,7 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other) mUUID = other->mUUID; mParentUUID = other->mParentUUID; mType = other->mType; - disclaimMem(mName); mName = other->mName; - claimMem(mName); } const LLUUID& LLInventoryObject::getUUID() const @@ -156,9 +151,7 @@ void LLInventoryObject::rename(const std::string& n) correctInventoryName(new_name); if( !new_name.empty() && new_name != mName ) { - disclaimMem(mName); mName = new_name; - claimMem(mName); } } @@ -311,7 +304,6 @@ LLInventoryItem::LLInventoryItem(const LLUUID& uuid, LLStringUtil::replaceNonstandardASCII(mDescription, ' '); LLStringUtil::replaceChar(mDescription, '|', ' '); - claimMem(mDescription); mPermissions.initMasks(inv_type); } @@ -344,9 +336,7 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other) copyObject(other); mPermissions = other->mPermissions; mAssetUUID = other->mAssetUUID; - disclaimMem(mDescription); mDescription = other->mDescription; - claimMem(mDescription); mSaleInfo = other->mSaleInfo; mInventoryType = other->mInventoryType; mFlags = other->mFlags; @@ -426,9 +416,7 @@ void LLInventoryItem::setDescription(const std::string& d) LLInventoryItem::correctInventoryDescription(new_desc); if( new_desc != mDescription ) { - disclaimMem(mDescription); mDescription = new_desc; - claimMem(mDescription); } } @@ -708,10 +696,8 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) valuestr[0] = '\000'; } - disclaimMem(mDescription); mDescription.assign(valuestr); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); - claimMem(mDescription); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') @@ -840,11 +826,9 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; } -LLTrace::BlockTimerStatHandle FTM_INVENTORY_SD_DESERIALIZE("Inventory SD Deserialize"); - bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) { - LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SD_DESERIALIZE); + LL_PROFILE_ZONE_SCOPED; if (is_new) { // If we're adding LLSD to an existing object, need avoid @@ -961,10 +945,8 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) w = INV_DESC_LABEL; if (sd.has(w)) { - disclaimMem(mDescription); mDescription = sd[w].asString(); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); - claimMem(mDescription); } w = INV_CREATION_DATE_LABEL; if (sd.has(w)) diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 0f336a072f..7d9f9704f1 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -44,7 +44,7 @@ class LLMessageSystem; // Base class for anything in the user's inventory. Handles the common code // between items and categories. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryObject : public LLRefCount, public LLTrace::MemTrackable +class LLInventoryObject : public LLRefCount { public: typedef std::list > object_list_t; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index a687fd840d..b390ea5b1e 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -41,9 +41,6 @@ //========================================================================= namespace { - LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment Day"); - LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment Day"); - template inline T get_wrapping_distance(T begin, T end) { diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 82c67a1066..23f9c8e9d7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -66,11 +66,6 @@ namespace { } } -static LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); -static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_SKYVALUES("Recalculate Sky"); -static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_BODIES("Recalculate Heavenly Bodies"); -static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_LIGHTING("Recalculate Lighting"); - //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); @@ -940,7 +935,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_SKYVALUES); + LL_PROFILE_ZONE_SCOPED; // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 0eb95dcd89..16cd3343e4 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -33,14 +33,6 @@ #include "v3colorutil.h" #include "indra_constants.h" -//========================================================================= -namespace -{ - LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); - LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); -} - -//========================================================================= const std::string LLSettingsWater::SETTING_BLUR_MULTIPLIER("blur_multiplier"); const std::string LLSettingsWater::SETTING_FOG_COLOR("water_fog_color"); const std::string LLSettingsWater::SETTING_FOG_DENSITY("water_fog_density"); -- cgit v1.2.3 From 2178d9fa57acddc62123a764e8313b835140748d Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 13 Jan 2022 11:59:34 -0800 Subject: SL-16606: Add profiler category ENVIRONMENT --- indra/llinventory/llsettingsbase.cpp | 8 ++++---- indra/llinventory/llsettingssky.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index aed972b150..936b166409 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -683,7 +683,7 @@ bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, U32, S32 length) //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; F64 res = setBlendFactor(blendf); llassert(res >= 0.0 && res <= 1.0); (void)res; @@ -714,7 +714,7 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ void LLSettingsBlender::triggerComplete() { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; if (mTarget) mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon @@ -727,13 +727,13 @@ const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(FL LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } bool LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; mTimeSpent += timedelta; if (mTimeSpent > mBlendSpan) diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 979a284744..83a92f08d0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -439,7 +439,7 @@ void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother) void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; llassert(getSettingsType() == end->getSettingsType()); LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); @@ -935,7 +935,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); @@ -1018,7 +1018,7 @@ LLColor3 LLSettingsSky::getLightDiffuse() const LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) { return LLColor3(mSettings[SETTING_LEGACY_HAZE][key]); @@ -1032,7 +1032,7 @@ LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) { return mSettings[SETTING_LEGACY_HAZE][key].asReal(); -- cgit v1.2.3