Commit 889018c6 authored by NiranV's avatar NiranV

Fixed: Avatar Render Settings not updating when any setting is changed.

parent bf45715c
...@@ -996,7 +996,8 @@ class LLSettingsContextMenu : public LLListContextMenu ...@@ -996,7 +996,8 @@ class LLSettingsContextMenu : public LLListContextMenu
class LLAvatarRenderMuteListObserver : public LLMuteListObserver class LLAvatarRenderMuteListObserver : public LLMuteListObserver
{ {
/* virtual */ void onChange() { LLFloaterPreference::setNeedsUpdate(); } // //BD - Multithreading Experiments
/* virtual */ void onChange() { LLFloaterPreference::triggerUpdate(); }
}; };
static LLAvatarRenderMuteListObserver sAvatarRenderMuteListObserver; static LLAvatarRenderMuteListObserver sAvatarRenderMuteListObserver;
...@@ -2358,22 +2359,15 @@ void LLFloaterPreference::draw() ...@@ -2358,22 +2359,15 @@ void LLFloaterPreference::draw()
refreshEverything(); refreshEverything();
} }
// //BD - Avatar Rendering Settings // //BD - Multithreading Experiments
if (!mUpdateThread.joinable() && !mNeedsUpdate) // We need to join the thread here whenever it is done because we
{ // check whether it is joinable to see if its currently available
//BD - Multithreading Experiments // to do something for us. A thread becomes joinable and thus
// Updating and filling the render settings list tanks performance hard, // unavailable when its set to do something but it will remain
// even harder with bigger lists, this is the perfect candidate to test // joinable even when its done.
// multithreading to get rid of the growing time it takes to update the if (mUpdateThread.joinable())
// the list. {
// mUpdateThread.join();
// Experiments so far have shown that multithreading is a very crashy
// endeavour, everything can crash at any time for seemingly no reason
// and multithreading this stuff needs a lot of thought put into it to
// make use of it proper. It's tiny babysteps so far but the results are
// extremely promising, showing complete elimination of the increasingly
// longer freeze times.
mUpdateThread = std::thread(&LLFloaterPreference::updateList, this);
} }
if (mNeedsUpdate) if (mNeedsUpdate)
...@@ -2583,11 +2577,21 @@ void LLFloaterPreference::onOpen(const LLSD& key) ...@@ -2583,11 +2577,21 @@ void LLFloaterPreference::onOpen(const LLSD& key)
refreshEnabledState(); refreshEnabledState();
toggleTabs(); toggleTabs();
// //BD - Avatar Rendering Settings // //BD - Multithreading Experiments
// Updating and filling the render settings list tanks performance hard,
// even harder with bigger lists, this is the perfect candidate to test
// multithreading to get rid of the growing time it takes to update the
// the list.
//
// Experiments so far have shown that multithreading is a very crashy
// endeavour, everything can crash at any time for seemingly no reason
// and multithreading this stuff needs a lot of thought put into it to
// make use of it proper. It's tiny babysteps so far but the results are
// extremely promising, showing complete elimination of the increasingly
// longer freeze times.
if (!mUpdateThread.joinable()) if (!mUpdateThread.joinable())
{ {
mUpdateThread = std::thread(&LLFloaterPreference::updateList, this); mUpdateThread = std::thread(&LLFloaterPreference::updateList, this);
//mUpdateThread.detach();
} }
// //BD - Unlimited Camera Presets // //BD - Unlimited Camera Presets
...@@ -4035,8 +4039,12 @@ void LLFloaterPreference::onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y) ...@@ -4035,8 +4039,12 @@ void LLFloaterPreference::onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y)
} }
} }
//BD - Multithreading Experiments
void LLFloaterPreference::updateList() void LLFloaterPreference::updateList()
{ {
//BD - Clear our params list before we start.
mScrollListParams.clear();
S32 i = 0; S32 i = 0;
LLAvatarName av_name; LLAvatarName av_name;
for (std::map<LLUUID, S32>::iterator iter = LLRenderMuteList::getInstance()->sVisuallyMuteSettingsMap.begin(); iter != LLRenderMuteList::getInstance()->sVisuallyMuteSettingsMap.end(); iter++) for (std::map<LLUUID, S32>::iterator iter = LLRenderMuteList::getInstance()->sVisuallyMuteSettingsMap.begin(); iter != LLRenderMuteList::getInstance()->sVisuallyMuteSettingsMap.end(); iter++)
...@@ -4062,6 +4070,7 @@ void LLFloaterPreference::updateList() ...@@ -4062,6 +4070,7 @@ void LLFloaterPreference::updateList()
mNeedsUpdate = true; mNeedsUpdate = true;
} }
//BD - Multithreading Experiments
void LLFloaterPreference::fillList() void LLFloaterPreference::fillList()
{ {
mAvatarSettingsList->deleteAllItems(); mAvatarSettingsList->deleteAllItems();
...@@ -4084,7 +4093,9 @@ void LLFloaterPreference::onFilterEdit(const std::string& search_string) ...@@ -4084,7 +4093,9 @@ void LLFloaterPreference::onFilterEdit(const std::string& search_string)
if (mNameFilter != filter_upper) if (mNameFilter != filter_upper)
{ {
mNameFilter = filter_upper; mNameFilter = filter_upper;
mNeedsUpdate = false; // //BD - Multithreading Experiments
// Ouch...
triggerUpdate();
} }
} }
...@@ -4157,11 +4168,17 @@ bool LLFloaterPreference::isActionChecked(const LLSD& userdata, const LLUUID& av ...@@ -4157,11 +4168,17 @@ bool LLFloaterPreference::isActionChecked(const LLSD& userdata, const LLUUID& av
return false; return false;
} }
void LLFloaterPreference::setNeedsUpdate() //BD - Multithreading Experiments
void LLFloaterPreference::triggerUpdate()
{ {
LLFloaterPreference* instance = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences"); LLFloaterPreference* instance = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences");
if (!instance) return; if (instance)
instance->mNeedsUpdate = false; {
if (!instance->mUpdateThread.joinable())
{
instance->mUpdateThread = std::thread(&LLFloaterPreference::updateList, instance);
}
}
} }
void LLFloaterPreference::onClickAdd(const LLSD& userdata) void LLFloaterPreference::onClickAdd(const LLSD& userdata)
...@@ -4232,11 +4249,13 @@ void LLFloaterPreference::setAvatarRenderSetting(const uuid_vec_t& av_ids, S32 n ...@@ -4232,11 +4249,13 @@ void LLFloaterPreference::setAvatarRenderSetting(const uuid_vec_t& av_ids, S32 n
} }
} }
if (!mUpdateThread.joinable()) // //BD - Multithreading Experiments
{ // Trigger an update whenever we change something.
mUpdateThread = std::thread(&LLFloaterPreference::updateList, this); // Quite expensive, we could instead change it to change the selected entries only
//mUpdateThread.detach(); // but since we are doing this in a separate thread anyway we don't care.
} // TODO: Make it change the entries only and only call a refresh whenever something
// has changed from the outside.
triggerUpdate();
} }
} }
......
...@@ -267,7 +267,7 @@ class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver, ...@@ -267,7 +267,7 @@ class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver,
std::string createTimestamp(S32 datetime); std::string createTimestamp(S32 datetime);
static void setNeedsUpdate(); static void triggerUpdate();
private: private:
...@@ -394,6 +394,18 @@ class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver, ...@@ -394,6 +394,18 @@ class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver,
std::array<LLUICtrl*, 2> mRenderProjectorShadowResolution; std::array<LLUICtrl*, 2> mRenderProjectorShadowResolution;
std::array<LLUICtrl*, 2> mExodusRenderToneAdvOptC; std::array<LLUICtrl*, 2> mExodusRenderToneAdvOptC;
// //BD - Multithreading Experiments
// Updating and filling the render settings list tanks performance hard,
// even harder with bigger lists, this is the perfect candidate to test
// multithreading to get rid of the growing time it takes to update the
// the list.
//
// Experiments so far have shown that multithreading is a very crashy
// endeavour, everything can crash at any time for seemingly no reason
// and multithreading this stuff needs a lot of thought put into it to
// make use of it proper. It's tiny babysteps so far but the results are
// extremely promising, showing complete elimination of the increasingly
// longer freeze times.
std::thread mUpdateThread; std::thread mUpdateThread;
std::vector<LLSD> mScrollListParams; std::vector<LLSD> mScrollListParams;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment