Compare commits

...

6 Commits

Author SHA1 Message Date
Liru Færs
788b83bff3 Woops, thanks for catching this, Shyotl! 2020-04-18 19:15:49 -04:00
Liru Færs
c201ac90ba Track log names in a json map AND Fix processing local log load as system
Update old style callbacks for chatFromLogFile functions to lambdas
Keep track of people's log's name using their IDs, but don't rename.
Fallback on ID if name is empty (if the grid is a meanie)
Also track group names this way, sometimes those change.
Prefer std::array, since we're in the area.
2020-04-18 00:17:05 -04:00
Shyotl
af3c66ad08 Merge branch 'master' of https://github.com/singularity-viewer/SingularityViewer.git 2020-04-16 02:23:32 -05:00
Shyotl
9bffc4bb82 Attempt to squash spatial partition crash. 2020-04-16 00:52:55 -05:00
Shyotl
132db6225e Make Debug configuration compile once more. 2020-04-16 00:49:42 -05:00
Shyotl
257086cbfc Revert texture fetching behavior back closer to v3. 2020-04-16 00:36:56 -05:00
22 changed files with 195 additions and 127 deletions

View File

@@ -126,9 +126,12 @@ public:
// Returns true if this rotation is orthonormal with det ~= 1
inline bool isOkRotation() const;
} LL_ALIGN_POSTFIX(16);
#if !defined(LL_DEBUG)
static_assert(std::is_trivial<LLMatrix3a>::value, "LLMatrix3a must be a trivial type");
static_assert(std::is_standard_layout<LLMatrix3a>::value, "LLMatrix3a must be a standard layout type");
static_assert(std::is_trivial<LLRotation>::value, "LLRotation must be a trivial type");
static_assert(std::is_standard_layout<LLRotation>::value, "LLRotation must be a standard layout type");
#endif
#endif

View File

@@ -718,6 +718,8 @@ inline std::ostream& operator<<(std::ostream& s, const LLMatrix4a& m)
void matMulBoundBox(const LLMatrix4a &a, const LLVector4a *in_extents, LLVector4a *out_extents);
#if !defined(LL_DEBUG)
static_assert(std::is_trivial<LLMatrix4a>::value, "LLMatrix4a must be a trivial type");
static_assert(std::is_standard_layout<LLMatrix4a>::value, "LLMatrix4a must be a standard layout type");
#endif
#endif

View File

@@ -104,7 +104,8 @@ private:
LL_ALIGN_16(LLVector4a mV);
} LL_ALIGN_POSTFIX(16);
#if !defined(LL_DEBUG)
static_assert(std::is_trivial<LLPlane>::value, "LLPlane must be a trivial type");
static_assert(std::is_standard_layout<LLPlane>::value, "LLPlane must be a standard layout type");
#endif
#endif // LL_LLPLANE_H

View File

@@ -105,7 +105,9 @@ protected:
} LL_ALIGN_POSTFIX(16);
#if !defined(LL_DEBUG)
static_assert(std::is_trivial<LLQuaternion2>::value, "LLQuaternion2 must be a trivial type");
static_assert(std::is_standard_layout<LLQuaternion2>::value, "LLQuaternion2 must be a standard layout type");
#endif
#endif

View File

@@ -350,6 +350,8 @@ inline std::ostream& operator<<(std::ostream& s, const LLVector4a& v)
return s;
}
#if !defined(LL_DEBUG)
static_assert(std::is_trivial<LLVector4a>::value, "LLVector4a must be a be a trivial type");
static_assert(std::is_standard_layout<LLVector4a>::value, "LLVector4a must be a standard layout type");
#endif
#endif

View File

