From 0a110ff0833216b167e032987b0d676f29ad0ee5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 11 Sep 2024 18:21:03 +0300 Subject: viewer#2529 Track interpolateSDMap's performance viewer#2529 Fix initialization --- indra/llinventory/llsettingsbase.cpp | 8 ++++---- indra/llinventory/llsettingsbase.h | 4 ++-- indra/llinventory/llsettingsdaycycle.cpp | 2 ++ indra/llinventory/llsettingssky.cpp | 24 +++++++++++++++++++++++- indra/llinventory/llsettingssky.h | 1 + indra/llinventory/llsettingswater.cpp | 3 +++ indra/llinventory/llsettingswater.h | 13 +++++++++++++ 7 files changed, 48 insertions(+), 7 deletions(-) diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 8575ac6920..f7151403b4 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -69,23 +69,21 @@ const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), mDirty(true), - mLLSDDirty(false), + mLLSDDirty(true), mReplaced(false), mBlendedFactor(0.0), mSettingFlags(0) { - loadValuesFromLLSD(); } LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), - mLLSDDirty(false), + mLLSDDirty(true), mDirty(true), mReplaced(false), mBlendedFactor(0.0), mSettingFlags(0) { - loadValuesFromLLSD(); } //virtual @@ -134,6 +132,7 @@ void LLSettingsBase::saveValuesIfNeeded() //========================================================================= void LLSettingsBase::lerpSettings(LLSettingsBase &other, F64 mix) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; saveValuesIfNeeded(); stringset_t skip = getSkipInterpolateKeys(); stringset_t slerps = getSlerpKeys(); @@ -437,6 +436,7 @@ bool LLSettingsBase::validate() saveValuesIfNeeded(); LLSD result = LLSettingsBase::settingValidation(mSettings, validations); + loadValuesFromLLSD(); if (result["errors"].size() > 0) { diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index c2867f32d9..dc2a745fa0 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -125,6 +125,7 @@ public: inline void setName(std::string val) { mSettingName = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -141,6 +142,7 @@ public: inline void setFlags(U32 value) { mSettingFlags = value; + setDirtyFlag(true); setLLSDDirty(); } @@ -183,8 +185,6 @@ public: virtual void setLLSDDirty() { mLLSDDirty = true; - mDirty = true; - clearAssetId(); } //--------------------------------------------------------------------- diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 19d1bb1907..2b189e7cca 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -128,6 +128,7 @@ LLSettingsDay::LLSettingsDay(const LLSD &data) : mDaySettings(LLSD::emptyMap()) { mDayTracks.resize(TRACK_MAX); + loadValuesFromLLSD(); } LLSettingsDay::LLSettingsDay() : @@ -136,6 +137,7 @@ LLSettingsDay::LLSettingsDay() : mDaySettings(LLSD::emptyMap()) { mDayTracks.resize(TRACK_MAX); + replaceSettings(defaults()); } //========================================================================= diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 272219c02d..548c1b30e1 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -407,6 +407,7 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : mNextRainbowTextureId(), mNextHaloTextureId() { + loadValuesFromLLSD(); } LLSettingsSky::LLSettingsSky(): @@ -418,6 +419,7 @@ LLSettingsSky::LLSettingsSky(): mNextRainbowTextureId(), mNextHaloTextureId() { + replaceSettings(defaults()); } void LLSettingsSky::replaceSettings(LLSD settings) @@ -460,7 +462,6 @@ void LLSettingsSky::blend(LLSettingsBase::ptr_t &end, F64 blendf) // Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one // see getColor(), we are about to replaceSettings(), so we are free to set it LLColor3 ambient = getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); - setAmbientColor(ambient); settings[SETTING_LEGACY_HAZE][SETTING_AMBIENT] = ambient.getValue(); } } @@ -974,6 +975,7 @@ F32 get_float(bool &use_legacy, LLSD& settings, std::string key, F32 default_val { return (F32)settings[key].asReal(); } + use_legacy = true; return default_value; } @@ -989,6 +991,7 @@ LLColor3 get_color(bool& use_legacy, LLSD& settings, const std::string& key, con { return LLColor3(settings[key]); } + use_legacy = true; return default_value; } @@ -1046,6 +1049,7 @@ void LLSettingsSky::loadValuesFromLLSD() mPlanetRadius = (F32)settings[SETTING_PLANET_RADIUS].asReal(); // special case for legacy handling + mHasLegacyHaze = settings.has(LLSettingsSky::SETTING_LEGACY_HAZE); mDistanceMultiplier = get_float(mLegacyDistanceMultiplier, settings, SETTING_DISTANCE_MULTIPLIER, 0.8f); mDensityMultiplier = get_float(mLegacyDensityMultiplier, settings, SETTING_DENSITY_MULTIPLIER, 0.0001f); mHazeHorizon = get_float(mLegacyHazeHorizon, settings, SETTING_HAZE_HORIZON, 0.19f); @@ -1053,6 +1057,14 @@ void LLSettingsSky::loadValuesFromLLSD() mBlueHorizon = get_color(mLegacyBlueHorizon, settings, SETTING_BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f)); mBlueDensity = get_color(mLegacyBlueDensity, settings, SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f)); mAmbientColor = get_color(mLegacyAmbientColor, settings, SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); + // one of these values might be true despite not having SETTING_LEGACY_HAZE if defaults were used + mHasLegacyHaze |= mLegacyDistanceMultiplier + || mLegacyDensityMultiplier + || mLegacyHazeHorizon + || mLegacyHazeDensity + || mLegacyBlueHorizon + || mLegacyBlueDensity + || mLegacyAmbientColor; } void LLSettingsSky::saveValuesToLLSD() @@ -1344,6 +1356,7 @@ void LLSettingsSky::setAmbientColor(const LLColor3 &val) mAmbientColor = val; mLegacyAmbientColor = true; setDirtyFlag(true); + setLLSDDirty(); } void LLSettingsSky::setBlueDensity(const LLColor3 &val) @@ -1351,6 +1364,7 @@ void LLSettingsSky::setBlueDensity(const LLColor3 &val) mBlueDensity = val; mLegacyBlueDensity = true; setDirtyFlag(true); + setLLSDDirty(); } void LLSettingsSky::setBlueHorizon(const LLColor3 &val) @@ -1358,6 +1372,7 @@ void LLSettingsSky::setBlueHorizon(const LLColor3 &val) mBlueHorizon = val; mLegacyBlueHorizon = true; setDirtyFlag(true); + setLLSDDirty(); } void LLSettingsSky::setDensityMultiplier(F32 val) @@ -1365,6 +1380,7 @@ void LLSettingsSky::setDensityMultiplier(F32 val) mDensityMultiplier = val; mLegacyDensityMultiplier = true; setDirtyFlag(true); + setLLSDDirty(); } void LLSettingsSky::setDistanceMultiplier(F32 val) @@ -1372,6 +1388,7 @@ void LLSettingsSky::setDistanceMultiplier(F32 val) mDistanceMultiplier = val; mLegacyDistanceMultiplier = true; setDirtyFlag(true); + setLLSDDirty(); } void LLSettingsSky::setHazeDensity(F32 val) @@ -1379,6 +1396,7 @@ void LLSettingsSky::setHazeDensity(F32 val) mHazeDensity = val; mLegacyHazeDensity = true; setDirtyFlag(true); + setLLSDDirty(); } void LLSettingsSky::setHazeHorizon(F32 val) @@ -1386,6 +1404,7 @@ void LLSettingsSky::setHazeHorizon(F32 val) mHazeHorizon = val; mLegacyHazeHorizon = true; setDirtyFlag(true); + setLLSDDirty(); } // Get total from rayleigh and mie density values for normalization @@ -1800,12 +1819,14 @@ void LLSettingsSky::setCloudScrollRate(const LLVector2 &val) void LLSettingsSky::setCloudScrollRateX(F32 val) { mScrollRate.mV[0] = val; + setDirtyFlag(true); setLLSDDirty(); } void LLSettingsSky::setCloudScrollRateY(F32 val) { mScrollRate.mV[1] = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -1851,6 +1872,7 @@ F32 LLSettingsSky::getGamma() const void LLSettingsSky::setGamma(F32 val) { mGamma = val; + setDirtyFlag(true); setLLSDDirty(); } LLColor3 LLSettingsSky::getGlow() const diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index dc8e620f47..535c4722ef 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -402,6 +402,7 @@ protected: LLColor3 mBlueDensity; LLColor3 mAmbientColor; + bool mHasLegacyHaze; bool mLegacyHazeHorizon; bool mLegacyHazeDensity; bool mLegacyDistanceMultiplier; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 6127a523ae..cad0b41d67 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -70,12 +70,14 @@ LLSettingsWater::LLSettingsWater(const LLSD &data) : LLSettingsBase(data), mNextNormalMapID() { + loadValuesFromLLSD(); } LLSettingsWater::LLSettingsWater() : LLSettingsBase(), mNextNormalMapID() { + replaceSettings(defaults()); } //========================================================================= @@ -229,6 +231,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) void LLSettingsWater::blend(LLSettingsBase::ptr_t &end, F64 blendf) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT; LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast(end); if (other) { diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 0f2a62bba2..9d229e6a0b 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -81,6 +81,7 @@ public: void setBlurMultiplier(F32 val) { mBlurMultiplier = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -92,6 +93,7 @@ public: void setWaterFogColor(LLColor3 val) { mWaterFogColor = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -105,6 +107,7 @@ public: void setWaterFogDensity(F32 val) { mWaterFogDensity = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -116,6 +119,7 @@ public: void setFogMod(F32 val) { mFogMod = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -127,6 +131,7 @@ public: void setFresnelOffset(F32 val) { mFresnelOffset = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -138,6 +143,7 @@ public: void setFresnelScale(F32 val) { mFresnelScale = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -149,6 +155,7 @@ public: void setTransparentTextureID(LLUUID val) { mTransparentTextureID = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -160,6 +167,7 @@ public: void setNormalMapID(LLUUID val) { mNormalMapID = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -171,6 +179,7 @@ public: void setNormalScale(LLVector3 val) { mNormalScale = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -182,6 +191,7 @@ public: void setScaleAbove(F32 val) { mScaleAbove = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -193,6 +203,7 @@ public: void setScaleBelow(F32 val) { mScaleBelow = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -204,6 +215,7 @@ public: void setWave1Dir(LLVector2 val) { mWave1Dir = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -215,6 +227,7 @@ public: void setWave2Dir(LLVector2 val) { mWave2Dir = val; + setDirtyFlag(true); setLLSDDirty(); } -- cgit v1.2.3