summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-09-13 08:02:04 +0300
committerGitHub <noreply@github.com>2024-09-13 08:02:04 +0300
commit1e1010bbf27c57d8d5ec6701d08df50c21bd11d0 (patch)
treeeb3e48d624535b537dd26b3798acff669f39bfae /indra/newview
parenta3f6f98f1b79e3d57ae67114db409297cd625310 (diff)
parente71215dcfdb960f64a7f10d2fba71790f8e7bcd1 (diff)
Merge pull request #2545 for viewer#2529 Improve environment's performance
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llenvironment.cpp105
-rw-r--r--indra/newview/llsettingsvo.cpp79
-rw-r--r--indra/newview/llsettingsvo.h10
-rw-r--r--indra/newview/llviewerwindow.cpp16
4 files changed, 105 insertions, 105 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 0b4630dfc3..05bd704556 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -453,11 +453,11 @@ namespace
void applyInjections(LLSettingsBase::Seconds delta)
{
- this->mSettings = this->mSource->getSettings();
+ LLSD settings = this->mSource->cloneSettings();
for (auto ito = mOverrideValues.beginMap(); ito != mOverrideValues.endMap(); ++ito)
{
- this->mSettings[(*ito).first] = (*ito).second;
+ settings[(*ito).first] = (*ito).second;
}
const LLSettingsBase::stringset_t &slerps = this->getSlerpKeys();
@@ -469,7 +469,7 @@ namespace
{
std::string key_name = (*it)->mKeyName;
- LLSD value = this->mSettings[key_name];
+ LLSD value = settings[key_name];
LLSD target = (*it)->mValue;
if ((*it)->mFirstTime)
@@ -485,11 +485,11 @@ namespace
{
mOverrideValues[key_name] = target;
mOverrideExps[key_name] = (*it)->mExperience;
- this->mSettings[key_name] = target;
+ settings[key_name] = target;
}
else
{
- this->mSettings.erase(key_name);
+ settings.erase(key_name);
}
}
else if (specials.find(key_name) != specials.end())
@@ -500,8 +500,8 @@ namespace
{
if (!(*it)->mBlendIn)
mix = 1.0 - mix;
- (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, slerps);
- this->mSettings[key_name] = (*it)->mLastValue;
+ (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, skips, slerps);
+ settings[key_name] = (*it)->mLastValue;
}
}
@@ -520,7 +520,7 @@ namespace
{
mInjections.erase(mInjections.begin(), mInjections.end());
}
-
+ this->setSettings(settings);
}
bool hasInjections() const
@@ -685,7 +685,8 @@ namespace
if (!injection->mBlendIn)
mix = 1.0 - mix;
stringset_t dummy;
- F64 value = this->mSettings[injection->mKeyName].asReal();
+ LLSD settings = this->cloneSettings();
+ F64 value = settings[injection->mKeyName].asReal();
if (this->getCloudNoiseTextureId().isNull())
{
value = 0; // there was no texture so start from zero coverage
@@ -695,7 +696,8 @@ namespace
// with different transitions, don't ignore it
F64 result = lerp((F32)value, (F32)injection->mValue.asReal(), (F32)mix);
injection->mLastValue = LLSD::Real(result);
- this->mSettings[injection->mKeyName] = injection->mLastValue;
+ settings[injection->mKeyName] = injection->mLastValue;
+ this->setSettings(settings);
}
// Unfortunately I don't have a per texture blend factor. We'll just pick the one that is furthest along.
@@ -1740,90 +1742,9 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
{
uniforms[i].clear();
}
-
- LLShaderUniforms* shader = &uniforms[LLGLSLShader::SG_ANY];
- //_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
- LLSettingsBase::parammapping_t params = psetting->getParameterMap();
- for (auto &it: params)
- {
- LLSD value;
- // legacy first since it contains ambient color and we prioritize value from legacy, see getAmbientColor()
- if (psetting->mSettings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE].has(it.first))
- {
- value = psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE][it.first];
- }
- else if (psetting->mSettings.has(it.first))
- {
- value = psetting->mSettings[it.first];
- }
- else
- {
- // We need to reset shaders, use defaults
- value = it.second.getDefaultValue();
- }
-
- LLSD::Type setting_type = value.type();
- stop_glerror();
- switch (setting_type)
- {
- case LLSD::TypeInteger:
- shader->uniform1i(it.second.getShaderKey(), value.asInteger());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
- case LLSD::TypeReal:
- shader->uniform1f(it.second.getShaderKey(), (F32)value.asReal());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeBoolean:
- shader->uniform1i(it.second.getShaderKey(), value.asBoolean() ? 1 : 0);
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeArray:
- {
- LLVector4 vect4(value);
- // always identify as a radiance pass if desaturating irradiance is disabled
- static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
-
- if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
- { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
- auto max_vec = [](LLVector4 col)
- {
- LLColor3 color(col);
- F32 h, s, l;
- color.calcHSL(&h, &s, &l);
-
- col.mV[0] = col.mV[1] = col.mV[2] = l;
- return col;
- };
-
- switch (it.second.getShaderKey())
- {
- case LLShaderMgr::BLUE_HORIZON:
- case LLShaderMgr::BLUE_DENSITY:
- vect4 = max_vec(vect4);
- break;
- }
- }
-
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
- shader->uniform3fv(it.second.getShaderKey(), LLVector3(vect4.mV) );
- break;
- }
-
- // case LLSD::TypeMap:
- // case LLSD::TypeString:
- // case LLSD::TypeUUID:
- // case LLSD::TypeURI:
- // case LLSD::TypeBinary:
- // case LLSD::TypeDate:
- default:
- break;
- }
- }
//_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
+ psetting->applyToUniforms(uniforms);
psetting->applySpecial(uniforms);
}
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 6f9de57d2a..34b8535c84 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -549,7 +549,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
return skyp;
}
-LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const
+LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
{
LLSD settings = cloneSettings();
U32 flags = getFlags();
@@ -684,6 +684,67 @@ void LLSettingsVOSky::updateSettings()
gSky.setMoonScale(getMoonScale());
}
+void draw_color(LLShaderUniforms* shader, const LLColor3& col, S32 shader_key)
+{
+ // always identify as a radiance pass if desaturating irradiance is disabled
+ static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
+
+ LLVector4 vect4(col.mV[0], col.mV[1], col.mV[2]);
+
+ if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
+ { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
+ auto max_vec = [](LLVector4 col)
+ {
+ LLColor3 color(col);
+ F32 h, s, l;
+ color.calcHSL(&h, &s, &l);
+
+ col.mV[0] = col.mV[1] = col.mV[2] = l;
+ return col;
+ };
+
+ switch (shader_key)
+ {
+ case LLShaderMgr::BLUE_HORIZON:
+ case LLShaderMgr::BLUE_DENSITY:
+ vect4 = max_vec(vect4);
+ break;
+ }
+ }
+
+ //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
+ shader->uniform3fv(shader_key, LLVector3(vect4.mV));
+}
+
+inline void draw_real(LLShaderUniforms* shader, F32 value, S32 shader_key)
+{
+ shader->uniform1f(shader_key, value);
+}
+
+void LLSettingsVOSky::applyToUniforms(void* ptarget)
+{
+ LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_ANY];
+
+ draw_color(shader, getAmbientColor(), LLShaderMgr::AMBIENT);
+ draw_color(shader, getBlueDensity(), LLShaderMgr::BLUE_DENSITY);
+ draw_color(shader, getBlueHorizon(), LLShaderMgr::BLUE_HORIZON);
+ draw_real(shader, getHazeDensity(), LLShaderMgr::HAZE_DENSITY);
+ draw_real(shader, getHazeHorizon(), LLShaderMgr::HAZE_HORIZON);
+ draw_real(shader, getDensityMultiplier(), LLShaderMgr::DENSITY_MULTIPLIER);
+ draw_real(shader, getDistanceMultiplier(), LLShaderMgr::DISTANCE_MULTIPLIER);
+ draw_color(shader, getCloudPosDensity2(), LLShaderMgr::CLOUD_POS_DENSITY2);
+ draw_real(shader, getCloudScale(), LLShaderMgr::CLOUD_SCALE);
+ draw_real(shader, getCloudShadow(), LLShaderMgr::CLOUD_SHADOW);
+ draw_real(shader, getCloudVariance(), LLShaderMgr::CLOUD_VARIANCE);
+ draw_color(shader, getGlow(), LLShaderMgr::GLOW);
+ draw_real(shader, getMaxY(), LLShaderMgr::MAX_Y);
+ draw_real(shader, getMoonBrightness(), LLShaderMgr::MOON_BRIGHTNESS);
+ draw_real(shader, getSkyMoistureLevel(), LLShaderMgr::MOISTURE_LEVEL);
+ draw_real(shader, getSkyDropletRadius(), LLShaderMgr::DROPLET_RADIUS);
+ draw_real(shader, getSkyIceLevel(), LLShaderMgr::ICE_LEVEL);
+ draw_real(shader, getReflectionProbeAmbiance(), LLShaderMgr::REFLECTION_PROBE_AMBIANCE);
+}
+
void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
@@ -702,7 +763,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
// Legacy? SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate")
- LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
+ LLVector4 vect_c_p_d1(mCloudPosDensity1.mV[0], mCloudPosDensity1.mV[1], mCloudPosDensity1.mV[2]);
LLVector4 cloud_scroll( LLEnvironment::instance().getCloudScrollDelta() );
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
@@ -935,7 +996,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater()
return waterp;
}
-LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const
+LLSettingsWater::ptr_t LLSettingsVOWater::buildClone()
{
LLSD settings = cloneSettings();
U32 flags = getFlags();
@@ -974,6 +1035,12 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
+
+void LLSettingsVOWater::applyToUniforms(void*)
+{
+
+}
+
void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
@@ -1368,7 +1435,7 @@ void LLSettingsVODay::combineIntoDayCycle(LLSettingsDay::ptr_t pday, LLSettingsB
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
+LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
{
LLSD settings = cloneSettings();
@@ -1393,10 +1460,10 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
return dayp;
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const
+LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress()
{
// no need for SETTING_TRACKS or SETTING_FRAMES, so take base LLSD
- LLSD settings = llsd_clone(mSettings);
+ LLSD settings = llsd_clone(getSettings());
U32 flags = getFlags();
LLSettingsDay::ptr_t day_clone = std::make_shared<LLSettingsVODay>(settings);
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index c55b3f82b9..92cb8d0704 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -94,7 +94,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultSky();
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
@@ -110,6 +110,7 @@ protected:
virtual void updateSettings() override;
+ virtual void applyToUniforms(void*) override;
virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
@@ -128,7 +129,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultWater();
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
@@ -138,6 +139,7 @@ protected:
LLSettingsVOWater();
virtual void updateSettings() override;
+ virtual void applyToUniforms(void*) override;
virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
@@ -167,8 +169,8 @@ public:
static ptr_t buildDefaultDayCycle();
static ptr_t buildFromEnvironmentMessage(LLSD settings);
static void buildFromOtherSetting(LLSettingsBase::ptr_t settings, asset_built_fn cb);
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
- virtual ptr_t buildDeepCloneAndUncompress() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
+ virtual ptr_t buildDeepCloneAndUncompress() SETTINGS_OVERRIDE;
static LLSD convertToLegacy(const ptr_t &);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 1be80a5e02..0e7d82fd90 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -3888,7 +3888,9 @@ void LLViewerWindow::updateKeyboardFocus()
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (cur_focus)
{
- if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
+ bool is_in_visible_chain = cur_focus->isInVisibleChain();
+ bool is_in_enabled_chain = cur_focus->isInEnabledChain();
+ if (!is_in_visible_chain || !is_in_enabled_chain)
{
// don't release focus, just reassign so that if being given
// to a sibling won't call onFocusLost on all the ancestors
@@ -3899,11 +3901,19 @@ void LLViewerWindow::updateKeyboardFocus()
bool new_focus_found = false;
while(parent)
{
+ if (!is_in_visible_chain)
+ {
+ is_in_visible_chain = parent->isInVisibleChain();
+ }
+ if (!is_in_enabled_chain)
+ {
+ is_in_enabled_chain = parent->isInEnabledChain();
+ }
if (parent->isCtrl()
&& (parent->hasTabStop() || parent == focus_root)
&& !parent->getIsChrome()
- && parent->isInVisibleChain()
- && parent->isInEnabledChain())
+ && is_in_visible_chain
+ && is_in_enabled_chain)
{
if (!parent->focusFirstItem())
{