@@ -262,6 +262,8 @@ LLCacheName::~LLCacheName()
delete &impl;
}
const ReverseCache& LLCacheName::getReverseMap() const { return impl.mReverseCache; }
LLCacheName::Impl::Impl(LLMessageSystem* msg)
: mMsg(msg), mUpstreamHost(LLHost::invalid)
{

View File

@@ -57,6 +57,8 @@ public:
LLCacheName(LLMessageSystem* msg, const LLHost& upstream_host);
~LLCacheName();
const std::map<std::string, LLUUID>& getReverseMap() const;
// registers the upstream host
// for viewers, this is the currently connected simulator
// for simulators, this is the data server

View File

@@ -349,7 +349,10 @@ bool LLAttachmentsMgr::getPendingAttachments(uuid_set_t& ids) const
ids.clear();
// Returns the union of the LL maintained list of attachments that are waiting for link creation and our maintained list of attachments that are pending link creation
set_union(mRecentlyArrivedAttachments.begin(), mRecentlyArrivedAttachments.end(), mPendingAttachLinks.begin(), mPendingAttachLinks.end(), std::inserter(ids, ids.begin()));
ids.insert(mRecentlyArrivedAttachments.begin(), mRecentlyArrivedAttachments.end());
ids.insert(mPendingAttachLinks.begin(), mPendingAttachLinks.end());
// Singu Note: "Expression: Sequence not ordered" using std::set_union
//set_union(mRecentlyArrivedAttachments.begin(), mRecentlyArrivedAttachments.end(), mPendingAttachLinks.begin(), mPendingAttachLinks.end(), std::inserter(ids, ids.begin()));
return !ids.empty();
}

View File

@@ -1596,11 +1596,7 @@ void LLSpatialBridge::cleanupReferences()
LLDrawable::cleanupReferences();
if (mDrawable)
{
/*
DON'T DO THIS -- this should happen through octree destruction
mDrawable->setSpatialGroup(NULL);
mDrawable->setGroup(NULL);
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
@@ -1608,17 +1604,18 @@ void LLSpatialBridge::cleanupReferences()
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
LLDrawable* drawable = child->mDrawable;
if (drawable)
{
drawable->setSpatialGroup(NULL);
drawable->setGroup(NULL);
}
}
}*/
}
LLPointer<LLDrawable> drawablep = mDrawable;
LLPointer<LLSpatialBridge> bridgep = mDrawable->getSpatialBridge();
mDrawable->setSpatialBridge(nullptr);
mDrawable = nullptr;
drawablep->setSpatialBridge(nullptr);
bridgep = nullptr;
}
}

View File

@@ -79,7 +79,7 @@
//
LLColor4 agent_chat_color(const LLUUID& id, const std::string&, bool local_chat = true);
LLColor4 get_text_color(const LLChat& chat, bool from_im = false);
void show_log_browser(const std::string&, const std::string&);
void show_log_browser(const std::string&, const LLUUID&);
//
// Member Functions
@@ -96,7 +96,7 @@ LLFloaterChat::LLFloaterChat(const LLSD& seed)
LLTextEditor* history_editor_with_mute = getChild<LLTextEditor>("Chat History Editor with mute");
getChild<LLUICtrl>("show mutes")->setCommitCallback(boost::bind(&LLFloaterChat::onClickToggleShowMute, this, _2, getChild<LLTextEditor>("Chat History Editor"), history_editor_with_mute));
getChild<LLUICtrl>("chat_history_open")->setCommitCallback(boost::bind(show_log_browser, "chat", "chat"));
getChild<LLUICtrl>("chat_history_open")->setCommitCallback(boost::bind(show_log_browser, "chat", LLUUID::null));
}
LLFloaterChat::~LLFloaterChat()
@@ -243,7 +243,7 @@ void log_chat_text(const LLChat& chat)
else
histstr = chat.mText;
LLLogChat::saveHistory(std::string("chat"), histstr);
LLLogChat::saveHistory("chat", LLUUID::null, histstr);
}
// static
void LLFloaterChat::addChatHistory(LLChat& chat, bool log_to_file)
@@ -535,28 +535,19 @@ LLColor4 get_text_color(const LLChat& chat, bool from_im)
//static
void LLFloaterChat::loadHistory()
{
LLLogChat::loadHistory("chat", &chatFromLogFile, (void*)LLFloaterChat::getInstance());
LLLogChat::loadHistory("chat", LLUUID::null, boost::bind(&LLFloaterChat::chatFromLogFile, getInstance(), _1, _2));
}
//static
void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata)
void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type, const std::string& line)
{
switch (type)
bool log_line = type == LLLogChat::LOG_LINE;
if (log_line || gSavedPerAccountSettings.getBOOL("LogChat"))
{
case LLLogChat::LOG_EMPTY:
if (gSavedPerAccountSettings.getBOOL("LogChat"))
addChatHistory(static_cast<LLFloaterChat*>(userdata)->getString("IM_logging_string"), false);
break;
case LLLogChat::LOG_END:
if (gSavedPerAccountSettings.getBOOL("LogChat"))
addChatHistory(static_cast<LLFloaterChat*>(userdata)->getString("IM_end_log_string"), false);
break;
case LLLogChat::LOG_LINE:
addChatHistory(line, FALSE);
break;
default:
// nothing
break;
LLStyleSP style(new LLStyle(true, gSavedSettings.getColor4("LogChatColor"), LLStringUtil::null));
const auto text = log_line ? line : getString(type == LLLogChat::LOG_END ? "IM_end_log_string" : "IM_logging_string");
for (const auto& ed_name : { "Chat History Editor", "Chat History Editor with mute" })
getChild<LLTextEditor>(ed_name)->appendText(text, false, true, style, false);
}
}

