From 9480ee9a4dbb5247029ec840a58e40db9c43f69a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 31 Aug 2018 16:05:06 +0300 Subject: MAINT-9064 Fix crash caused by new shader calls --- indra/newview/lldrawpoolwlsky.cpp | 71 +++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 37 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 4bf47f4fd6..2ae361eb4d 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -389,23 +389,23 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() if (can_use_vertex_shaders) { sun_shader->bind(); - } - if (tex_a && (!tex_b || (tex_a == tex_b))) - { - // Bind current and next sun textures - sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b && !tex_a) - { - sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b != tex_a) - { - sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - sun_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + if (tex_a && (!tex_b || (tex_a == tex_b))) + { + // Bind current and next sun textures + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b && !tex_a) + { + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b != tex_a) + { + sun_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + sun_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + } } LLColor4 color(gSky.mVOSkyp->getSun().getInterpColor()); @@ -439,29 +439,26 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() LLColor4 color(gSky.mVOSkyp->getMoon().getInterpColor()); if (can_use_vertex_shaders) - { - moon_shader->bind(); - } - - if (tex_a && (!tex_b || (tex_a == tex_b))) - { - // Bind current and next sun textures - moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b && !tex_a) { - moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); - blend_factor = 0; - } - else if (tex_b != tex_a) - { - moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); - moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); - } + moon_shader->bind(); + + if (tex_a && (!tex_b || (tex_a == tex_b))) + { + // Bind current and next sun textures + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b && !tex_a) + { + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + blend_factor = 0; + } + else if (tex_b != tex_a) + { + moon_shader->bindTexture(LLShaderMgr::DIFFUSE_MAP, tex_a, LLTexUnit::TT_TEXTURE); + moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); + } - if (can_use_vertex_shaders) - { moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); } -- cgit v1.2.3 From c46b70c25770a7421486498df6a280c00bae5a2d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 31 Aug 2018 16:33:57 +0100 Subject: Null out shader pointers after passes are complete (prevents them being non-null and masking crashes when graphics prefs change). --- indra/newview/lldrawpoolwlsky.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 4bf47f4fd6..9defc33e30 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -91,6 +91,10 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass ) void LLDrawPoolWLSky::endRenderPass( S32 pass ) { + sky_shader = nullptr; + cloud_shader = nullptr; + sun_shader = nullptr; + moon_shader = nullptr; } void LLDrawPoolWLSky::beginDeferredPass(S32 pass) @@ -111,7 +115,10 @@ void LLDrawPoolWLSky::beginDeferredPass(S32 pass) void LLDrawPoolWLSky::endDeferredPass(S32 pass) { - + sky_shader = nullptr; + cloud_shader = nullptr; + sun_shader = nullptr; + moon_shader = nullptr; } void LLDrawPoolWLSky::renderFsSky(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader * shader) const -- cgit v1.2.3 From 3b10414c632e73d66d2840ddcd474a79fa120540 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 Aug 2018 11:47:18 -0700 Subject: Adding optional flags to settings objects. --- indra/newview/llenvironment.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 6e19df0a94..3a1aec6319 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -444,11 +444,15 @@ F32 LLEnvironment::getWaterHeight() const bool LLEnvironment::getIsSunUp() const { + if (!mCurrentEnvironment || !mCurrentEnvironment->getSky()) + return false; return mCurrentEnvironment->getSky()->getIsSunUp(); } bool LLEnvironment::getIsMoonUp() const { + if (!mCurrentEnvironment || !mCurrentEnvironment->getSky()) + return false; return mCurrentEnvironment->getSky()->getIsMoonUp(); } -- cgit v1.2.3 From fa2b53385eb27fc1c42016a48267f92f7f9567a8 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 Aug 2018 14:25:07 -0700 Subject: Better code for finding a file when loading legacy windlights --- indra/newview/llsettingsvo.cpp | 89 ++++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 38 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 12f487398f..6426e95f6c 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -67,7 +67,7 @@ namespace { LLSD ensure_array_4(LLSD in, F32 fill); - LLSD read_legacy_preset_data(const std::string& path); + LLSD read_legacy_preset_data(const std::string &name, const std::string& path); //------------------------------------------------------------------------- class LLSettingsInventoryCB : public LLInventoryCallback @@ -440,30 +440,13 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n return skyp; } -namespace -{ - // This is a disturbing hack - std::string legacy_name_to_filename(const std::string &name) - { - std::string fixedname(LLURI::escape(name)); - - boost::algorithm::replace_all(fixedname, "-", "%2D"); - return fixedname; - } -} - LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::string &name, const std::string &path) { - std::string full_path(path); - std::string full_name(legacy_name_to_filename(name)); - full_name += ".xml"; - - gDirUtilp->append(full_path, full_name); - LLSD legacy_data = read_legacy_preset_data(full_path); + LLSD legacy_data = read_legacy_preset_data(name, path); if (!legacy_data) { - LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL; return ptr_t(); } @@ -707,16 +690,11 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::string &name, const std::string &path) { - std::string full_path(path); - std::string full_name(legacy_name_to_filename(name)); - full_name += ".xml"; - - gDirUtilp->append(full_path, full_name); - LLSD legacy_data = read_legacy_preset_data(full_path); + LLSD legacy_data = read_legacy_preset_data(name, path); if (!legacy_data) { - LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL; return ptr_t(); } @@ -961,16 +939,11 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPresetFile(const std::string &name, const std::string &path) { - std::string full_path(path); - std::string full_name(legacy_name_to_filename(name)); - full_name += ".xml"; - - gDirUtilp->append(full_path, full_name); - LLSD legacy_data = read_legacy_preset_data(full_path); + LLSD legacy_data = read_legacy_preset_data(name, path); if (!legacy_data) { - LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << full_path << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL; return ptr_t(); } @@ -1261,15 +1234,55 @@ namespace return out; } + // This is a disturbing hack + std::string legacy_name_to_filename(const std::string &name, bool convertdash = false) + { + std::string fixedname(LLURI::escape(name)); + + if (convertdash) + boost::algorithm::replace_all(fixedname, "-", "%2D"); + + return fixedname; + } + //--------------------------------------------------------------------- - LLSD read_legacy_preset_data(const std::string& path) + LLSD read_legacy_preset_data(const std::string &name, const std::string& path) { llifstream xml_file; -// std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); - xml_file.open(path.c_str()); + std::string full_path(path); + std::string full_name(name); + full_name += ".xml"; + gDirUtilp->append(full_path, full_name); + + xml_file.open(full_path.c_str()); if (!xml_file) - return LLSD(); + { + std::string bad_path(full_path); + full_path = path; + full_name = legacy_name_to_filename(name); + full_name += ".xml"; + gDirUtilp->append(full_path, full_name); + + LL_INFOS("LEGACYSETTING") << "Could not open \"" << bad_path << "\" trying escaped \"" << full_path << "\"" << LL_ENDL; + + xml_file.open(full_path.c_str()); + if (!xml_file) + { + LL_WARNS("LEGACYSETTING") << "Unable to open legacy windlight \"" << name << "\" from " << path << LL_ENDL; + + full_path = path; + full_name = legacy_name_to_filename(name, true); + full_name += ".xml"; + gDirUtilp->append(full_path, full_name); + xml_file.open(full_path.c_str()); + if (!xml_file) + { + LL_WARNS("LEGACYSETTING") << "Unable to open legacy windlight \"" << name << "\" from " << path << LL_ENDL; + return LLSD(); + } + } + } LLSD params_data; LLPointer parser = new LLSDXMLParser(); -- cgit v1.2.3 From a32a4dc6369dd076eb75e648674843bd16a9258e Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 3 Sep 2018 15:20:53 +0300 Subject: MAINT-9068 FIXED EEP closing Day Cycle editor by clicking Cancel makes the environment static --- indra/newview/llfloatereditextdaycycle.cpp | 7 +++++-- indra/newview/llfloaterfixedenvironment.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 6abb698785..a1689ed04c 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -343,8 +343,11 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting) void LLFloaterEditExtDayCycle::onFocusReceived() { - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + if (isInVisibleChain()) + { + updateEditEnvironment(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + } } void LLFloaterEditExtDayCycle::onFocusLost() diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index ece4898935..82f056710e 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -147,8 +147,11 @@ void LLFloaterFixedEnvironment::onClose(bool app_quitting) void LLFloaterFixedEnvironment::onFocusReceived() { - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + if (isInVisibleChain()) + { + updateEditEnvironment(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); + } } void LLFloaterFixedEnvironment::onFocusLost() -- cgit v1.2.3 From a4c49904c67e123df0d8e1f68714cf13acfa1ffc Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 3 Sep 2018 19:32:22 +0300 Subject: MAINT-8989 Menu updates button instead of executing command --- indra/newview/llfloatereditextdaycycle.cpp | 2 +- indra/newview/llfloaterfixedenvironment.cpp | 2 +- indra/newview/llflyoutcombobtn.cpp | 36 ++++++++++++--- indra/newview/llflyoutcombobtn.h | 8 +++- .../default/xui/en/floater_edit_ext_day_cycle.xml | 2 +- .../skins/default/xui/en/menu_save_settings.xml | 54 ++++++++++++++-------- 6 files changed, 76 insertions(+), 28 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 6abb698785..f8c6e135c0 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -173,7 +173,7 @@ BOOL LLFloaterEditExtDayCycle::postBuild() mImportButton = getChild(BTN_IMPORT, true); mLoadFrame = getChild(BTN_LOADFRAME, true); - mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE); + mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE, false); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); getChild(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onClickCloseBtn(); }); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index ece4898935..3fc5a03d3a 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -108,7 +108,7 @@ BOOL LLFloaterFixedEnvironment::postBuild() getChild(BUTTON_NAME_CANCEL)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onClickCloseBtn(); }); getChild(BUTTON_NAME_LOAD)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonLoad(); }); - mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE); + mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE, false); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); mFlyoutControl->setMenuItemVisible(ACTION_COMMIT, false); diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp index d1a8b46c92..b008ee13be 100644 --- a/indra/newview/llflyoutcombobtn.cpp +++ b/indra/newview/llflyoutcombobtn.cpp @@ -29,14 +29,21 @@ #include "llflyoutcombobtn.h" #include "llviewermenu.h" -LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file) : - mParent(parent), +LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent, + const std::string &action_button, + const std::string &flyout_button, + const std::string &menu_file, + bool apply_immediately) : + mParent(parent), mActionButton(action_button), - mFlyoutButton(flyout_button) + mFlyoutButton(flyout_button), + mApplyImmediately(apply_immediately) { - // register action mapping before creating menu - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; + // register action mapping before creating menu + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; save_registar.add("FlyoutCombo.Button.Action", [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutItemSelected(ctrl, data); }); + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enabled_rgistar; + enabled_rgistar.add("FlyoutCombo.Button.Check", [this](LLUICtrl *ctrl, const LLSD &data) { return onFlyoutItemCheck(ctrl, data); }); mParent->childSetAction(flyout_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutButton(ctrl, data); }); mParent->childSetAction(action_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutAction(ctrl, data); }); @@ -119,7 +126,24 @@ void LLFlyoutComboBtnCtrl::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data LLMenuItemGL *pmenuitem = static_cast(ctrl); setSelectedItem(pmenuitem); - onFlyoutAction(pmenuitem, data); + if (mApplyImmediately) + { + onFlyoutAction(pmenuitem, data); + } +} + +bool LLFlyoutComboBtnCtrl::onFlyoutItemCheck(LLUICtrl *ctrl, const LLSD &data) +{ + if (mApplyImmediately) + { + return false; + } + else + { + LLMenuItemGL *pmenuitem = static_cast(ctrl); + + return pmenuitem->getName() == mSelectedName; + } } void LLFlyoutComboBtnCtrl::onFlyoutAction(LLUICtrl *ctrl, const LLSD &data) diff --git a/indra/newview/llflyoutcombobtn.h b/indra/newview/llflyoutcombobtn.h index 741ad03a37..b0dd4abadf 100644 --- a/indra/newview/llflyoutcombobtn.h +++ b/indra/newview/llflyoutcombobtn.h @@ -37,7 +37,11 @@ class LLFlyoutComboBtnCtrl { LOG_CLASS(LLFlyoutComboBtnCtrl); public: - LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file); + LLFlyoutComboBtnCtrl(LLPanel* parent, + const std::string &action_button, + const std::string &flyout_button, + const std::string &menu_file, + bool apply_immediately = true); void setMenuItemEnabled(const std::string &item, bool enabled); void setShownBtnEnabled(bool enabled); @@ -52,6 +56,7 @@ public: protected: void onFlyoutButton(LLUICtrl *, const LLSD &); void onFlyoutItemSelected(LLUICtrl *, const LLSD &); + bool onFlyoutItemCheck(LLUICtrl *, const LLSD &); void onFlyoutAction(LLUICtrl *, const LLSD &); void setSelectedItem(LLMenuItemGL *pitem); @@ -63,6 +68,7 @@ private: std::string mFlyoutButton; std::string mSelectedName; + bool mApplyImmediately; LLUICtrl::commit_signal_t mActionSignal; }; diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index e553948d9d..c8843db28b 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -538,7 +538,7 @@ Select a key frame from the timeline above to edit settings. left="5" top_pad="0" name="save_btn" - width="150" /> + width="156" />