View File

@@ -73,7 +73,7 @@ public:
static void triggerAlerts(const std::string& text);
void onClickToggleShowMute(bool show_mute, class LLTextEditor* history_editor, LLTextEditor* history_editor_with_mute);
static void chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata);
void chatFromLogFile(LLLogChat::ELogLineType type, const std::string& line);
static void loadHistory();
static void* createSpeakersPanel(void* data);
static void* createChatPanel(void* data);

View File

@@ -375,9 +375,7 @@ LLFloaterIMPanel::LLFloaterIMPanel(
if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
{
LLLogChat::loadHistory(mLogLabel,
&chatFromLogFile,
(void *)this);
LLLogChat::loadHistory(mLogLabel, mSessionType == P2P_SESSION ? mOtherParticipantUUID : mSessionUUID, boost::bind(&LLFloaterIMPanel::chatFromLogFile, this, _1, _2));
}
if ( !mSessionInitialized )
@@ -861,7 +859,7 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incol
// Floater title contains display name -> bad idea to use that as filename
// mLogLabel, however, is the old legacy name
//LLLogChat::saveHistory(getTitle(),histstr);
LLLogChat::saveHistory(mLogLabel, histstr);
LLLogChat::saveHistory(mLogLabel, mSessionType == P2P_SESSION ? mOtherParticipantUUID : mSessionUUID, histstr);
// [/Ansariel: Display name support]
}
@@ -1179,9 +1177,9 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
}
}
void show_log_browser(const std::string& name, const std::string& id)
void show_log_browser(const std::string& name, const LLUUID& id)
{
const std::string file(LLLogChat::makeLogFileName(name));
const std::string file(LLLogChat::makeLogFileName(name, id));
if (!LLFile::isfile(file))
{
make_ui_sound("UISndBadKeystroke");
@@ -1195,7 +1193,7 @@ void show_log_browser(const std::string& name, const std::string& id)
}
LLFloaterWebContent::Params p;
p.url("file:///" + file);
p.id(id);
p.id(id.asString());
p.show_chrome(false);
p.trusted_content(true);
LLFloaterWebContent::showInstance("log", p); // If we passed id instead of "log", there would be no control over how many log browsers opened at once.
@@ -1206,8 +1204,8 @@ void LLFloaterIMPanel::onClickHistory()
if (mOtherParticipantUUID.notNull())
{
// [Ansariel: Display name support]
//show_log_browser(getTitle(), mOtherParticipantUUID.asString());
show_log_browser(mLogLabel, mOtherParticipantUUID.asString());
//show_log_browser(getTitle(), mSessionType == P2P_SESSION ? mOtherParticipantUUID : mSessionUUID);
show_log_browser(mLogLabel, mSessionType == P2P_SESSION ? mOtherParticipantUUID : mSessionUUID);
// [/Ansariel: Display name support]
}
}
@@ -1671,39 +1669,16 @@ void LLFloaterIMPanel::removeTypingIndicator(const LLUUID& from_id)
}
}
//static
void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata)
void LLFloaterIMPanel::chatFromLogFile(LLLogChat::ELogLineType type, const std::string& line)
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
std::string message = line;
switch (type)
bool log_line = type == LLLogChat::LOG_LINE;
if (log_line || gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
{
case LLLogChat::LOG_EMPTY:
// add warning log enabled message
if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
{
message = LLFloaterChat::getInstance()->getString("IM_logging_string");
}
break;
case LLLogChat::LOG_END:
// add log end message
if (gSavedPerAccountSettings.getBOOL("LogInstantMessages"))
{
message = LLFloaterChat::getInstance()->getString("IM_end_log_string");
}
break;
case LLLogChat::LOG_LINE:
// just add normal lines from file
break;
default:
// nothing
break;
LLStyleSP style(new LLStyle(true, gSavedSettings.getColor4("LogChatColor"), LLStringUtil::null));
mHistoryEditor->appendText(log_line ? line :
getString(type == LLLogChat::LOG_END ? "IM_end_log_string" : "IM_logging_string"),
false, true, style, false);
}
//self->addHistoryLine(line, LLColor4::grey, FALSE);
LLStyleSP style(new LLStyle(true, gSavedSettings.getColor4("LogChatColor"), LLStringUtil::null));
self->mHistoryEditor->appendText(message, false, true, style, false);
}
void LLFloaterIMPanel::showSessionStartError(

View File

@@ -126,7 +126,7 @@ public:
// Handle other participant in the session typing.
void processIMTyping(const LLUUID& from_id, BOOL typing);
static void chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata);
void chatFromLogFile(LLLogChat::ELogLineType type, const std::string& line);
//show error statuses to the user
void showSessionStartError(const std::string& error_string);

View File

@@ -36,35 +36,100 @@
#include "lllogchat.h"
#include "llappviewer.h"
#include "llfloaterchat.h"
#include "llsdserialize.h"
static std::string get_log_dir_file(const std::string& filename)
{
return gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS, filename);
}
//static
std::string LLLogChat::makeLogFileName(std::string filename)
std::string LLLogChat::makeLogFileNameInternal(std::string filename)
{
if (gSavedPerAccountSettings.getBOOL("LogFileNamewithDate"))
static const LLCachedControl<bool> with_date(gSavedPerAccountSettings, "LogFileNamewithDate");
if (with_date)
{
time_t now;
time(&now);
char dbuffer[100]; /* Flawfinder: ignore */
if (filename == "chat")
{
static const LLCachedControl<std::string> local_chat_date_format(gSavedPerAccountSettings, "LogFileLocalChatDateFormat", "-%Y-%m-%d");
strftime(dbuffer, 100, local_chat_date_format().c_str(), localtime(&now));
}
else
{
static const LLCachedControl<std::string> ims_date_format(gSavedPerAccountSettings, "LogFileIMsDateFormat", "-%Y-%m");
strftime(dbuffer, 100, ims_date_format().c_str(), localtime(&now));
}
filename += dbuffer;
std::array<char, 100> dbuffer;
static const LLCachedControl<std::string> local_chat_date_format(gSavedPerAccountSettings, "LogFileLocalChatDateFormat", "-%Y-%m-%d");
static const LLCachedControl<std::string> ims_date_format(gSavedPerAccountSettings, "LogFileIMsDateFormat", "-%Y-%m");
strftime(dbuffer.data(), dbuffer.size(), (filename == "chat" ? local_chat_date_format : ims_date_format)().c_str(), localtime(&now));
filename += dbuffer.data();
}
cleanFileName(filename);
return get_log_dir_file(filename + ".txt");
}
static LLSD sIDMap;
static std::string get_ids_map_file() { return get_log_dir_file("ids_to_names.json"); }
void LLLogChat::initializeIDMap()
{
const auto map_file = get_ids_map_file();
if (LLFile::isfile(map_file)) // If we've already made this file, load our map from it
{
if (auto&& fstr = llifstream(map_file))
{
LLSDSerialize::fromNotation(sIDMap, fstr, LLSDSerialize::SIZE_UNLIMITED);
fstr.close();
}
}
else if (gCacheName) // Load what we can from name cache to initialize the map file
{
for (const auto& r : gCacheName->getReverseMap()) // For every name id pair
if (LLFile::isfile(makeLogFileNameInternal(r.first))) // If there's a log file for them
sIDMap[r.second.asString()] = r.first; // Add them to the map
if (auto&& fstr = llofstream(map_file))
{
LLSDSerialize::toPrettyNotation(sIDMap, fstr);
fstr.close();
}
}
}
//static
std::string LLLogChat::makeLogFileName(const std::string& username, const LLUUID& id)
{
const auto name = username.empty() ? id.asString() : username; // Fall back on ID if the grid sucks and we have no name
std::string filename = makeLogFileNameInternal(name);
if (id.notNull() && !LLFile::isfile(filename)) // No existing file by this user's current name, check for possible file rename
{
auto& entry = sIDMap[id.asString()];
const bool empty = !entry.size();
if (empty || entry != name) // If we haven't seen this entry yet, or the name is different than we remember
{
const auto migrateFile = [&filename](const std::string& name) {
std::string oldname = makeLogFileNameInternal(name);
if (!LLFile::isfile(oldname)) return false; // An old file by this name doesn't exist
LLFile::rename(oldname, filename); // Move the existing file to the new name
return true; // Report success
};
if (empty) // We didn't see this entry on load
{
// Ideally, we would look up the old names here via server request
// In lieu of that, our reverse cache has old names and new names that we've gained since our initialization of the ID map
for (const auto& r : gCacheName->getReverseMap())
if (r.second == id && migrateFile(r.first))
break;
}
else migrateFile(entry.asStringRef()); // We've seen this entry before, migrate old file if it exists
entry = name; // Update the entry to point to the new name
if (auto&& fstr = llofstream(get_ids_map_file())) // Write back to our map file
{
LLSDSerialize::toPrettyNotation(sIDMap, fstr);
fstr.close();
}
}
}
filename = cleanFileName(filename);
filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename);
filename += ".txt";
return filename;
}
std::string LLLogChat::cleanFileName(std::string filename)
void LLLogChat::cleanFileName(std::string& filename)
{
std::string invalidChars = "\"\'\\/?*:<>|[]{}~"; // Cannot match glob or illegal filename chars
S32 position = filename.find_first_of(invalidChars);
@@ -73,7 +138,6 @@ std::string LLLogChat::cleanFileName(std::string filename)
filename[position] = '_';
position = filename.find_first_of(invalidChars, position);
}
return filename;
}
static void time_format(std::string& out, const char* fmt, const std::tm* time)
@@ -92,6 +156,7 @@ static void time_format(std::string& out, const char* fmt, const std::tm* time)
charvector.resize(1+size); // Use the String Stone
format_the_time();
}
#undef format_the_time
out.assign(charvector.data());
}
@@ -117,15 +182,15 @@ std::string LLLogChat::timestamp(bool withdate)
//static
void LLLogChat::saveHistory(std::string const& filename, std::string line)
void LLLogChat::saveHistory(const std::string& name, const LLUUID& id, const std::string& line)
{
if(!filename.size())
if(name.empty() && id.isNull())
{
LL_INFOS() << "Filename is Empty!" << LL_ENDL;
return;
}
LLFILE* fp = LLFile::fopen(LLLogChat::makeLogFileName(filename), "a"); /*Flawfinder: ignore*/
LLFILE* fp = LLFile::fopen(LLLogChat::makeLogFileName(name, id), "a"); /*Flawfinder: ignore*/
if (!fp)
{
LL_INFOS() << "Couldn't open chat history log!" << LL_ENDL;
@@ -140,10 +205,9 @@ void LLLogChat::saveHistory(std::string const& filename, std::string line)
static long const LOG_RECALL_BUFSIZ = 2048;
void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogLineType, std::string, void*), void* userdata)
void LLLogChat::loadHistory(const std::string& name, const LLUUID& id, std::function<void (ELogLineType, const std::string&)> callback)
{
bool filename_empty = filename.empty();
if (filename_empty)
if (name.empty() && id.isNull())
{
LL_WARNS() << "filename is empty!" << LL_ENDL;
}
@@ -154,7 +218,7 @@ void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogL
if (lines == 0) break;
// Open the log file.
LLFILE* fptr = LLFile::fopen(makeLogFileName(filename), "rb");
LLFILE* fptr = LLFile::fopen(makeLogFileName(name, id), "rb");
if (!fptr) break;
// Set pos to point to the last character of the file, if any.
@@ -199,20 +263,15 @@ void LLLogChat::loadHistory(std::string const& filename , void (*callback)(ELogL
// Read lines from the file one by one until we reach the end of the file.
while (fgets(buffer, LOG_RECALL_BUFSIZ, fptr))
{
size_t len = strlen(buffer);
int i = len - 1;
while (i >= 0 && (buffer[i] == '\r' || buffer[i] == '\n')) // strip newline chars from the end of the string
{
buffer[i] = '\0';
i--;
}
callback(LOG_LINE, buffer, userdata);
// strip newline chars from the end of the string
for (S32 i = strlen(buffer) - 1; i >= 0 && (buffer[i] == '\r' || buffer[i] == '\n'); --i)
buffer[i] = '\0';
callback(LOG_LINE, buffer);
}
fclose(fptr);
callback(LOG_END, LLStringUtil::null, userdata);
callback(LOG_END, LLStringUtil::null);
return;
}
callback(LOG_EMPTY, LLStringUtil::null, userdata);
callback(LOG_EMPTY, LLStringUtil::null);
}

View File

@@ -45,14 +45,15 @@ public:
LOG_LINE,
LOG_END
};
static void initializeIDMap();
static std::string timestamp(bool withdate = false);
static std::string makeLogFileName(std::string filename);
static void saveHistory(std::string const& filename, std::string line);
static void loadHistory(std::string const& filename,
void (*callback)(ELogLineType,std::string,void*),
void* userdata);
static std::string makeLogFileName(const std::string& name, const LLUUID& id);
static void saveHistory(const std::string& name, const LLUUID& id, const std::string& line);
static void loadHistory(const std::string& name, const LLUUID& id,
std::function<void (ELogLineType, const std::string&)> callback);
private:
static std::string cleanFileName(std::string filename);
static std::string makeLogFileNameInternal(std::string filename);
static void cleanFileName(std::string& filename);
};
#endif

View File

@@ -340,7 +340,7 @@ static std::string profile_picture_title(const std::string& str) { return "Profi
static void show_partner_help() { LLNotificationsUtil::add("ClickPartnerHelpAvatar", LLSD(), LLSD(), boost::bind(LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL, _1, _2)); }
void show_log_browser(const LLUUID& id, const LFIDBearer::Type& type)
{
void show_log_browser(const std::string& name, const std::string& id);
void show_log_browser(const std::string& name, const LLUUID& id);
std::string name;
if (type == LFIDBearer::AVATAR)
{
@@ -352,7 +352,7 @@ void show_log_browser(const LLUUID& id, const LFIDBearer::Type& type)
{
gCacheName->getGroupName(id, name);
}
show_log_browser(name, id.asString());
show_log_browser(name, id);
}
BOOL LLPanelAvatarSecondLife::postBuild()
{

View File

@@ -316,7 +316,7 @@ public:
void drawObjectBox(LLColor4 col);
LLSpatialPartition* getSpatialPartition() const {return (LLSpatialPartition*)mSpatialPartition;}
LLSpatialPartition* getSpatialPartition() const {return mSpatialPartition;}
//LISTENER FUNCTIONS
void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* face) final override;

View File

@@ -1837,6 +1837,7 @@ bool idle_startup()
display_startup();
LLStartUp::initNameCache();
LLLogChat::initializeIDMap(); // Name cache loaded, create a happy mappy
display_startup();
// update the voice settings *after* gCacheName initialization

View File

@@ -872,7 +872,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,
mCacheReadCount(0U),
mCacheWriteCount(0U)
{
mCanUseNET = mUrl.empty() && !gHippoGridManager->getConnectedGrid()->isSecondLife();
mCanUseNET = mUrl.empty(); // Necessary for precached UUID textures, regardless of grid.
if (!mCanUseNET)
{

View File

@@ -846,10 +846,12 @@ public:
};
LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part) :
LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLSpatialPartition* part) :
LLViewerOctreeGroup(node),
mSpatialPartition(part)
{
llassert(part);
mSpatialPartition->mGroups.push_back(this);
part->mLODSeed = (part->mLODSeed+1)%part->mLODPeriod;
mLODHash = part->mLODSeed;
@@ -867,12 +869,21 @@ LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctre
LLOcclusionCullingGroup::~LLOcclusionCullingGroup()
{
if (mSpatialPartition)
{
auto it = std::find_if(mSpatialPartition->mGroups.begin(), mSpatialPartition->mGroups.end(), [this](LLOcclusionCullingGroup* rhs) {return rhs == this; });
llassert_always(it != mSpatialPartition->mGroups.end());
if (it != mSpatialPartition->mGroups.end())
{
mSpatialPartition->mGroups.erase(it);
}
}
releaseOcclusionQueryObjectNames();
}
BOOL LLOcclusionCullingGroup::needsUpdate()
{
return (LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE;
return mSpatialPartition && (LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE;
}
BOOL LLOcclusionCullingGroup::isRecentlyVisible() const
@@ -1070,6 +1081,10 @@ U32 LLOcclusionCullingGroup::getLastOcclusionIssuedTime()
void LLOcclusionCullingGroup::checkOcclusion()
{
if (mSpatialPartition == nullptr)
{
return;
}
if (LLPipeline::sUseOcclusion > 1)
{
LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_READBACK);
@@ -1170,6 +1185,10 @@ static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_DRAW("Draw");
void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* shift)
{
if (mSpatialPartition == nullptr)
{
return;
}
LLGLDisable<GL_STENCIL_TEST> stencil;
if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1)
{
@@ -1319,6 +1338,11 @@ LLViewerOctreePartition::LLViewerOctreePartition() :
LLViewerOctreePartition::~LLViewerOctreePartition()
{
llassert(mGroups.empty());
for (auto& entry : mGroups)
{
entry->mSpatialPartition = nullptr;
}
delete mOctree;
mOctree = NULL;
}

View File

@@ -44,6 +44,7 @@ class LLViewerOctreeEntryData;
class LLViewerOctreeGroup;
class LLViewerOctreeEntry;
class LLViewerOctreePartition;
class LLSpatialPartition;
typedef LLOctreeListener<LLViewerOctreeEntry> OctreeListener;
typedef LLTreeNode<LLViewerOctreeEntry> TreeNode;
@@ -288,7 +289,7 @@ protected:
virtual ~LLOcclusionCullingGroup();
public:
LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part);
LLOcclusionCullingGroup(OctreeNode* node, LLSpatialPartition* part);
LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLViewerOctreeGroup(rhs)
{
*this = rhs;
@@ -330,7 +331,8 @@ protected:
S32 mLODHash;
LLViewerOctreePartition* mSpatialPartition;
friend class LLViewerOctreePartition;
LLSpatialPartition* mSpatialPartition;
U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS];
public:
@@ -355,6 +357,7 @@ public:
BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed
U32 mLODSeed;
U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed)
std::vector<LLOcclusionCullingGroup*> mGroups;
};
class LLViewerOctreeCull : public OctreeTraveler

View File

@@ -1153,7 +1153,7 @@ void LLPipeline::createGLBuffers()
{
if (!mNoiseMap)
{
LLVector3 noise[NOISE_MAP_RES*NOISE_MAP_RES];
std::array<LLVector3, NOISE_MAP_RES * NOISE_MAP_RES> noise;
F32 scaler = gSavedSettings.getF32("RenderDeferredNoise")/100.f;
for (auto& val : noise)
@@ -1166,7 +1166,7 @@ void LLPipeline::createGLBuffers()
mNoiseMap = LLImageGL::createTextureName();
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap->getTexName());
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, NOISE_MAP_RES, NOISE_MAP_RES, GL_RGB, GL_FLOAT, noise);
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, NOISE_MAP_RES, NOISE_MAP_RES, GL_RGB, GL_FLOAT, noise.data());
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
}